Created
May 28, 2023 13:39
-
-
Save puppis42/eedb32b5b56048ba6e9b5de241267786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include "aclapi.h" | |
#include <chrono> | |
#include <thread> | |
DWORD ProtectProcess(void) | |
{ | |
HANDLE hProcess = GetCurrentProcess(); | |
PACL pEmptyDacl; | |
DWORD dwErr; | |
pEmptyDacl = (PACL)malloc(sizeof(ACL)); | |
if (!InitializeAcl(pEmptyDacl, sizeof(ACL), ACL_REVISION)) | |
{ | |
dwErr = GetLastError(); | |
} | |
else | |
{ | |
dwErr = SetSecurityInfo(hProcess, SE_KERNEL_OBJECT, | |
DACL_SECURITY_INFORMATION, NULL, NULL, pEmptyDacl, NULL); | |
} | |
free(pEmptyDacl); | |
return dwErr; | |
} | |
int main() | |
{ | |
ShowWindow(GetConsoleWindow(), SW_HIDE); | |
ProtectProcess(); | |
while (true) { | |
std::this_thread::sleep_for(std::chrono::milliseconds(500)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment