hooklib/dll.c: Ensure LoadLibraryExW is always available

This commit is contained in:
Felix Anderson 2021-08-13 08:24:36 +00:00
parent 96782ba672
commit 67c3865b9d

View File

@ -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 */