Author: janderwald
Date: Thu May 8 02:46:46 2008
New Revision: 33361
URL:
http://svn.reactos.org/svn/reactos?rev=33361&view=rev
Log:
- check if the requested MenuItem object was really found
- makes user32_winetest not crash reactos
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/menu.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] Thu May 8 02:46:46
2008
@@ -930,7 +930,7 @@
{
int pos = (int)uItem;
PMENU_ITEM MenuItem;
- PMENU_OBJECT SubMenu;
+ PMENU_OBJECT SubMenu = NULL;
if (MAX_MENU_ITEMS <= MenuObject->MenuInfo.MenuItemCount)
{
@@ -951,6 +951,13 @@
{
pos = IntGetMenuItemByFlag(MenuObject, uItem, MF_BYCOMMAND, &SubMenu, NULL,
NULL);
}
+ if (SubMenu == NULL)
+ {
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+
if (pos < -1)
{
pos = -1;