⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 backup_disk_sector.hpp

📁 命令行方式的硬盘工具 可以在dos和nt下运行。 需要djgpp和vs7.0以上
💻 HPP
字号:
/********************************************************************
	created:	2004/09/27
	created:	27:9:2004   22:21
	filename: 	c:\sun\srcwork\tools\cmdtools\backup_disk_sector.hpp
	file path:	c:\sun\srcwork\tools\cmdtools
	file base:	backup_disk_sector
	file ext:	hpp
	author:		孙宝建(sunbaojian)
	version:	1.0.0
	
	purpose:	备份硬盘分区表
*********************************************************************/

#ifndef _INCLUDE_BACKUP_DISK_SECTOR_HPP_INCLUDE
#define _INCLUDE_BACKUP_DISK_SECTOR_HPP_INCLUDE

#ifndef _INT13_H
#include "int13.hpp"
#endif

#ifndef _DRIVE_H
#include "drive.hpp"
#endif


using namespace SLib;

#pragma pack(1)

const WORD cw_DISK_BACKUP_SECTOR_DATA_FLAG	= 0X4244;
const WORD cw_DISK_BACKUP_SECTOR_VERSION1	= 0X1000;
const DWORD c_DISK_BACKUP_MAX_PARTITIONS	= 28;
const DWORD c_DISK_BACKUP_TYPE_PARTITION	= 1;
const DWORD c_DISK_BACKUP_TYPE_BOOT			= 2;

typedef struct tagDiskBackupSector
{
	PARTITION partition;
	WORD  wFlag;
	WORD  wVersion;
	DWORD dwType;
	UINT64 SectorPosition;
	UINT64 ReferencePosition;
	UINT64 BootPosition;
	char cFileName[64];
	char cSectorPositionString[64];
	DWORD dwCheckSum;
	
	tagDiskBackupSector(void)
	{
		memset(this, 0, sizeof(tagDiskBackupSector));
		wFlag = cw_DISK_BACKUP_SECTOR_DATA_FLAG;
		wVersion = cw_DISK_BACKUP_SECTOR_VERSION1;
	};
}DISK_BACKUP_SECTOR,*PDISK_BACKUP_SECTOR;


class CBackupDiskSector
{
public:
	CBackupDiskSector(CInt13 * pint13, CSError *perror):
		m_ExtenedPartitionPositition(0),
		m_iPartitionCount(0),
		m_iBootCount(0),
		m_iRestoreFileCount(0),
		m_pInt13(pint13),
		m_pError(perror)
		{
			for (int i=0; i<c_DISK_BACKUP_MAX_PARTITIONS ;i++)
			{
				m_pRestoreIFilePointer[i] = NULL;
			}
			;
		};

	~CBackupDiskSector(void);
	virtual void PrintMsg(const string &s);
	void BackupAllDisk(void);
	BOOL BackupOneDisk(const string & spath);
	void RestoreAllDisk(void);
	BOOL RestoreOneDisk(const string & fileName);

protected:
	int m_iPartitionCount;
	int m_iBootCount;
	int m_iRestoreFileCount;
	UINT64 m_SectorPosition[c_DISK_BACKUP_MAX_PARTITIONS];
	UINT64 m_ExtenedPartitionPositition;

	CInt13 *m_pInt13;
	CSError *m_pError;
	string m_sPath;
	ofstream m_pPartitionListFile;
	ifstream *m_pRestoreIFilePointer[c_DISK_BACKUP_MAX_PARTITIONS];

	void BackupPrimerPartition(UINT64 sectorPosition);
	void BackupExtendedPartition(UINT64 sectorPosition);
	void GenFileName(string & sfileName, int type);
	void GenFullFileName(const string & fileName, string & fullName);
	void BackupLogicalDisk(UINT64 startSector);
	void CloseAllRestoreFile(void);
	BOOL CheckRestoreFiles(const string & sfileName);
	BOOL WriteFile(const char * pfileName, void *buf, int len);
};

#endif //_INCLUDE_BACKUP_DISK_SECTOR_HPP_INCLUDE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -