Author: jimtabor
Date: Tue Aug 30 19:30:45 2016
New Revision: 72513
URL:
http://svn.reactos.org/svn/reactos?rev=72513&view=rev
Log:
[NtUser]
- Fix crash while using mouse or keyboard for menu selection in UxThmeme.
- Sync/Ports and copy paste error fixes.
Modified:
trunk/reactos/win32ss/user/ntuser/menu.c
Modified: trunk/reactos/win32ss/user/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/menu.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] Tue Aug 30 19:30:45 2016
@@ -2219,7 +2219,7 @@
if (lpitem->fType & MF_SYSMENU)
{
- if ( (Wnd->style & WS_MINIMIZE))
+ if (!(Wnd->style & WS_MINIMIZE))
{
NC_GetInsideRect(Wnd, &rect);
UserDrawSysMenuButton(Wnd, hdc, &rect, lpitem->fState & (MF_HILITE |
MF_MOUSESELECT));
@@ -2720,7 +2720,7 @@
// No menu. Do not reserve any space
return 0;
}
-
+
if (lprect == NULL)
{
return UserGetSystemMetrics(SM_CYMENU);
@@ -2952,11 +2952,15 @@
BOOL sendMenuSelect, PMENU topmenu)
{
HDC hdc;
- PWND pWnd = ValidateHwndNoErr(menu->hWnd);
+ PWND pWnd;
TRACE("M_SI: owner=%p menu=%p index=0x%04x select=0x%04x\n", pwndOwner,
menu, wIndex, sendMenuSelect);
- if (!menu || !menu->cItems || !pWnd) return;
+ if (!menu || !menu->cItems) return;
+
+ pWnd = ValidateHwndNoErr(menu->hWnd);
+
+ if (!pWnd) return;
if (menu->iItem == wIndex) return;
@@ -3126,6 +3130,8 @@
PWND pWnd;
TRACE("owner=%x menu=%p 0x%04x\n", WndOwner, Menu, SelectFirst);
+
+ if (!Menu) return Menu;
if (Menu->iItem == NO_SELECTED_ITEM) return Menu;
@@ -3584,7 +3590,7 @@
{
/* switch to the system menu */
MenuTmp = get_win_sys_menu(hNewWnd);
- hNewMenu = UserHMGetHandle(MenuTmp);
+ if (MenuTmp) hNewMenu = UserHMGetHandle(MenuTmp);
}
else
return FALSE;
@@ -4355,6 +4361,9 @@
{
co_IntSendMessage( UserHMGetHandle(pWnd), WM_INITMENUPOPUP, (WPARAM)
UserHMGetHandle(menu), 0);
}
+
+ if (menu->fFlags & MNF_SYSMENU)
+ MENU_InitSysMenuPopup( menu, pWnd->style, pWnd->pcls->style,
HTSYSMENU);
if (MENU_ShowPopup(pWnd, menu, 0, wFlags, x, y, 0, 0 ))
ret = MENU_TrackMenu( menu, wFlags | TPM_POPUPMENU, 0, 0, pWnd,
@@ -5114,7 +5123,7 @@
ItemInfo.cbSize = sizeof(MENUITEMINFOW);
ItemInfo.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_STATE | MIIM_SUBMENU;
- ItemInfo.fType = 0;
+ ItemInfo.fType = MF_POPUP;
ItemInfo.fState = MFS_ENABLED;
ItemInfo.dwTypeData = NULL;
ItemInfo.cch = 0;
@@ -5183,7 +5192,7 @@
if (OldMenu)
{
OldMenu->fFlags &= ~MNF_SYSMENU;
- IntDestroyMenuObject(OldMenu, TRUE);
+ IntDestroyMenuObject(OldMenu, TRUE);
}
}