亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? backup_disk_sector.cpp

?? 命令行方式的硬盤工具 可以在dos和nt下運行。 需要djgpp和vs7.0以上
?? CPP
字號:
/********************************************************************
	created:	2004/09/27
	created:	27:9:2004   22:22
	filename: 	c:\sun\srcwork\tools\cmdtools\backup_disk_sector.cpp
	file path:	c:\sun\srcwork\tools\cmdtools
	file base:	backup_disk_sector
	file ext:	cpp
	author:		孫寶建(sunbaojian)
	version:	1.0.0
	
	purpose:	備份硬盤分區(qū)表
*********************************************************************/

#include "StdAfx.h"

#ifndef _INCLUDE_BACKUP_DISK_SECTOR_HPP_INCLUDE
#include "backup_disk_sector.hpp"
#endif 

SLIB_DEFINE_FILE_NAME_VARIABLE

CBackupDiskSector::~CBackupDiskSector(void)
{
	m_pPartitionListFile.close();
	CloseAllRestoreFile();
}

void CBackupDiskSector::PrintMsg(const string &s)
{
	cout<< s;
}

void CBackupDiskSector::BackupAllDisk(void)
{
}

BOOL CBackupDiskSector::BackupOneDisk(const string & spath)
{
	DWORD ret = ERR_NO_ERROR;
	m_sPath = spath;
	ostringstream ostr;
	ostr.exceptions(ios_base::badbit|ios_base::failbit);
	if (!m_sPath.empty())
	{
		ostr<< m_sPath  
		#ifdef WIN32
			<< "\\";
		#else
			<< '/';
		#endif
	}
	ostr<< 'd' << setw(2) << setfill(_T('0')) << hex << uppercase << m_pInt13->GetActiveDisk() << "_list.txt";

	m_pPartitionListFile.open(ostr.str().c_str(), ios_base::out | ios_base::trunc);
	m_pPartitionListFile.imbue(locale("C"));
	if (m_pPartitionListFile)
	{
		try
		{
			PrintMsg("Backup disk partition and BOOT sector ...\n");
			BackupPrimerPartition(0);
		}
		catch(DWORD e)
		{
			ret = e;
		}
		catch(string & e)
		{
			ret = ERR_ERROR;
			m_pError->AddError(e.c_str());
		}
		m_pPartitionListFile.close();
	}
	else
	{
		ret = ERR_ERROR;
		m_pError->AddError(ERR_FILE_OPEN);
	}
	PrintMsg("Backup disk partition and BOOT sector OK!\n");

 	return (ret == ERR_NO_ERROR ? TRUE : FALSE);
}

void CBackupDiskSector::RestoreAllDisk(void)
{
}

BOOL CBackupDiskSector::RestoreOneDisk(const string & fileName)
{
//	string name = GetFileName(fileName);
	m_sPath = GetFilePath(fileName);
	cout<<"path= "<<m_sPath<<endl;
	if (CheckRestoreFiles(fileName))
	{
		DISK_BACKUP_SECTOR partition;
		PrintMsg("Start restore sector ...\n");
		for (int i=0; i< m_iRestoreFileCount; i++)
		{
			m_pRestoreIFilePointer[i]->read((char*)&partition, sizeof(DISK_BACKUP_SECTOR));
			if (!m_pRestoreIFilePointer[i]->fail())
			{
				if (partition.SectorPosition != m_SectorPosition[i])
				{
					PrintMsg("Sector Position is different with original position\n");
				}
				ostringstream ostr;
				ostr<< "Restore sector " <<hex<<uppercase<<showbase << m_SectorPosition[i]
					<<" "<<endl;
				PrintMsg(ostr.str());
				if (!m_pInt13->WriteSector(m_SectorPosition[i], 1, &partition))
					return FALSE; 
			}
			else
			{
				m_pError->AddError(ERR_FILE_READ);
				return FALSE;
			}
		}
		PrintMsg("Restore disk partition and BOOT sector OK!!!\n");	
		return TRUE;
	}
	else
	{
		m_pError->AddError("Check Restore Files fail");
		return FALSE;
	}
}

