From 67c3865b9d0d7f2f467e9e08f4b137b3dcb6065c Mon Sep 17 00:00:00 2001 From: Felix Date: Fri, 13 Aug 2021 08:24:36 +0000 Subject: [PATCH] hooklib/dll.c: Ensure LoadLibraryExW is always available --- hooklib/dll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hooklib/dll.c b/hooklib/dll.c index 5987c1d..9400bb9 100644 --- a/hooklib/dll.c +++ b/hooklib/dll.c @@ -131,7 +131,8 @@ static void dll_hook_init(void) InitializeCriticalSection(&dll_hook_lock); /* Protect against the (probably impossible) scenario where nothing in the - process imports LoadLibraryW but something imports LoadLibraryA. + process imports LoadLibraryW but something imports LoadLibraryA. Also + do the same with LoadLibraryExW. We know something imports GetModuleHandleW because we do, right here. @@ -140,6 +141,7 @@ static void dll_hook_init(void) kernel32 = GetModuleHandleW(L"kernel32.dll"); next_LoadLibraryW = (void *) GetProcAddress(kernel32, "LoadLibraryW"); + next_LoadLibraryExW = (void *) GetProcAddress(kernel32, "LoadLibraryExW"); /* Now we can apply the hook table */