[TRY2]user32: load hook DLL using LoadLibraryExW with altered search path

Hongbo Ni hongbo at njstar.com
Wed Aug 6 02:45:53 CDT 2008


As requested by Dmitry Timoshkov, I have created a standalone test case for
DLL injection via SetWindowHookEx. Here is the zip file containing source 
and exe/dll. http://www.njstar.com/zipfile/hooktest.zip

How to Test:
1. start window/wine's Notepad.exe from GUI or command line
2. run BIN\HookTest.exe, a GUI is shown.
3. goto menu Test - '1. Inject DLLA.dll into Notepad' 

For more details, please see README.txt in the zip file.

---
 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