-
-
[转帖]R3隐藏硬盘分区
-
发表于:
2008-8-11 23:36
8042
-
#include <windows.h>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
struct SaveContext
{
string strNtPath;
string strDosDevice;
};
typedef vector<SaveContext> svrVector;
void RestoreDevice(SaveContext &Context);
int main(void)
{
DWORD dwDisks=GetLogicalDrives()&0xfffffffb;
svrVector NtDevices;
TCHAR chDosDevice[8]={0};
*(WORD*)chDosDevice=':A';
TCHAR chNtPath[MAX_PATH]={0};
for(int Mask=1;Mask;Mask<<=1,chDosDevice[0]++)
{
if(dwDisks&Mask)
{
QueryDosDevice(chDosDevice,chNtPath,MAX_PATH);
SaveContext Context;
Context.strDosDevice=chDosDevice;
Context.strNtPath=chNtPath;
NtDevices.push_back(Context);
cout<<Context.strDosDevice<<"<--->"<<Context.strNtPath<<endl;
DefineDosDevice(DDD_REMOVE_DEFINITION,Context.strDosDevice.c_str(),NULL);
}
}
return 0;
}
void RestoreDevice(SaveContext &Context)
{
DefineDosDevice(DDD_RAW_TARGET_PATH,Context.strDosDevice.c_str(),Context.strNtPath.c_str());
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!