Skip to content

Commit

Permalink
Fix fatal error "CEngine not found" on engine with buildnum 4554.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Apr 2, 2024
1 parent 7253669 commit d739859
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Plugins/ThreadGuard/privatehook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ void Engine_InstallHook(HMODULE hModule, BlobHandle_t hBlobModule)
char pattern[] = "\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A";
*(DWORD*)(pattern + 1) = (DWORD)Sys_InitArgv_String;
auto Sys_InitArgv_PushString = (PUCHAR)Search_Pattern(pattern);
if (!Sys_InitArgv_PushString)
{
//Build 4554
/*
.text:01DC57DE 68 84 C6 E8 01 push offset aSysInitargvOri ; "Sys_InitArgv( OrigCmd )"
.text:01DC57E3 83 E1 03 and ecx, 3
.text:01DC57E6 F3 A4 rep movsb
*/
char pattern2[] = "\x68\x2A\x2A\x2A\x2A";
*(DWORD*)(pattern2 + 1) = (DWORD)Sys_InitArgv_String;
Sys_InitArgv_PushString = (PUCHAR)Search_Pattern(pattern2);
}
if (Sys_InitArgv_PushString)
{
g_pMetaHookAPI->DisasmRanges(Sys_InitArgv_PushString, 0x50, [](void* inst, PUCHAR address, size_t instLen, int instCount, int depth, PVOID context)
Expand Down

0 comments on commit d739859

Please sign in to comment.