程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> MBR解析

MBR解析

編輯:C++入門知識

先推廣一下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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved