On Tue, Jul 23, 2002 at 12:01:25PM -0700, Alexandre Julliard wrote:
Michael Stefaniuc <mstefani(a)redhat.com> writes:
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'
The second is right, we should always pass a real HHOOK. In fact a hook handle is 32 bit even in Win16, so it's never correct to assign it to a HANDLE16; we do this at a few other places too, that should probably be fixed. I've changed DECLARE_OLD_HANDLE(HHOOK) to DECLARE_HANDLE(HOOK) and I'm compiling wine with -DSTRICT and the two above functions were the only ones that did an implicit conversion from a HANDLE16 to a HHOOK. There is only one cast to HHANDLE but that should be ok: return (HHOOK)( handle? MAKELONG( handle, HOOK_MAGIC ) : 0 );
It seems that we don't have an implicit transformation of a HHOOK to a HANDLE16. Most of the internal HOOK_* functions are using HANDLE16's and the few functions that accepts as parameter a HHOOK are checking for the presence of the HOOK_MAGIC and are doing the conversion to a HANDLE16 with LOWORD(hhook). I've also looked over the casts to a HANDLE16 and it seems that no HHOOK is transformed this way. The attached patch fixes the bug and also converts HHOOK to a void* License: LGPL, X11 Changelog: Michael Stefaniuc <mstefani(a)redhat.com> - fix the calls to CallNextHookEx16() - convert HHOOK to a void* bye michael -- Michael Stefaniuc Tel.: +49-711-96437-199 System Administration Fax.: +49-711-96437-111 Red Hat GmbH Email: mstefani(a)redhat.com Hauptstaetterstr. 58 http://www.redhat.de/ D-70178 Stuttgart