From baf100c59dee0b5b1fdb90e64b442defe64c8052 Mon Sep 17 00:00:00 2001 From: Artem Golubikhin Date: Sun, 6 Feb 2022 05:11:03 -0800 Subject: [PATCH] Fixed crashes on the latest ReHLDS (#4) Fixes #1 by updating the memory pattern for `gMsgBuffer` and `gMsgType` variables. --- Main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Main.cpp b/Main.cpp index e3a7d70..480c80f 100644 --- a/Main.cpp +++ b/Main.cpp @@ -355,7 +355,7 @@ void Init() { } if (isReHLDS) { - uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83 ?? 3A"); + uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83"); g_msgBuffer = decltype(g_msgBuffer)(*(uintptr_t *)(addr + 2) - offsetof(remove_pointer_t, flags)); g_msgType = *(int **)(addr + 15); } else { @@ -381,7 +381,7 @@ void Init() { if (g_msgBuffer != nullptr) { g_msgType = (decltype(g_msgType))dlsym(handle, "gMsgType"); } else { - uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83 ?? 3A"); + uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83"); g_msgBuffer = decltype(g_msgBuffer)(*(uintptr_t *)(addr + 2) - offsetof(remove_pointer_t, flags)); g_msgType = *(int **)(addr + 15); } @@ -1050,4 +1050,4 @@ void PF_MessageEnd_I() { memcpy((void*)g_engfuncs.pfnMessageEnd, g_patchedBytes, 5); mprotect((void*)(addr/PAGESIZE*PAGESIZE), 5 + addr%PAGESIZE, PROT_EXEC | PROT_READ); #endif -} \ No newline at end of file +}