因为mbr读写比较危险,数据无价,请确保看懂所有代码后再运行调试!!!
<pre name="code" class="cpp">#include<iostream>
#include<windows.h>
/* interfAcer */
/*欢迎访问我的csdn blog http://blog.youkuaiyun.com/nibiru_holmes*/
/*如果没反应请以管理员运行*/
using namespace std;
#define BOOTRECORDSIZE 440
typedef struct _BOOTRECORD {
unsigned char BootRecord[BOOTRECORDSIZE];
}BOOTRECORD,*PBOOTRECORD;
#define DPTSIZE 64
typedef struct _DPT {
unsigned char Dpt[DPTSIZE];
}DPT,*PDPT;
typedef struct _MBR {
BOOTRECORD BootRecord; //引导程序
unsigned char ulSinged[4]; //Windows 磁盘签名
unsigned char sReserve[2]; //保留位
DPT Dpt; //分区表
unsigned char EndSign[2]; //结束标志
}MBR,*PMBR;
#define DPTNUMBER 4
typedef struct _DP {
unsigned char BootSign; //引导标志
unsigned char StartHs