Skip to content

Commit

Permalink
Attempt to fix invalid CALL at 0x6865F0
Browse files Browse the repository at this point in the history
  • Loading branch information
x0reaxeax committed Jan 23, 2025
1 parent 3ae7857 commit 763fba7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions MWCrashFix/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,39 @@ VOID PatchRefs(VOID) {
&dwOldProtect
);
}

// Patch 0x6865F0 offending call
BYTE abPatch[3] = {
0x33, 0xc0, // xor eax,eax
0x40 // inc eax
};
DWORD dwOldProtect;
if (!VirtualProtect(
(LPVOID) 0x006865F0,
3,
PAGE_EXECUTE_READWRITE,
&dwOldProtect
)) {
MessageBoxA(NULL, "VirtualProtect failed", "Error", MB_ICONERROR);
return;
}

memcpy((LPVOID) 0x006865F0, abPatch, 3);

VirtualProtect(
(LPVOID) 0x006865F0,
3,
dwOldProtect,
&dwOldProtect
);

if (EXIT_SUCCESS != memcmp(
abPatch,
(LPVOID) 0x006865F0,
3
)) {
MessageBoxA(NULL, "Patch failed for offending call 0x006865F0", "Error", MB_ICONERROR);
}
}

BOOL WINAPI DllMain(
Expand Down

0 comments on commit 763fba7

Please sign in to comment.