-
-
[转帖]R3隐藏硬盘分区
-
发表于:
2008-8-11 23:36
8012
-
#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());
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课