关闭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.
}