CallNextHookEx16 strageness

Michael Stefaniuc mstefani at redhat.com
Mon Jul 22 17:30:49 CDT 2002


Hello,

while trying to convert HHOOK to a void* i found this strangeness:
CallNextHookEx16 expects its first parameter to be a real HHOOK, that
means it checks the HIWORD of the HHOOK to see it it contains 'HK'
if (HIWORD(hhook) != HOOK_MAGIC) return 0;  /* Not a new format hook */

In wine there are only 2 functions that call CallNextHookEx16, one is
DefHookProc16, the other is ShellHookProc16. The first one calls
CallNextHookEx16 with first parameter queue->hCurHook (an HANDLE16), the
second one with WH_SHELL (the number 10). This parameters gets
implicitly transformed to a HHOOK and will have their HIWORD set to 0,
thus CallNextHookEx16 will always fail and return 0.

I don't know what the right fix would be, I'm seeing two possibilities:
- remove in CallNextHookEx16 the check
	if (HIWORD(hhook) != HOOK_MAGIC) return 0; 
- or transform in DefHookProc16 and ShellHookProc16 the first parameter
  passed to CallNextHookEx16 to a real HHOOK with the HIWORD set to 'HC'


Comments?
bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20020723/ee3c2d8a/attachment.pgp


More information about the wine-devel mailing list