https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e3610035ce4a2581689fe…
commit e3610035ce4a2581689fe7752f435b5c58f9de26
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sat Feb 24 20:26:24 2018 +0200
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Mon Feb 26 16:51:59 2018 +0200
[USER32] Small fixes for messages carrying pointers
SendNotifyMessageW: It doesn't support messages with pointers so there is no need
to call MsgiUMToKMMessage
SendMessageTimeoutW, SendMessageTimeoutA: These two do support marshaling pointers so
they need to use MsgiUMToKMMessage.
This is actually a bug that happens only in the rare case where we send a WM_COPYDATA
with a timeout.
---
win32ss/user/user32/windows/message.c | 56 ++++++++++++++++++++---------------
1 file changed, 32 insertions(+), 24 deletions(-)
diff --git a/win32ss/user/user32/windows/message.c
b/win32ss/user/user32/windows/message.c
index d9b32d2626..57f15d85b3 100644
--- a/win32ss/user/user32/windows/message.c
+++ b/win32ss/user/user32/windows/message.c
@@ -2587,7 +2587,7 @@ SendMessageTimeoutA(
UINT uTimeout,
PDWORD_PTR lpdwResult)
{
- MSG AnsiMsg, UcMsg;
+ MSG AnsiMsg, UcMsg, KMMsg;
LRESULT Result;
DOSENDMESSAGE dsm;
@@ -2618,14 +2618,21 @@ SendMessageTimeoutA(
return FALSE;
}
+ if (!MsgiUMToKMMessage(&UcMsg, &KMMsg, FALSE))
+ {
+ MsgiAnsiToUnicodeCleanup(&UcMsg, &AnsiMsg);
+ return FALSE;
+ }
+
Result = NtUserMessageCall( hWnd,
- UcMsg.message,
- UcMsg.wParam,
- UcMsg.lParam,
+ KMMsg.message,
+ KMMsg.wParam,
+ KMMsg.lParam,
(ULONG_PTR)&dsm,
FNID_SENDMESSAGEWTOOPTION,
TRUE);
+ MsgiUMToKMCleanup(&UcMsg, &KMMsg);
MsgiAnsiToUnicodeReply(&UcMsg, &AnsiMsg, &Result);
if (lpdwResult) *lpdwResult = dsm.Result;
@@ -2652,6 +2659,7 @@ SendMessageTimeoutW(
{
LRESULT Result;
DOSENDMESSAGE dsm;
+ MSG UMMsg, KMMsg;
if ( Msg & ~WM_MAXIMUM || fuFlags &
~(SMTO_NOTIMEOUTIFNOTHUNG|SMTO_ABORTIFHUNG|SMTO_BLOCK))
{
@@ -2667,14 +2675,28 @@ SendMessageTimeoutW(
dsm.uTimeout = uTimeout;
dsm.Result = 0;
+ UMMsg.hwnd = hWnd;
+ UMMsg.message = Msg;
+ UMMsg.wParam = wParam;
+ UMMsg.lParam = lParam;
+ UMMsg.time = 0;
+ UMMsg.pt.x = 0;
+ UMMsg.pt.y = 0;
+ if (! MsgiUMToKMMessage(&UMMsg, &KMMsg, TRUE))
+ {
+ return FALSE;
+ }
+
Result = NtUserMessageCall( hWnd,
- Msg,
- wParam,
- lParam,
+ KMMsg.message,
+ KMMsg.wParam,
+ KMMsg.lParam,
(ULONG_PTR)&dsm,
FNID_SENDMESSAGEWTOOPTION,
FALSE);
+ MsgiUMToKMCleanup(&UMMsg, &KMMsg);
+
if (lpdwResult) *lpdwResult = dsm.Result;
SPY_ExitMessage(SPY_RESULT_OK, hWnd, Msg, Result, wParam, lParam);
@@ -2731,7 +2753,6 @@ SendNotifyMessageW(
WPARAM wParam,
LPARAM lParam)
{
- MSG UMMsg, KMMsg;
LRESULT Result;
if (is_pointer_message(Msg))
@@ -2740,27 +2761,14 @@ SendNotifyMessageW(
return FALSE;
}
- UMMsg.hwnd = hWnd;
- UMMsg.message = Msg;
- UMMsg.wParam = wParam;
- UMMsg.lParam = lParam;
- UMMsg.time = 0;
- UMMsg.pt.x = 0;
- UMMsg.pt.y = 0;
- if (! MsgiUMToKMMessage(&UMMsg, &KMMsg, TRUE))
- {
- return FALSE;
- }
Result = NtUserMessageCall( hWnd,
- KMMsg.message,
- KMMsg.wParam,
- KMMsg.lParam,
+ Msg,
+ wParam,
+ lParam,
0,
FNID_SENDNOTIFYMESSAGE,
FALSE);
- MsgiUMToKMCleanup(&UMMsg, &KMMsg);
-
return Result;
}