|
| 1 | +#include <cstdint> |
| 2 | +#include <string.h> |
| 3 | + |
| 4 | +constinit const char *TargetFunctionNames[] = { |
| 5 | + "EOS_Overlay_ApplicationWillShutdown", |
| 6 | + "EOS_Overlay_CloseBrowser", |
| 7 | + "EOS_Overlay_EjectInstance", |
| 8 | + "EOS_Overlay_EvaluateJS", |
| 9 | + "EOS_Overlay_GetDisplaySettings", |
| 10 | + "EOS_Overlay_Initialize", |
| 11 | + "EOS_Overlay_InvokeJavascriptCallback", |
| 12 | + "EOS_Overlay_LoadURL", |
| 13 | + "EOS_Overlay_ObserveBrowserStatus", |
| 14 | + "EOS_Overlay_RegisterGamepadListener", |
| 15 | + "EOS_Overlay_RegisterJSBindings", |
| 16 | + "EOS_Overlay_RegisterKeyListener", |
| 17 | + "EOS_Overlay_SetAnalyticsEventHandler", |
| 18 | + "EOS_Overlay_SetDisplaySettings", |
| 19 | + "EOS_Overlay_SetLogMessageHandler", |
| 20 | + "EOS_Overlay_UnregisterGamepadListener", |
| 21 | + "EOS_Overlay_UnregisterKeyListener", |
| 22 | +}; |
| 23 | + |
| 24 | +uint32_t __fastcall HookedEOS_Overlay_Stub(void *a1, void *a2, void *a3) |
| 25 | +{ |
| 26 | + return 0xFFFFFFFF; |
| 27 | +} |
| 28 | + |
| 29 | +void TryInterceptEOSFunction(void *ModuleHandle, const void *FunctionName, void **FunctionPointer) |
| 30 | +{ |
| 31 | + if (!FunctionName || !*FunctionPointer || reinterpret_cast<uintptr_t>(FunctionName) < 0x10000) |
| 32 | + return; |
| 33 | + |
| 34 | + // Each export from EOSOVH-Win64-Shipping.dll requires interception. They're all guilty of calling the |
| 35 | + // overlay initialization function, which causes other hooks to be removed. |
| 36 | + for (auto name : TargetFunctionNames) |
| 37 | + { |
| 38 | + if (strcmp(static_cast<const char *>(FunctionName), name) != 0) |
| 39 | + continue; |
| 40 | + |
| 41 | + *FunctionPointer = &HookedEOS_Overlay_Stub; |
| 42 | + break; |
| 43 | + } |
| 44 | +} |
0 commit comments