void CBackupDiskSector::CloseAllRestoreFile(void)
{
	for (int i=0; i<c_DISK_BACKUP_MAX_PARTITIONS ;i++)
	{
		if (m_pRestoreIFilePointer[i] != NULL)
		{
			m_pRestoreIFilePointer[i]->close();
			delete m_pRestoreIFilePointer[i];
			m_pRestoreIFilePointer[i] = NULL;
		}
	}
}
BOOL CBackupDiskSector::CheckRestoreFiles(const string & sfileName)
{
	PrintMsg("Checking list files ...\n");	
	ifstream ifs;
	string soneFileName;
	string fullName;
	ifs.open(sfileName.c_str());
	ifs.imbue(locale("C"));
	if (ifs)
	{
		CloseAllRestoreFile();
		int i=0;
		do 
		{
			char buf[_MAX_PATH];
			ifs.getline(buf, _MAX_PATH-1);
			istringstream istr(buf);

			istr>> soneFileName;
			if (istr.fail())
			{
					continue;
			}
			if (soneFileName.at(0) == '#')
			{
				PrintMsg(soneFileName);
				PrintMsg("\n");
			}
			else
			{
				istr>> hex >>m_SectorPosition[i];
				if (istr.fail())
				{
					CloseAllRestoreFile();
					return FALSE;
				}
				m_pRestoreIFilePointer[i] = new ifstream;
				fullName = m_sPath + soneFileName ;
				PrintMsg("check file: \"");
				PrintMsg(fullName);
				PrintMsg("\"\n");
				m_pRestoreIFilePointer[i]->open(fullName.c_str(), ios_base::binary);
				m_pRestoreIFilePointer[i]->imbue(locale("C"));
				if (*m_pRestoreIFilePointer[i])
				{
					i++;
				}
				else
				{
					PrintMsg("Can not open file \"");
					PrintMsg(fullName);
					PrintMsg("\"\n");
					CloseAllRestoreFile();
					return FALSE;
				}	
			}
		}while(!ifs.eof() && i < c_DISK_BACKUP_MAX_PARTITIONS);
		if (i >= c_DISK_BACKUP_MAX_PARTITIONS)
		{
			PrintMsg("Too many partitions! Restore some!\n");
		}
		m_iRestoreFileCount = i;
		PrintMsg("Check list files OK!!!\n");	

		return TRUE;
	}
	else
	{
		PrintMsg("Can not open file \"");
		PrintMsg(sfileName);
		PrintMsg("\"\n");
		m_pError->AddError(ERR_FILE_OPEN);
	}
	return FALSE;
}

void CBackupDiskSector::BackupPrimerPartition(UINT64 sectorPosition)
{
	DISK_BACKUP_SECTOR partition;
	if (m_iPartitionCount >= c_DISK_BACKUP_MAX_PARTITIONS)
	{
		PrintMsg("Too many partitions! Backup stop!\n");
		return ;
	}
	if (m_pInt13->ReadSector(sectorPosition, 1, &partition))
	{
		string fileName ;
		string fullFileName;
		GenFileName(fileName, c_DISK_BACKUP_TYPE_PARTITION);
		sprintf(partition.cSectorPositionString, "%08llX", sectorPosition);
		strcpy(partition.cFileName, fileName.c_str());
		partition.SectorPosition = sectorPosition;
		ostringstream ostr;
		ostr<<fileName.c_str() << " " << hex << uppercase << sectorPosition << endl;
		m_pPartitionListFile<< ostr.str();
		PrintMsg("File list ");
		PrintMsg(ostr.str());
		GenFullFileName(fileName, fullFileName);
		WriteFile(fullFileName.c_str(), &partition, sizeof(partition));

		for (int i=0; i<4; i++)
		{
			if (partition.partition.m_Mbr[i].ByPartitionType == 0)
				continue;
			if (IsContainerPartition(partition.partition.m_Mbr[i].ByPartitionType))
			{
				if (m_ExtenedPartitionPositition == 0)
				{
					m_ExtenedPartitionPositition = partition.partition.m_Mbr[i].dwPreservedSector;
					BackupExtendedPartition(0);
				}
				else
				{
					BackupExtendedPartition(partition.partition.m_Mbr[i].dwPreservedSector);
				}
			}
			else
			{
				BackupLogicalDisk(partition.partition.m_Mbr[i].dwPreservedSector+sectorPosition);
			}
		}
	}
	else
	{
		throw string("CBackupDiskSector::BackupPrimerPartition:m_pInt13->ReadSector");
	}
}

void CBackupDiskSector::BackupExtendedPartition(UINT64 sectorPosition)
{	
	BackupPrimerPartition(sectorPosition+m_ExtenedPartitionPositition);
}

