refactor(native): batch MinHook enable calls and log status codes

Switch ws2_32 and LocalMP hook installers to MH_QueueEnableHook with two MH_ApplyQueued passes (mandatory network hooks first, then all LocalMP modules), reducing DllMain thread-freeze cycles from 26 to 2. Roll back partial module hooks on error and log MH_StatusToString diagnostics to wto_ws.log.

Checked: native/wto-net/build.ps1 compiles cleanly with zero warnings in project sources, and PE inspection confirms WS2_32/KERNEL32 imports and 49 exports. In-game verification pending.
This commit is contained in:
N0VAN0M4LY committed 2026-12-02 07:24:27 +08:00
1 parent 90bd5a315d
commit 96077153c6
11 files changed
+120 -105

No files matched your search

+5 -7
View File
@@ -100,11 +100,9 @@ static void __fastcall hook_set_controlled_unit(uint8_t *mp, uint32_t eid)
int install_local_mp_support_hooks(void)
{
uint8_t *p_set = g_lmp.set_controlled_unit;
if (MH_CreateHook(p_set, (void *)&hook_set_controlled_unit, (void **)&orig_set_controlled_unit) != MH_OK ||
MH_EnableHook(p_set) != MH_OK) {
log_line("local_mp: failed to install the support unit hook");
return 0;
}
return 1;
const LocalMpHookSpec hooks[] = {
{ "set_controlled_unit", g_lmp.set_controlled_unit, (void *)&hook_set_controlled_unit, (void **)&orig_set_controlled_unit },
};
return local_mp_queue_hooks("local_mp_support", hooks, sizeof(hooks) / sizeof(hooks[0]));
}