[USER] 'Fix' SetWindowsHookEx

Shachar Shemesh wine-devel at shemesh.biz
Sat Jun 12 10:46:19 CDT 2004


Lionel Ulmer wrote:

>I have no idea if it's correct
>though (as I do not know if what GetModuleHandle returns is really the same
>thing as what SetWindowsHookEx expects as an HINSTANCE input).
>  
>
Yes, it is. It's just used to grab the procedure address to call when 
the hook is activated.

>Index: dlls/user/hook.c
>===================================================================
>RCS file: /home/wine/wine/dlls/user/hook.c,v
>retrieving revision 1.12
>diff -u -r1.12 hook.c
>--- dlls/user/hook.c	19 May 2004 03:22:55 -0000	1.12
>+++ dlls/user/hook.c	12 Jun 2004 15:27:01 -0000
>@@ -141,11 +141,15 @@
>     else  /* system-global hook */
>     {
>         if (id == WH_KEYBOARD_LL || id == WH_MOUSE_LL) inst = 0;
>-        else if (!inst || !(len = GetModuleFileNameW( inst, module, MAX_PATH )) || len >= MAX_PATH)
>-        {
>-            SetLastError( ERROR_INVALID_PARAMETER );
>-            return 0;
>-        }
>  
>
If you just remove the "!inst" test, does the game work? I think that 
would be simpler.

          Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
http://www.lingnu.com/




More information about the wine-devel mailing list