From 6ed40bb2afdc08bd43078291eca0b8daa3c3fdfd Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 24 Dec 2002 01:18:21 +0000 Subject: [PATCH] Pass the correct instance when installing the mouse hook (spotted by Lionel Ulmer). --- dlls/dinput/dinput_main.c | 3 +++ dlls/dinput/dinput_private.h | 2 ++ dlls/dinput/mouse/main.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index a0ec24ee4f5..93ffb046643 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -50,11 +50,14 @@ static ICOM_VTABLE(IDirectInput8A) ddi8avt; static dinput_device * dinput_devices[MAX_WINE_DINPUT_DEVICES]; static int nrof_dinput_devices = 0; +HINSTANCE DINPUT_instance = NULL; + BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserv) { switch(reason) { case DLL_PROCESS_ATTACH: + DINPUT_instance = inst; keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, inst, 0 ); break; case DLL_PROCESS_DETACH: diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 77f1eaf3146..f739dc76fb0 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -46,4 +46,6 @@ HHOOK keyboard_hook; LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam ); +extern HINSTANCE DINPUT_instance; + #endif /* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */ diff --git a/dlls/dinput/mouse/main.c b/dlls/dinput/mouse/main.c index 22a1dffaf1a..f8b91ba158d 100644 --- a/dlls/dinput/mouse/main.c +++ b/dlls/dinput/mouse/main.c @@ -527,7 +527,7 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) /* Install our mouse hook */ if (This->dwCoopLevel & DISCL_EXCLUSIVE) ShowCursor(FALSE); /* hide cursor */ - This->hook = SetWindowsHookExW( WH_MOUSE_LL, dinput_mouse_hook, 0, 0 ); + This->hook = SetWindowsHookExA( WH_MOUSE_LL, dinput_mouse_hook, DINPUT_instance, 0 ); /* Get the window dimension and find the center */ GetWindowRect(This->win, &rect); -- 2.11.4.GIT