[patch 1/3] user32: put some repeated code for checking and extending of a MENUITEMINFO structure in a separate function.
Alexandre Julliard
julliard at winehq.org
Thu Jul 23 04:46:20 CDT 2009
Rein Klazes <wijn at online.nl> writes:
> - if( lpmii->cbSize != sizeof( mii) &&
> - lpmii->cbSize != sizeof( mii) - sizeof ( mii.hbmpItem)) {
> - SetLastError( ERROR_INVALID_PARAMETER);
> - return FALSE;
> - }
> - memcpy( &mii, lpmii, lpmii->cbSize);
> - if( lpmii->cbSize != sizeof( mii)) {
> - mii.cbSize = sizeof( mii);
> - mii.hbmpItem = NULL;
> - }
> -
> item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 );
> - return SetMenuItemInfo_common(item, (const MENUITEMINFOW *)&mii, FALSE);
> + if( MENU_NormalizeMenuItemInfoStruct( (MENUITEMINFOW *)lpmii, &mii))
> + return SetMenuItemInfo_common(item, &mii, FALSE);
> + return FALSE;
You should do the check before the item insertion, like the existing
code does.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list