Author: jimtabor
Date: Sat Sep 2 04:08:22 2017
New Revision: 75734
URL:
http://svn.reactos.org/svn/reactos?rev=75734&view=rev
Log:
[NtUser]
- Fix a potential crash in test_menu_locked_by_window.
Modified:
trunk/reactos/win32ss/user/ntuser/nonclient.c
Modified: trunk/reactos/win32ss/user/ntuser/nonclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/noncli…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] Sat Sep 2 04:08:22 2017
@@ -940,10 +940,13 @@
/* Draw menu bar */
if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be
pWnd->spmenu
{
- PMENU menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)); // FIXME!
- TempRect = CurrentRect;
- TempRect.bottom = TempRect.top + menu->cyMenu; // Should be
pWnd->spmenu->cyMenu;
- CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
+ PMENU menu;
+ if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use
pWnd->spmenu,
+ {
+ TempRect = CurrentRect;
+ TempRect.bottom = TempRect.top + menu->cyMenu; // Should be
pWnd->spmenu->cyMenu;
+ CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
+ }
}
if (ExStyle & WS_EX_CLIENTEDGE)
@@ -1111,10 +1114,14 @@
{
if (!(Flags & DC_NOSENDMSG))
{
- PMENU menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)); // FIXME!
- TempRect = CurrentRect;
- TempRect.bottom = TempRect.top + menu->cyMenu; // Should be
pWnd->spmenu->cyMenu;
- CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
+ PMENU menu;
+ // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
+ if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME!
Use pWnd->spmenu,
+ {
+ TempRect = CurrentRect;
+ TempRect.bottom = TempRect.top + menu->cyMenu; // Should be
pWnd->spmenu->cyMenu;
+ CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
+ }
}
}