BOOL CBackupDiskSector::WriteFile(const char * pfileName, void *buf, int len)
{
	auto_ptr<ofstream> pofs(new tofstream);
	pofs->exceptions(ios_base::badbit|ios_base::failbit);
	pofs->open(pfileName, ios_base::out | ios_base::binary | ios_base::trunc);
	pofs->imbue(locale("C"));
	PrintMsg("Save file ");
	PrintMsg(pfileName);
	PrintMsg("\n");
	//m_pFile->imbue(locale(".936"));		//中文中國,用.數字表示區(qū)域名稱
	pofs->write((char*)buf, len);
	pofs->close();
	return pofs->good();
}

void CBackupDiskSector::GenFullFileName(const string & fileName, string & fullName)
{
	ostringstream ostr;
	ostr.exceptions(ios_base::badbit|ios_base::failbit);
	if (!m_sPath.empty())
	{
		ostr<< m_sPath  
#ifdef WIN32
			<< "\\";
#else
			<< '/';
#endif
	}
	ostr<< fileName;
	fullName = ostr.str();

}
void CBackupDiskSector::GenFileName(string & sfileName, int type)
{
	ostringstream ostr;
	ostr.exceptions(ios_base::badbit|ios_base::failbit);
	ostr<< 'd' << setw(2) << setfill(_T('0')) << hex << uppercase << m_pInt13->GetActiveDisk();
	switch (type)
	{
		case c_DISK_BACKUP_TYPE_PARTITION:
			{
				ostr<< 'p' << m_iPartitionCount++;
				break;
			};
		case c_DISK_BACKUP_TYPE_BOOT:
			{
				ostr<< 'b' << m_iBootCount++;
				break;
			}
		default:
			throw std::invalid_argument("CBackupDiskSector::GenFileName"); 
	}
	ostr << ".dat" ;
	sfileName = ostr.str();
}

