Jacek Caban : win32u: Use NtUserMessageCall for NtUserSpyGetMsgName.
Alexandre Julliard
julliard at winehq.org
Tue Aug 9 15:19:54 CDT 2022
Module: wine
Branch: master
Commit: 2c75490c3e6cb8611197fa64c1470a318edb80f0
URL: https://gitlab.winehq.org/wine/wine/-/commit/2c75490c3e6cb8611197fa64c1470a318edb80f0
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sat Jul 30 19:03:04 2022 +0200
win32u: Use NtUserMessageCall for NtUserSpyGetMsgName.
Instead of leaking a kernel pointer.
---
dlls/user32/user_main.c | 4 +++-
dlls/win32u/message.c | 6 +++++-
dlls/win32u/window.c | 3 ---
include/ntuser.h | 6 +++---
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index df3e6b27b81..bc817089e46 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -352,7 +352,9 @@ BOOL WINAPI ShutdownBlockReasonDestroy(HWND hwnd)
const char *SPY_GetMsgName( UINT msg, HWND hwnd )
{
- return (const char *)NtUserCallHwndParam( hwnd, msg, NtUserSpyGetMsgName );
+ char buf[128];
+ NtUserMessageCall( hwnd, msg, ARRAYSIZE(buf), 0, buf, NtUserSpyGetMsgName, FALSE );
+ return wine_dbg_sprintf( "%s", buf );
}
void SPY_EnterMessage( INT flag, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index 5fb065e1208..33170147aa9 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -2960,7 +2960,7 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
return send_notify_message( hwnd, msg, wparam, lparam, ansi );
case NtUserSendMessageCallback:
- return send_message_callback( hwnd, msg, wparam, lparam, (void *)result_info, ansi );
+ return send_message_callback( hwnd, msg, wparam, lparam, result_info, ansi );
case NtUserClipboardWindowProc:
return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam );
@@ -2978,6 +2978,10 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
spy_enter_message( ansi, hwnd, msg, wparam, lparam );
return 0;
+ case NtUserSpyGetMsgName:
+ lstrcpynA( result_info, debugstr_msg_name( msg, hwnd ), wparam );
+ return 0;
+
case NtUserSpyExit:
spy_exit_message( ansi, hwnd, msg, (LPARAM)result_info, wparam, lparam );
return 0;
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index c4e14381cf5..2a4edeee656 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -5578,9 +5578,6 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
return set_window_style( hwnd, style->styleNew, style->styleOld );
}
- case NtUserSpyGetMsgName:
- return (UINT_PTR)debugstr_msg_name( param, hwnd );
-
default:
FIXME( "invalid code %u\n", code );
return 0;
diff --git a/include/ntuser.h b/include/ntuser.h
index f15ba1f135e..5b7d66a2a4e 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -297,8 +297,9 @@ enum
/* Wine-specific exports */
NtUserClipboardWindowProc = 0x0300,
NtUserGetDispatchParams = 0x3001,
- NtUserSpyEnter = 0x0302,
- NtUserSpyExit = 0x0303,
+ NtUserSpyGetMsgName = 0x3002,
+ NtUserSpyEnter = 0x0303,
+ NtUserSpyExit = 0x0304,
};
/* NtUserThunkedMenuItemInfo codes */
@@ -1261,7 +1262,6 @@ enum
NtUserCallHwndParam_ShowOwnedPopups,
/* temporary exports */
NtUserSetWindowStyle,
- NtUserSpyGetMsgName,
};
static inline BOOL NtUserClientToScreen( HWND hwnd, POINT *pt )
More information about the wine-cvs
mailing list