NewMenuItem->Xlpstr = NewMenuItem->lpstr.Buffer;
}
NewMenuItem->hbmp = MenuItem->hbmp;
+ Destination->cItems = i + 1;
}
return TRUE;
}
Menu->spwndNotify = NULL;
Menu->cyMenu = 0;
Menu->cxMenu = 0;
- Menu->cItems = Source->cItems;
+ Menu->cItems = 0;
Menu->iTop = 0;
Menu->iMaxTop = 0;
Menu->cxTextAlign = 0;
{
UNICODE_STRING Source;
- Source.Length = Source.MaximumLength = lpmii->cch * sizeof(WCHAR);
+ if (!NT_VERIFY(lpmii->cch <= UNICODE_STRING_MAX_CHARS))
+ {
+ return FALSE;
+ }
+
+ Source.Length = Source.MaximumLength = (USHORT)(lpmii->cch * sizeof(WCHAR));
Source.Buffer = lpmii->dwTypeData;
MenuItem->lpstr.Buffer = DesktopHeapAlloc( MenuObject->head.rpdesk, Source.Length + sizeof(WCHAR));
//TRACE("lprect %p %s\n", lprect, wine_dbgstr_rect( lprect));
lppop->cxMenu = lprect->right - lprect->left;
lppop->cyMenu = 0;
- maxY = lprect->top+1;
+ maxY = lprect->top;
start = 0;
helpPos = ~0U;
lppop->cxTextAlign = 0;
start = i; /* This works! */
}
- lprect->bottom = maxY;
+ lprect->bottom = maxY + 1;
lppop->cyMenu = lprect->bottom - lprect->top;
/* Flush right all items between the MF_RIGHTJUSTIFY and */
if (!hNewMenu)
{
ERR("No Menu!!\n");
- IntReleaseMenuObject(SysMenu);
- UserDestroyMenu(hSysMenu);
+ IntDestroyMenuObject(SysMenu, FALSE);
return NULL;
}
Menu = UserGetMenuObject(hNewMenu);
if (!Menu)
{
- IntReleaseMenuObject(SysMenu);
- UserDestroyMenu(hSysMenu);
+ IntDestroyMenuObject(SysMenu, FALSE);
return NULL;
}
IntMenuItemInfo(Menu, SC_MINIMIZE, FALSE, &ItemInfoSet, TRUE, NULL);
NewMenu = IntCloneMenu(Menu);
+ if (NewMenu == NULL)
+ {
+ IntDestroyMenuObject(Menu, FALSE);
+ IntDestroyMenuObject(SysMenu, FALSE);
+ return NULL;
+ }
IntReleaseMenuObject(NewMenu);
UserSetMenuDefaultItem(NewMenu, SC_CLOSE, FALSE);
else
{
Menu = Window->SystemMenu ? UserGetMenuObject(Window->SystemMenu) : NULL;
- if ((!Window->SystemMenu || Menu->fFlags & MNF_SYSDESKMN) && Window->style & WS_SYSMENU)
+ if ((!Menu || Menu->fFlags & MNF_SYSDESKMN) && Window->style & WS_SYSMENU)
{
Menu = MENU_GetSystemMenu(Window, NULL);
Window->SystemMenu = Menu ? UserHMGetHandle(Menu) : NULL;
}
- Wnd->IDMenu = (UINT) Menu;
+ Wnd->IDMenu = (UINT_PTR) Menu;
if (NULL != NewMenu)
{
NewMenu->hWnd = UserHMGetHandle(Wnd);