Handle MENUITEMINFOW compiled with _WIN32_WINNT < 0x0500 (MENUITEMINFOW

misses the HBITMAP hbmpItem at the end in that case).

svn path=/trunk/; revision=9287
This commit is contained in:
Gé van Geldorp 2004-05-02 21:41:18 +00:00
parent 01e86752a1
commit 8220b586b4

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: menu.c,v 1.52 2004/03/25 12:32:13 gvg Exp $ /* $Id: menu.c,v 1.53 2004/05/02 21:41:18 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1750,8 +1750,11 @@ NtUserMenuItemInfo(
SetLastNtError(Status); SetLastNtError(Status);
return FALSE; return FALSE;
} }
if(sizeof(MENUITEMINFOW) != Size && sizeof(ROSMENUITEMINFO) != Size) if (sizeof(MENUITEMINFOW) != Size
&& sizeof(MENUITEMINFOW) - sizeof(HBITMAP) != Size
&& sizeof(ROSMENUITEMINFO) != Size)
{ {
IntReleaseMenuObject(MenuObject);
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
@ -1762,6 +1765,15 @@ NtUserMenuItemInfo(
SetLastNtError(Status); SetLastNtError(Status);
return FALSE; return FALSE;
} }
/* If this is a pre-0x0500 _WIN32_WINNT MENUITEMINFOW, you can't
set/get hbmpItem */
if (sizeof(MENUITEMINFOW) - sizeof(HBITMAP) == Size
&& 0 != (ItemInfo.fMask & MIIM_BITMAP))
{
IntReleaseMenuObject(MenuObject);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (IntGetMenuItemByFlag(MenuObject, Item, if (IntGetMenuItemByFlag(MenuObject, Item,
(ByPosition ? MF_BYPOSITION : MF_BYCOMMAND), (ByPosition ? MF_BYPOSITION : MF_BYCOMMAND),