> >This patch fixes Bug 14784. > >As requested by Dmitry Timoshkov, I have created a standalone test case >for DLL injection via SetWindowHookEx. It has been attached in Bug 14784 >with MSVC source code and compiled exe and dll. > >With LoadLibraryExW(module, NULL, LOAD_WITH_ALTERED_SEARCH_PATH), the >Wine will search any imported DLL first in the same directory as module, >then in the standard search path. > >LoadLibraryW(module) searches imported DLL(s) in the directory of current >process, which may not be the same process where the module is first >loaded. That is why that LoadLibraryW(module) fails to hook to another >process if the DLL containing the hook_proc links to another DLL(s) in >the same directory. > >--- > 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; > } >-- Is there any problems with this patch?
Hongbo Ni <[EMAIL PROTECTED]> +----------------------------------------------------------------+ * NJStar Software Corp., P.O. Box 40, Epping NSW 2121, Australia. * Tel: +61-2-9869-1088 WebSite: http://www.njstar.com * Fax: +61-2-9869-1099 Email: http://njstar.com/contact/ * eFax: +1-253-595-4788 +----------------------------------------------------------------+