void CBackupDiskSector::BackupLogicalDisk(UINT64 startSector)
{
	DISK_BACKUP_SECTOR partition;
	if (m_pInt13->ReadSector(startSector, 1, &partition))
	{
		string fileName ;
		string fullFileName ;
		GenFileName(fileName, c_DISK_BACKUP_TYPE_BOOT);
		sprintf(partition.cSectorPositionString, "%08llX", startSector);
		strcpy(partition.cFileName, fileName.c_str());
		partition.SectorPosition = startSector;
		GenFullFileName(fileName, fullFileName);
		WriteFile(fullFileName.c_str(), &partition, sizeof(partition));
		m_pPartitionListFile<< GetFileName(fileName).c_str() << " " << hex << uppercase << startSector << endl;
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色女孩综合影院| 国产麻豆日韩欧美久久| 欧美色综合影院| 亚洲国产精品欧美一二99| 欧美天堂亚洲电影院在线播放| 一区二区三区免费观看| 欧美视频在线观看一区| 免费成人美女在线观看.| 久久综合色一综合色88| aaa亚洲精品| 亚洲成人手机在线| 精品国产一区二区三区忘忧草 | 日韩欧美综合在线| 国产成人免费9x9x人网站视频| 亚洲视频在线一区观看| 欧美精品日韩精品| 国产东北露脸精品视频| 亚洲乱码日产精品bd| 91精品国产综合久久香蕉麻豆| 国精产品一区一区三区mba桃花| 国产精品水嫩水嫩| 欧美日韩一区二区欧美激情| 久久国产麻豆精品| 亚洲人成在线观看一区二区| 欧美一区午夜精品| 91视频观看视频| 免费观看日韩电影| 中文字幕一区二区视频| 日韩欧美国产一二三区| 91网站最新地址| 久久精品99国产精品日本| 国产精品久久久久国产精品日日| 欧美三级三级三级爽爽爽| 国产成人a级片| 午夜电影网一区| ...中文天堂在线一区| 欧美一区二区播放| 91高清在线观看| 懂色av中文一区二区三区| 五月天欧美精品| 亚洲欧洲制服丝袜| 欧美极品少妇xxxxⅹ高跟鞋| 欧美日韩国产综合一区二区三区| 国产成人丝袜美腿| 日本中文在线一区| 夜色激情一区二区| 亚洲欧美一区二区视频| 精品国产91久久久久久久妲己| 欧美丝袜丝交足nylons| 成人av在线电影| 国产精品 欧美精品| 蜜乳av一区二区| 日韩综合小视频| 亚洲午夜激情av| 亚洲欧美国产77777| 欧美激情综合五月色丁香| 欧美成人官网二区| 日韩三级在线免费观看| 7777精品伊人久久久大香线蕉| 欧美自拍偷拍午夜视频| 一本到一区二区三区| 国产.欧美.日韩| 国产v日产∨综合v精品视频| 美女久久久精品| 老司机精品视频线观看86 | 欧美刺激脚交jootjob| 欧美日韩国产首页| 欧美日韩成人一区二区| 欧美中文字幕一区二区三区 | 欧美自拍偷拍一区| 色一情一伦一子一伦一区| 色综合色综合色综合色综合色综合 | 高清不卡在线观看| 国产在线精品免费| 国产不卡免费视频| 不卡的看片网站| 不卡欧美aaaaa| 一本大道久久a久久精二百| 色综合久久综合| 欧美中文字幕一区二区三区 | 国产不卡一区视频| 丁香天五香天堂综合| 成人爽a毛片一区二区免费| 成人免费观看男女羞羞视频| 成人黄动漫网站免费app| 99re热这里只有精品视频| 91同城在线观看| 欧美色图免费看| 日韩女优视频免费观看| xfplay精品久久| 日本一区二区高清| 亚洲精品一二三四区| 亚洲国产精品久久久久秋霞影院| 视频在线观看国产精品| 精品在线一区二区三区| 成人a级免费电影| 欧美色综合天天久久综合精品| 欧美一区二区三区小说| 久久免费看少妇高潮| 日韩毛片在线免费观看| 婷婷六月综合亚洲| 高清beeg欧美| 欧美在线制服丝袜| 精品国产乱码久久久久久夜甘婷婷| 国产欧美日韩一区二区三区在线观看| 亚洲三级在线播放| 日韩综合小视频| 成人99免费视频| 4438亚洲最大| 国产精品国产自产拍高清av王其| 亚洲无线码一区二区三区| 久久精工是国产品牌吗| 成人av电影免费观看| 欧美一区永久视频免费观看| 中文在线一区二区| 日本欧美在线观看| av在线不卡免费看| 日韩精品专区在线| 国产精品久久久久久久久动漫| 亚洲国产精品一区二区www在线| 国精产品一区一区三区mba视频| 91一区在线观看| 精品久久久久av影院| 亚洲综合在线观看视频| 国产九色精品成人porny| 在线免费观看视频一区| 欧美极品美女视频| 日本一区中文字幕| 在线精品亚洲一区二区不卡| 精品国产凹凸成av人导航| 亚洲高清免费视频| 99久久99久久免费精品蜜臀| 日韩欧美在线一区二区三区| 一级做a爱片久久| 成人免费视频播放| www成人在线观看| 日本中文字幕一区二区有限公司| 91丝袜高跟美女视频| 国产亚洲一区二区三区四区 | 成人晚上爱看视频| 精品国产一区久久| 日韩国产欧美在线视频| 日本乱码高清不卡字幕| 国产精品区一区二区三区| 国产资源在线一区| 欧美mv和日韩mv的网站| 日韩精品久久理论片| 欧美三级电影网| 亚洲妇女屁股眼交7| 欧洲中文字幕精品| 一区二区成人在线视频| 欧美自拍丝袜亚洲| 一区二区三区日韩欧美精品| 92精品国产成人观看免费| 中文无字幕一区二区三区 | 日韩精品影音先锋| 日韩精品一二三区| 欧美浪妇xxxx高跟鞋交| 亚洲地区一二三色| 欧美日韩高清一区| 日韩中文欧美在线| 欧美高清www午色夜在线视频| 亚洲制服丝袜在线| 欧美午夜精品电影| 五月天国产精品| 日韩一级片网址| 韩国三级中文字幕hd久久精品| 欧美成人a在线| 国产乱码一区二区三区| 欧美激情综合五月色丁香小说| 成人激情免费视频| 成人免费在线视频| 色视频欧美一区二区三区| 亚洲一区二三区| 91精品国产91久久综合桃花| 免费欧美在线视频| 国产网站一区二区三区| 成人精品鲁一区一区二区| 中文字幕中文字幕中文字幕亚洲无线 | 成人精品视频一区二区三区尤物| 国产欧美一二三区| 91高清视频在线| 美女脱光内衣内裤视频久久网站| 精品乱人伦一区二区三区| 国产一区 二区| 亚洲欧洲美洲综合色网| 91国产视频在线观看| 免费不卡在线视频| 亚洲国产成人私人影院tom| 色婷婷av一区二区三区gif| 日日骚欧美日韩| 久久蜜桃av一区精品变态类天堂 | 美女视频黄a大片欧美| 久久精品男人天堂av| 一本久久精品一区二区| 日韩成人一区二区| 国产精品毛片大码女人 | 91精选在线观看| 国产盗摄一区二区三区| 亚洲一区二区三区视频在线|