Commit b4abe388 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler Committed by Alexandre Julliard

user32: Fix WM_DEVICECHANGE handling.

WM_DEVICECHANGE's lParam can be either a pointer to a variant of DEV_BROADCAST_HDR or an immediate value (usually 0) depending on the wParam's value. This fixes a crash when broadcasting WM_DEVICECHANGE with wParam = DBT_DEVNODES_CHANGED, lParam = 0. Signed-off-by: 's avatarArkadiusz Hiler <ahiler@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 44e2a14a
......@@ -1023,7 +1023,7 @@ static size_t pack_message( HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
case WM_DEVICECHANGE:
{
DEV_BROADCAST_HDR *header = (DEV_BROADCAST_HDR *)lparam;
push_data( data, header, header->dbch_size );
if ((wparam & 0x8000) && header) push_data( data, header, header->dbch_size );
return 0;
}
case WM_WINE_KEYBOARD_LL_HOOK:
......@@ -1426,6 +1426,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa
if (!get_buffer_space( buffer, sizeof(BOOL) )) return FALSE;
break;
case WM_DEVICECHANGE:
if (!(*wparam & 0x8000)) return TRUE;
minsize = sizeof(DEV_BROADCAST_HDR);
break;
case WM_WINE_KEYBOARD_LL_HOOK:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment