(C++) CsrGetProcessID by External

Created the Wednesday 22 June 2022. Updated 3 months, 2 weeks ago.

Code

            #include <stdio.h>
#include <windows.h>
typedef HANDLE (*_CsrGetProcessId)();

int main(void)
{
    HMODULE nt=GetModuleHandle("ntdll.dll");
    _CsrGetProcessId CsrGetProcessId=(_CsrGetProcessId)GetProcAddress(nt,"CsrGetProcessId");
    HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS,FALSE,CsrGetProcessId());

    if(!proc)
    {
        printf("debugger is present!");
    }
}