首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

关闭windows文件保护有关问题

2012-04-01 
关闭windows文件保护问题//AdjustPrivileges()HINSTANCE hmodLoadLibrary(sfc_os.dll)CPP SetSfcFile

关闭windows文件保护问题
//AdjustPrivileges(); 
HINSTANCE hmod=LoadLibrary("sfc_os.dll");
CPP SetSfcFileException;
SetSfcFileException= (CPP)GetProcAddress(hmod,(LPCSTR)5);
SetSfcFileException(0,L"c:/windows/system32/write.exe", -1);

CopyFile("c:/windows/system32/write.exe", "c:/write.exe", FALSE);
Test ("C:/write.exe");
Sleep(1000);
CopyFile("C:/write.exe", "c:/windows/system32/write.exe", FALSE);

return 0;

这句没问题
CopyFile("c:/windows/system32/write.exe", "c:/write.exe", FALSE); 
写入数据也没问题
Test ("C:/write.exe");
就这句有问题,cpoy到c:/windows/system32/write.exe 没替换掉。c:/windows/system32/write.exewrite.exe 还是原来的,
c:/write.exe是替换的。
CopyFile("C:/write.exe", "c:/windows/system32/write.exe", FALSE);

关闭文件保护的代码第一次成功了,替换掉了,第二次就不管用了,以后也不行了。机器也重启过了
帮帮忙、。

[解决办法]
找来一个例子,会计你的文件路径错误
void Disable_WFP() {
hmod=LoadLibrary("sfc_os.dll");
CPP SetSfcFileException;
// the function is stored at the fifth ordinal in sfc_os.dll
SetSfcFileException=(CPP)GetProcAddress(hmod,(LPCSTR)5);
SetSfcFileException(0, L"c:\\windows\\system32\\calc.exe",-1);
// Now we can modify the system file in a complete stealth.
}

热点排行