From: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/dinput/dinput_main.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 2b7528a20ea..1334bf28431 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -282,9 +282,9 @@ static void input_thread_update_device_list( struct input_thread_state *state ) static DWORD WINAPI dinput_thread_proc( void *params ) { - HANDLE finished_event, start_event = params; struct input_thread_state state = {0}; struct dinput_device *device; + HANDLE start_event = params; DWORD ret; MSG msg; @@ -320,22 +320,13 @@ static DWORD WINAPI dinput_thread_proc( void *params ) continue; } - finished_event = (HANDLE)msg.lParam; - TRACE( "Processing hook change notification wparam %#Ix, lparam %#Ix.\n", msg.wParam, msg.lParam ); - if (!msg.wParam) - { - if (state.keyboard_ll_hook) UnhookWindowsHookEx( state.keyboard_ll_hook ); - if (state.mouse_ll_hook) UnhookWindowsHookEx( state.mouse_ll_hook ); - state.keyboard_ll_hook = state.mouse_ll_hook = NULL; - goto done; - } + if (!msg.wParam) goto done; while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] ); input_thread_update_device_list( &state ); - - SetEvent(finished_event); + SetEvent( (HANDLE)msg.lParam ); } } @@ -343,6 +334,8 @@ static DWORD WINAPI dinput_thread_proc( void *params ) done: while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] ); + if (state.keyboard_ll_hook) UnhookWindowsHookEx( state.keyboard_ll_hook ); + if (state.mouse_ll_hook) UnhookWindowsHookEx( state.mouse_ll_hook ); DestroyWindow( di_em_win ); di_em_win = NULL; return 0; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2047