我試圖保護的過程在C++中的窗戶, 代碼:如何保護進程不被殺害?
#include <iostream>
#include <Aclapi.h>
#include <iostream>
#include <windows.h>
#include <sddl.h>
#include <stdio.h>
using namespace std;
BOOL DenyAccess()
{
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = FALSE;
SetKernelObjectSecurity(hProcess, DACL_SECURITY_INFORMATION, sa.lpSecurityDescriptor);
return TRUE;
}
int main()
{
while(DenyAccess());
return 0;
}
但我可以從任務管理器殺進程!怎麼了 ?
http://www.tutorialspoint.com/cplusplus/cpp_signal_handling.htm –
@Holonout我不明白,這個URL是關於信號,它是什麼連接到這個?你能解釋更多嗎? – user3671325
對不起用戶,錯誤的鏈接。這將更好地適合您的要求:http://security.stackexchange.com/questions/30985/create-a-unterminable-process-in-windows –