From 0f2b1cdc2eb2a08d2ec26592e506526eb8ae0c0e Mon Sep 17 00:00:00 2001 From: cursey Date: Fri, 22 Dec 2023 14:36:25 -0800 Subject: [PATCH] MidHook: Fix 32-bit ESP correction --- src/mid_hook.cpp | 2 +- src/mid_hook.x86.asm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mid_hook.cpp b/src/mid_hook.cpp index 7b5ce73..b84fcc8 100644 --- a/src/mid_hook.cpp +++ b/src/mid_hook.cpp @@ -36,7 +36,7 @@ constexpr std::array asm_data = {0xFF, 0x35, 0xA7, 0x00, 0x00, 0x0 0x52, 0x56, 0x57, 0x9C, 0x81, 0xEC, 0x80, 0x00, 0x00, 0x00, 0xF3, 0x0F, 0x7F, 0x7C, 0x24, 0x90, 0xF3, 0x0F, 0x7F, 0x74, 0x24, 0xA0, 0xF3, 0x0F, 0x7F, 0x6C, 0x24, 0xB0, 0xF3, 0x0F, 0x7F, 0x64, 0x24, 0xC0, 0xF3, 0x0F, 0x7F, 0x5C, 0x24, 0xD0, 0xF3, 0x0F, 0x7F, 0x54, 0x24, 0xE0, 0xF3, 0x0F, 0x7F, 0x4C, 0x24, 0xF0, 0xF3, 0x0F, 0x7F, 0x04, 0x24, - 0x8B, 0x8C, 0x24, 0xC0, 0x00, 0x00, 0x00, 0x83, 0xC1, 0x08, 0x89, 0x8C, 0x24, 0xC0, 0x00, 0x00, 0x00, 0x54, 0xFF, + 0x8B, 0x8C, 0x24, 0xA0, 0x00, 0x00, 0x00, 0x83, 0xC1, 0x08, 0x89, 0x8C, 0x24, 0xA0, 0x00, 0x00, 0x00, 0x54, 0xFF, 0x15, 0xA3, 0x00, 0x00, 0x00, 0x83, 0xC4, 0x04, 0xF3, 0x0F, 0x6F, 0x04, 0x24, 0xF3, 0x0F, 0x6F, 0x4C, 0x24, 0x10, 0xF3, 0x0F, 0x6F, 0x54, 0x24, 0x20, 0xF3, 0x0F, 0x6F, 0x5C, 0x24, 0x30, 0xF3, 0x0F, 0x6F, 0x64, 0x24, 0x40, 0xF3, 0x0F, 0x6F, 0x6C, 0x24, 0x50, 0xF3, 0x0F, 0x6F, 0x74, 0x24, 0x60, 0xF3, 0x0F, 0x6F, 0x7C, 0x24, 0x70, 0x81, 0xC4, diff --git a/src/mid_hook.x86.asm b/src/mid_hook.x86.asm index b6ef67c..4ece7f2 100644 --- a/src/mid_hook.x86.asm +++ b/src/mid_hook.x86.asm @@ -23,9 +23,9 @@ movdqu [esp-16], xmm1 movdqu [esp], xmm0 ; fix stored esp. -mov ecx, [esp+192] +mov ecx, [esp+160] add ecx, 8 -mov [esp+192], ecx +mov [esp+160], ecx ; call destination push esp