Skip to content

Commit b07e61e

Browse files
committed
[User32]
- Patch by Victor Martinez Calvo : Fix Invalid parameter handling in GetMenuInfo and SetLastError. Modified handle validation by me. See CORE-8064. - Moved code and added a non-client create function ID. svn path=/trunk/; revision=62746
1 parent 142c547 commit b07e61e

File tree

1 file changed

+15
-5
lines changed
  • reactos/win32ss/user/user32/windows

1 file changed

+15
-5
lines changed

reactos/win32ss/user/user32/windows/menu.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,9 +1147,8 @@ static void FASTCALL MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND Wnd
11471147
if ( (Wnd->style & WS_MINIMIZE))
11481148
{
11491149
UserGetInsideRectNC(Wnd, &rect);
1150-
UserDrawSysMenuButton(hWnd, hdc, &rect,
1151-
lpitem->fState & (MF_HILITE | MF_MOUSESELECT));
1152-
}
1150+
UserDrawSysMenuButton(hWnd, hdc, &rect, lpitem->fState & (MF_HILITE | MF_MOUSESELECT));
1151+
}
11531152
return;
11541153
}
11551154

@@ -1816,6 +1815,10 @@ LRESULT WINAPI PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM l
18161815
{
18171816
if (!pWnd->fnid)
18181817
{
1818+
if (Message != WM_NCCREATE)
1819+
{
1820+
return DefWindowProcA(Wnd, Message, wParam, lParam);
1821+
}
18191822
NtUserSetWindowFNID(Wnd, FNID_MENU);
18201823
}
18211824
else
@@ -4264,9 +4267,16 @@ GetMenuInfo(HMENU hmenu,
42644267
{
42654268
ROSMENUINFO mi;
42664269
BOOL res = FALSE;
4270+
PVOID pMenu;
42674271

4268-
if(!lpcmi || (lpcmi->cbSize != sizeof(MENUINFO)))
4269-
return FALSE;
4272+
if (!(pMenu = ValidateHandle(hmenu, TYPE_MENU)))
4273+
return FALSE;
4274+
4275+
if (!lpcmi || (lpcmi->cbSize != sizeof(MENUINFO)))
4276+
{
4277+
SetLastError(ERROR_INVALID_PARAMETER);
4278+
return FALSE;
4279+
}
42704280

42714281
RtlZeroMemory(&mi, sizeof(MENUINFO));
42724282
mi.cbSize = sizeof(MENUINFO);

0 commit comments

Comments
 (0)