mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:42:56 +00:00
[Win32SS] Fix Send and Post Parameters for WM_DEVICECHANGE
For CORE-16492. See CORE-7447.
See 43197e6641
This commit is contained in:
parent
435d2b5652
commit
b9d6c5869d
2 changed files with 32 additions and 16 deletions
|
@ -96,9 +96,10 @@ static const unsigned int message_pointer_flags[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
/* check whether a given message type includes pointers */
|
/* check whether a given message type includes pointers */
|
||||||
static inline int is_pointer_message( UINT message )
|
static inline int is_pointer_message( UINT message, WPARAM wparam )
|
||||||
{
|
{
|
||||||
if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
|
if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
|
||||||
|
if (message == WM_DEVICECHANGE && !(wparam & 0x8000)) return FALSE;
|
||||||
return (message_pointer_flags[message / 32] & SET(message)) != 0;
|
return (message_pointer_flags[message / 32] & SET(message)) != 0;
|
||||||
}
|
}
|
||||||
#undef SET
|
#undef SET
|
||||||
|
@ -139,6 +140,7 @@ static MSGMEMORY g_MsgMemory[] =
|
||||||
{ WM_DRAWITEM, sizeof(DRAWITEMSTRUCT), MMS_FLAG_READWRITE },
|
{ WM_DRAWITEM, sizeof(DRAWITEMSTRUCT), MMS_FLAG_READWRITE },
|
||||||
{ WM_HELP, sizeof(HELPINFO), MMS_FLAG_READWRITE },
|
{ WM_HELP, sizeof(HELPINFO), MMS_FLAG_READWRITE },
|
||||||
{ WM_NEXTMENU, sizeof(MDINEXTMENU), MMS_FLAG_READWRITE },
|
{ WM_NEXTMENU, sizeof(MDINEXTMENU), MMS_FLAG_READWRITE },
|
||||||
|
{ WM_DEVICECHANGE, MMS_SIZE_SPECIAL, MMS_FLAG_READ },
|
||||||
};
|
};
|
||||||
|
|
||||||
static PMSGMEMORY FASTCALL
|
static PMSGMEMORY FASTCALL
|
||||||
|
@ -220,6 +222,16 @@ MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_DEVICECHANGE:
|
||||||
|
{
|
||||||
|
if ( lParam && (wParam & 0x8000) )
|
||||||
|
{
|
||||||
|
DEV_BROADCAST_HDR *header = (DEV_BROADCAST_HDR *)lParam;
|
||||||
|
Size = header->dbch_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
Size = 0;
|
Size = 0;
|
||||||
|
@ -1218,9 +1230,12 @@ co_IntGetPeekMessage( PMSG pMsg,
|
||||||
&ExtraInfo,
|
&ExtraInfo,
|
||||||
bGMSG );
|
bGMSG );
|
||||||
if (Present)
|
if (Present)
|
||||||
|
{
|
||||||
|
if ( pMsg->message != WM_DEVICECHANGE || (pMsg->wParam & 0x8000) )
|
||||||
{
|
{
|
||||||
/* GetMessage or PostMessage must never get messages that contain pointers */
|
/* GetMessage or PostMessage must never get messages that contain pointers */
|
||||||
ASSERT(FindMsgMemory(pMsg->message) == NULL);
|
ASSERT(FindMsgMemory(pMsg->message) == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if ( pMsg->message >= WM_DDE_FIRST && pMsg->message <= WM_DDE_LAST )
|
if ( pMsg->message >= WM_DDE_FIRST && pMsg->message <= WM_DDE_LAST )
|
||||||
{
|
{
|
||||||
|
@ -1298,7 +1313,7 @@ UserPostThreadMessage( PTHREADINFO pti,
|
||||||
{
|
{
|
||||||
MSG Message;
|
MSG Message;
|
||||||
|
|
||||||
if (is_pointer_message(Msg))
|
if (is_pointer_message(Msg, wParam))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1344,7 +1359,7 @@ UserPostMessage( HWND Wnd,
|
||||||
Message.pt = gpsi->ptCursor;
|
Message.pt = gpsi->ptCursor;
|
||||||
Message.time = EngGetTickCount32();
|
Message.time = EngGetTickCount32();
|
||||||
|
|
||||||
if (is_pointer_message(Message.message))
|
if (is_pointer_message(Message.message, Message.wParam))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2026,7 +2041,7 @@ UserSendNotifyMessage( HWND hWnd,
|
||||||
{
|
{
|
||||||
BOOL Ret = TRUE;
|
BOOL Ret = TRUE;
|
||||||
|
|
||||||
if (is_pointer_message(Msg))
|
if (is_pointer_message(Msg, wParam))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2860,7 +2875,7 @@ NtUserMessageCall( HWND hWnd,
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
if (is_pointer_message(Msg))
|
if (is_pointer_message(Msg, wParam))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
EngSetLastError(ERROR_MESSAGE_SYNC_ONLY );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -95,9 +95,10 @@ static const unsigned int message_pointer_flags[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
/* check whether a given message type includes pointers */
|
/* check whether a given message type includes pointers */
|
||||||
static inline int is_pointer_message( UINT message )
|
static inline int is_pointer_message( UINT message, WPARAM wparam )
|
||||||
{
|
{
|
||||||
if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
|
if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
|
||||||
|
if (message == WM_DEVICECHANGE && !(wparam & 0x8000)) return FALSE;
|
||||||
return (message_pointer_flags[message / 32] & SET(message)) != 0;
|
return (message_pointer_flags[message / 32] & SET(message)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1917,7 +1918,7 @@ DispatchMessageA(CONST MSG *lpmsg)
|
||||||
else
|
else
|
||||||
Wnd = NULL;
|
Wnd = NULL;
|
||||||
|
|
||||||
if (is_pointer_message(lpmsg->message))
|
if (is_pointer_message(lpmsg->message, lpmsg->wParam))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2006,7 +2007,7 @@ DispatchMessageW(CONST MSG *lpmsg)
|
||||||
else
|
else
|
||||||
Wnd = NULL;
|
Wnd = NULL;
|
||||||
|
|
||||||
if (is_pointer_message(lpmsg->message))
|
if (is_pointer_message(lpmsg->message, lpmsg->wParam))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2529,7 +2530,7 @@ SendMessageCallbackA(
|
||||||
MSG AnsiMsg, UcMsg;
|
MSG AnsiMsg, UcMsg;
|
||||||
CALL_BACK_INFO CallBackInfo;
|
CALL_BACK_INFO CallBackInfo;
|
||||||
|
|
||||||
if (is_pointer_message(Msg))
|
if (is_pointer_message(Msg, wParam))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2579,7 +2580,7 @@ SendMessageCallbackW(
|
||||||
{
|
{
|
||||||
CALL_BACK_INFO CallBackInfo;
|
CALL_BACK_INFO CallBackInfo;
|
||||||
|
|
||||||
if (is_pointer_message(Msg))
|
if (is_pointer_message(Msg, wParam))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2742,7 +2743,7 @@ SendNotifyMessageA(
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
MSG AnsiMsg, UcMsg;
|
MSG AnsiMsg, UcMsg;
|
||||||
|
|
||||||
if (is_pointer_message(Msg))
|
if (is_pointer_message(Msg, wParam))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2779,7 +2780,7 @@ SendNotifyMessageW(
|
||||||
{
|
{
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
|
|
||||||
if (is_pointer_message(Msg))
|
if (is_pointer_message(Msg, wParam))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue