user32: load dll of hook proc using LoadLibraryExW-LOAD_WITH_ALTERED_SEARCH_PATH

Hongbo Ni hongbo at njstar.com
Sun Aug 3 03:40:23 CDT 2008


original LoadLibraryW(module) will fail if
1. module is not in current dir or on PATH, and
2. module is linked to another DLL which is in the same dir as module, and
3. module is not in same dir as current app, ie hook is from another proc.

LOAD_WITH_ALTERED_SEARCH_PATH will search the dir of module first, so be
able to load linked DLLs.

---
 dlls/user32/hook.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c
index 4354e05..638a302 100644
--- a/dlls/user32/hook.c
+++ b/dlls/user32/hook.c
@@ -322,7 +322,7 @@ void *get_hook_proc( void *proc, const WCHAR *module )
     {
         TRACE( "loading %s\n", debugstr_w(module) );
         /* FIXME: the library will never be freed */
-        if (!(mod = LoadLibraryW(module))) return NULL;
+        if (!(mod = LoadLibraryExW(module, NULL, LOAD_WITH_ALTERED_SEARCH_PATH))) return NULL;
     }
     return (char *)mod + (ULONG_PTR)proc;
 }
--  




More information about the wine-patches mailing list