- UID
- 25094
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-1-10
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
修复硬盘分区FIXHDPT V2.0的源程序
2001年08月08日 阅读次数: 279
该程序对FAT 16的修复很有效,对FAT 32扩展分区(D、E等)的修复也很有效,对FAT 32主分区的修复只要稍作修改也可以使用。
本程序用Borland C++ 3.1或者Turbo C++ 3.0编译,其中的MBR_DATA.H头文件由后面给出的MBR2C程序自动从正常的硬盘引导区中提取。
FIXHDPT.CPP源程序:
#include
#include
#include
#include
#include
#include
#include
#include "mbr_data.h"
typedef struct {
unsigned char Head,Sector,Track;
} HST;
typedef struct {
unsigned char ActiveSign;
HST PTBegin;
unsigned char PTType;
HST PTEnd;
unsigned long PTBeginID;
unsigned long PTSize;
} HDPT;
HDPT HDPT1,HDPT2;
unsigned int MaxHead,MaxTrack,MaxSector;
int MainMenu(void);
int WarningPrompt(char *Message);
void DetectHD(void);
void RewriteMBR(void);
void FixHDPT(void);
void ClearHDPT(void);
void AutoFixHD(void);
void QuickFdisk(void);
void RebootComputer(void);
HST HDToHST(unsigned int Head1,unsigned int Track1,unsigned int Sector1);
void HSTToHD(HST HST2,unsigned int &Head2,unsigned int &Track2,
unsigned int &Sector2);
unsigned int SearchHD(void);
void ReCreateHDPT(unsigned int BeginTrack);
int main(int argc,char *argv[])
{
printf("FIXHDPT V2.0\n");
printf("Fix Hard Disk Partition Table Tool\n");
printf("Copyright(C) by Zhao Shi-ping\n");
printf("TBsoft Software Studio 1997/10\n\n");
if(argc==2)
{
if(stricmp(argv[1],"/?")==0)
{
printf("Usage:\n");
printf(" FIXHDPT /? : View help information.\n");
printf(" FIXHDPT /R : Rewrite MBR.\n");
printf(" FIXHDPT /F : Fix HD partition table.\n");
printf(" FIXHDPT /C : Clear HD partition table.\n");
printf(" FIXHDPT /A : Automatic Fix HD.\n");
printf(" FIXHDPT /Q : Quick fdisk.\n");
printf(" FIXHDPT /B : Reboot computer.\n\n");
printf(" If the command line didn''t have command line parameters,
FIXHDPT V2.0\n");
printf("could view its menu !\n");
exit(0);
}
if(stricmp(argv[1],"/R")==0)
{
RewriteMBR();
exit(0);
}
if(stricmp(argv[1],"/F")==0)
{
FixHDPT();
exit(0);
}
if(str |
|