From 3ae0ccdccb6566ba49ccc803dab7733ce574f820 Mon Sep 17 00:00:00 2001 From: Egor Ananyin Date: Sun, 13 Aug 2023 10:45:30 +0300 Subject: [PATCH] [NTUSER] Set correct lParam for WM_(UN)INITMENUPOPUP (#5573) This is needed to allow apps to detect whether the opened menu is a system menu or a user menu. CORE-19061 --- win32ss/user/ntuser/menu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c index ebade16f1b7..869b9bb4cc4 100644 --- a/win32ss/user/ntuser/menu.c +++ b/win32ss/user/ntuser/menu.c @@ -58,7 +58,7 @@ BOOL fInEndMenu = FALSE; #define MII_STATE_MASK (MFS_GRAYED|MFS_CHECKED|MFS_HILITE|MFS_DEFAULT) #define IS_SYSTEM_MENU(MenuInfo) \ - (!((MenuInfo)->fFlags & MNF_POPUP) && ((MenuInfo)->fFlags & MNF_SYSMENU)) + (!!((MenuInfo)->fFlags & MNF_SYSMENU)) #define IS_MAGIC_BITMAP(id) ((id) && ((INT_PTR)(id) < 12) && ((INT_PTR)(id) >= -1)) #define IS_STRING_ITEM(flags) (MF_STRING == MENU_ITEM_TYPE(flags)) @@ -3292,7 +3292,7 @@ static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu, if (!(wFlags & TPM_NONOTIFY)) { co_IntSendMessage( UserHMGetHandle(pWndOwner), WM_UNINITMENUPOPUP, (WPARAM)UserHMGetHandle(Item->spSubMenu), - MAKELPARAM(0, IS_SYSTEM_MENU(Item->spSubMenu)) ); + MAKELPARAM(0, IS_SYSTEM_MENU(Item->spSubMenu) ? MF_SYSMENU : 0)); } //// // Call WM_UNINITMENUPOPUP FIRST before destroy!! @@ -4362,7 +4362,7 @@ static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y, if (!(wFlags & TPM_NONOTIFY)) { co_IntSendMessage( UserHMGetHandle(mt.OwnerWnd), WM_UNINITMENUPOPUP, (WPARAM)UserHMGetHandle(mt.TopMenu), - MAKELPARAM(0, IS_SYSTEM_MENU(mt.TopMenu)) ); + MAKELPARAM(0, IS_SYSTEM_MENU(mt.TopMenu) ? MF_SYSMENU : 0)); } } MENU_SelectItem( mt.OwnerWnd, mt.TopMenu, NO_SELECTED_ITEM, FALSE, 0 ); @@ -4585,7 +4585,7 @@ BOOL WINAPI IntTrackPopupMenuEx( PMENU menu, UINT wFlags, int x, int y, /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */ if (!(wFlags & TPM_NONOTIFY)) { - co_IntSendMessage( UserHMGetHandle(pWnd), WM_INITMENUPOPUP, (WPARAM) UserHMGetHandle(menu), 0); + co_IntSendMessage( UserHMGetHandle(pWnd), WM_INITMENUPOPUP, (WPARAM) UserHMGetHandle(menu), MAKELPARAM(0, IS_SYSTEM_MENU(menu))); } if (menu->fFlags & MNF_SYSMENU) @@ -4615,7 +4615,7 @@ BOOL WINAPI IntTrackPopupMenuEx( PMENU menu, UINT wFlags, int x, int y, if (!(wFlags & TPM_NONOTIFY)) { co_IntSendMessage( UserHMGetHandle(pWnd), WM_UNINITMENUPOPUP, (WPARAM)UserHMGetHandle(menu), - MAKELPARAM(0, IS_SYSTEM_MENU(menu)) ); + MAKELPARAM(0, IS_SYSTEM_MENU(menu) ? MF_SYSMENU : 0)); } } }