先推廣一下QQ群:
二、關鍵部分代碼:
1.數據結構定義
MBRSIZE 512 BOOTRECORDSIZE 440 DISKSIGNEDSIZE 4 RESERVESIZE 2 DPTNUMBER 4 DPTSIZE 16 ENDSIGNSIZE 2* UCHAR szStartHeadNumber; UCHAR szStartSectorNumber; UCHAR szStartCylinderNumber; UCHAR szPartitionType; UCHAR szEndHeadNumber; UCHAR szEndSectorNumber; UCHAR szEndCylinderNumber; ULONG ulSectorsPreceding; ULONG ulSectorsInPartition; }DPT, * UCHAR ulSigned[DISKSIGNEDSIZE]; UCHAR szReserve[RESERVESIZE]; DPT Dpt[DPTNUMBER]; UCHAR szEndSign[ENDSIGNSIZE]; }MBR, *PMBR;
2.關鍵程序實現
CMBRInfoDlg::InitMBRTree(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(= m_ctrlMBRTree.InsertItem(_T(, , = = = _T(* (!ReadFile(m_hDevice, (LPVOID)szMBRInfo, MBRSIZE * (UCHAR), &==* &&szMBRInfo[BOOTRECORDSIZE + ( i = ; i < ; ++= szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i *= szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = *((*)&szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + = *((*)&szMBRInfo[BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + i * DPTSIZE + &szMBRInfo[MBRSIZE -= _T( ( i = ; i < MBRSIZE; i++ * =+= ((i + ) % == += _T(+= _T( CMBRInfoDlg::OnTvnSelchangedTreeMbr(NMHDR *pNMHDR, LRESULT *= reinterpret_cast<LPNMTREEVIEW> HTREEITEM hItem == (strItemText == _T(, * BOOTRECORDSIZE - = _T( (strItemText == _T( * BOOTRECORDSIZE, * (BOOTRECORDSIZE + DISKSIGNEDSIZE) - = _T( (strItemText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE) - = _T( (strItemText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTNUMBER * DPTSIZE) - = _T( (strItemText == _T( * (MBRSIZE - ENDSIGNSIZE), * MBRSIZE - = _T( (strItemText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE) - = _T( (strItemText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * ) - = _T( (strItemText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * ) - = _T( (strItemText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * ) - = _T( (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - (m_Mbr.Dpt[].szBootSign == = _T( (m_Mbr.Dpt[].szBootSign == = _T(= _T( (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - (m_Mbr.Dpt[].szBootSign == = _T( (m_Mbr.Dpt[].szBootSign == = _T(= _T( (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - (m_Mbr.Dpt[].szBootSign == = _T( (m_Mbr.Dpt[].szBootSign == = _T(= _T( (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - (m_Mbr.Dpt[].szBootSign == = _T( (m_Mbr.Dpt[].szBootSign == = _T(= _T( (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - = _T( (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - ), m_Mbr.Dpt[].szStartSectorNumber & (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - ), m_Mbr.Dpt[].szStartSectorNumber & (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[].szStartSectorNumber & (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[].szStartSectorNumber & (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - ), (()(m_Mbr.Dpt[].szStartSectorNumber & ) << ) + m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - ), (()(m_Mbr.Dpt[].szStartSectorNumber & ) << ) + m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), (()(m_Mbr.Dpt[].szStartSectorNumber & ) << ) + m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), (()(m_Mbr.Dpt[].szStartSectorNumber & ) << ) + m_Mbr.Dpt[ (strItemText == _T(== iPartitionType = (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - = m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - = m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - = m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - = m_Mbr.Dpt[ = _T( = _T( = _T( = _T( = _T( = _T( = _T(= _T( (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - = _T( (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - ), m_Mbr.Dpt[].szEndSectorNumber & (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - ), m_Mbr.Dpt[].szEndSectorNumber & (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[].szEndSectorNumber & (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[].szEndSectorNumber & (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - ), (()(m_Mbr.Dpt[].szEndSectorNumber & ) << ) + m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - ), (()(m_Mbr.Dpt[].szEndSectorNumber & ) << ) + m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), (()(m_Mbr.Dpt[].szEndSectorNumber & ) << ) + m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), (()(m_Mbr.Dpt[].szEndSectorNumber & ) << ) + m_Mbr.Dpt[ (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - ), m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - ), m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[ (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[ (strItemText == _T(== (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + ) - ), m_Mbr.Dpt[].ulSectorsInPartition, m_Mbr.Dpt[].ulSectorsInPartition * * / / / (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE + ) - ), m_Mbr.Dpt[].ulSectorsInPartition, m_Mbr.Dpt[].ulSectorsInPartition * * / / / (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[].ulSectorsInPartition, m_Mbr.Dpt[].ulSectorsInPartition * * / / / (strParentText == _T( * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ), * (BOOTRECORDSIZE + DISKSIGNEDSIZE + RESERVESIZE + DPTSIZE * + ) - ), m_Mbr.Dpt[].ulSectorsInPartition, m_Mbr.Dpt[].ulSectorsInPartition * * / / / *pResult = * pDC, CWnd* pDC-> (pWnd == CreateSolidBrush(RGB(, , CreateSolidBrush(RGB(, , = = _T(= CreateFile(_T( (INVALID_HANDLE_VALUE ===
三、程序下載地址
http://pan.baidu.com/s/1jGKCa94