hook/process.c: Fix 64-bit startup hijack

Start address goes in RCX in 64-bit mode, EAX in 32-bit mode.
This commit is contained in:
Decaf Code
2018-11-13 20:06:40 -05:00
parent 3df87b35e3
commit a956987fe0
+3 -3
View File
@@ -16,7 +16,7 @@ static bool thread_match_startup(
{
#ifdef __amd64
return ctx->Rip == (DWORD64) ntstart &&
ctx->Rax == (DWORD64) exe_entry;
ctx->Rcx == (DWORD64) exe_entry;
#else
return ctx->Eip == (DWORD) ntstart &&
ctx->Eax == (DWORD) exe_entry;
@@ -29,8 +29,8 @@ static void thread_patch_startup(
CONTEXT *ctx)
{
#ifdef __amd64
*orig_entry = (void *) ctx->Rax;
ctx->Rax = (DWORD64) new_entry;
*orig_entry = (void *) ctx->Rcx;
ctx->Rcx = (DWORD64) new_entry;
#else
*orig_entry = (void *) ctx->Eax;
ctx->Eax = (DWORD) new_entry;