#include "anti_suspend.h"

#include "kill_process.h"
#include "../webhook/webhook.h"


#include <Windows.h>
#include <thread>

class c_globals {
public:
    HANDLE hThread;
    int count = 128; 

}; static c_globals* globals = new c_globals();

void AntiSuspend() {

    globals->hThread = CreateThread(NULL, 0, 0, NULL, 0, NULL);

    DebugActiveProcessStop(GetCurrentProcessId());

    for (size_t i = 0; i < globals->count; ++i) {
        SuspendThread(globals->hThread);
    }

    while (globals->hThread != reinterpret_cast<HANDLE>((DWORD)-1))
    {
        if (SuspendThread(globals->hThread) != (DWORD)-1) {
            //webhook::sendLog(skCrypt("Anti-Suspend").decrypt());
            blue_screen();
            exit(0);
        }
    }

    CloseHandle(globals->hThread);
}