mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
DllMain enabled ~90 hooks individually, and every MH_EnableHook freezes all process threads (CreateToolhelp32Snapshot + SuspendThread each) under the Windows loader lock. On machines whose security stack intercepts thread suspension, 90 serialized freezes ran past VanillaFixes' 10-second remote-LoadLibrary deadline, so VF read the still-running injection thread as STILL_ACTIVE (259) and showed its generic "compatible client" error — a false diagnosis of a slow load that blocked launch entirely for affected users. Move the whole install off the loader lock. DllMain now only spawns a worker thread and returns immediately. Hooks install via a latched EnsureInitialized() reached from two triggers: VanillaFixes' `Load` export (called on the game's main thread after injection — VF's sanctioned extension point) or the fallback worker (for any non-VF injector). Whichever arrives first installs; the other observes the cached result. All hooks are queued and activated in a single MH_ApplyQueued, so ~90 thread-freezes collapse to one. - src/DllMain.cpp: minimal DllMain + InstallHooks/EnsureInitialized/Load export - src/Game.cpp: RunHookRegistrations queues instead of enabling - src/ClassicAPI.def + CMake /DEF: export `Load` undecorated - src/Common.h: drop the now-dead HOOK_FUNCTION/UNHOOK_FUNCTION macros
10 lines
427 B
Modula-2
10 lines
427 B
Modula-2
; Exports for ClassicAPI.dll.
|
|
;
|
|
; `Load` is VanillaFixes' post-injection entry point: after the launcher
|
|
; injects each dlls.txt DLL, the VanillaFixes runtime calls the DLL's `Load`
|
|
; export on the game's MAIN thread (GetProcAddress(module, "Load")), outside
|
|
; the loader lock and with no timeout. Listing it here exports it undecorated
|
|
; as "Load" so GetProcAddress finds it regardless of calling convention.
|
|
EXPORTS
|
|
Load
|