-
-
[转帖]R3隐藏硬盘分区
-
发表于:
2008-8-11 23:36
8009
-
#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());
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)