typedef HANDLE(WINAPI
*
EndCreateThread)(LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD);
EndCreateThread Original_EndCreateThread
=
nullptr;
HANDLE WINAPI NewCreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes,SIZE_T dwStackSize,LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter,DWORD dwCreationFlags,LPDWORD lpThreadId)
{
return
Original_EndCreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId);
}
void HOOK_CreateThread()
{
MessageBoxA(NULL,
"HOOK.. "
, "", MB_OK);
DWORD CreateThreadAddr
=
(DWORD)CreateThread;
Original_EndCreateThread
=
(EndCreateThread)(CreateThreadAddr
+
5
);
VirtualProtect((LPVOID)CreateThreadAddr,
5
, PAGE_EXECUTE_READWRITE, &oldPro1);
*
reinterpret_cast<byte
*
>(CreateThreadAddr)
=
0xE9
;
*
reinterpret_cast<DWORD
*
>(CreateThreadAddr
+
1
)
=
(DWORD)&NewCreateThread
-
(CreateThreadAddr
+
5
);
VirtualProtect((LPVOID)CreateThreadAddr,
5
, oldPro1, &oldPro1);
}