Author: fireball
Date: Fri Feb 26 19:58:21 2010
New Revision: 45687
URL:
http://svn.reactos.org/svn/reactos?rev=45687&view=rev
Log:
- Merge Wine-1.1.39 changes to shlmenu.c.
Modified:
trunk/reactos/dll/win32/shell32/shlmenu.c
Modified: trunk/reactos/dll/win32/shell32/shlmenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlmenu.…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shlmenu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlmenu.c [iso-8859-1] Fri Feb 26 19:58:21 2010
@@ -116,7 +116,7 @@
static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
{ IShellFolder *lpsf, *lpsf2;
ULONG ulItemAttr = SFGAO_FOLDER;
- UINT uID, uFlags, uEnumFlags;
+ UINT uID, uEnumFlags;
LPFNFMCALLBACK lpfnCallback;
LPCITEMIDLIST pidl;
WCHAR sTemp[MAX_PATH];
@@ -148,7 +148,6 @@
return 0;
uID = menudata->uID;
- uFlags = menudata->uFlags;
uEnumFlags = menudata->uEnumFlags;
lpfnCallback = menudata->lpfnCallback;
menudata->bInitialized = FALSE;
@@ -157,7 +156,7 @@
if (SUCCEEDED (SHGetDesktopFolder(&lpsf)))
{
- if (SUCCEEDED(IShellFolder_BindToObject(lpsf,
pidl,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2)))
+ if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,&IID_IShellFolder,(LPVOID
*)&lpsf2)))
{
IEnumIDList *lpe = NULL;
@@ -314,9 +313,9 @@
if (lpText != FM_SEPARATOR)
{
- int len = wcslen (lpText);
- myItem = (LPFMITEM) SHAlloc( sizeof(FMITEM) + len*sizeof(WCHAR));
- wcscpy (myItem->szItemText, lpText);
+ int len = strlenW (lpText);
+ myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR));
+ strcpyW (myItem->szItemText, lpText);
myItem->cchItemText = len;
myItem->iIconIndex = icon;
myItem->hMenu = hMenu;
@@ -377,12 +376,15 @@
{
BOOL ret;
- if ((SHELL_OsIsUnicode() && (lpText!=FM_SEPARATOR)) || (lpText == NULL))
+ if (!lpText) return FALSE;
+
+ if (SHELL_OsIsUnicode() || lpText == FM_SEPARATOR)
ret = FileMenu_AppendItemW(hMenu, lpText, uID, icon, hMenuPopup, nItemHeight);
else
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 );
LPWSTR lpszText = HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) );
+ if (!lpszText) return FALSE;
MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len );
ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight);
HeapFree( GetProcessHeap(), 0, lpszText );
@@ -577,7 +579,7 @@
COLORREF clrPrevText, clrPrevBkgnd;
int xi,yi,xt,yt;
HIMAGELIST hImageList;
- RECT TextRect, BorderRect;
+ RECT TextRect;
LPFMINFO menuinfo;
TRACE("%p %p %s\n", hWnd, lpdis, debugstr_w(pMyItem->szItemText));
@@ -600,9 +602,6 @@
if (menuinfo->nBorderWidth)
TextRect.left += menuinfo->nBorderWidth;
- BorderRect.right = menuinfo->nBorderWidth;
-/* FillRect(lpdis->hDC, &BorderRect, CreateSolidBrush(
menuinfo->crBorderColor));
-*/
TextRect.left += FM_LEFTBORDER;
xi = TextRect.left + FM_SPACE1;
yi = TextRect.top + FM_Y_SPACE/2;
@@ -843,8 +842,7 @@
* Shell_MergeMenus [SHELL32.67]
*/
HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust,
UINT uIDAdjustMax, ULONG uFlags)
-{
- INT nItem;
+{ int nItem;
HMENU hmSubMenu;
BOOL bAlreadySeparated;
MENUITEMINFOW miiSrc;
@@ -855,10 +853,11 @@
hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
if (!hmDst || !hmSrc)
- { return uIDMax;
- }
+ return uIDMax;
nItem = GetMenuItemCount(hmDst);
+ if (nItem == -1)
+ return uIDMax;
if (uInsert >= (UINT)nItem) /* insert position inside menu? */
{
@@ -892,7 +891,6 @@
if (!GetMenuItemInfoW(hmSrc, nItem, TRUE, &miiSrc))
{
-MessageBoxW(NULL, L"GetMenuItemInfoW failed", NULL, MB_OK);
continue;
}
@@ -902,10 +900,8 @@
{
/* This is a separator; don't put two of them in a row */
if (bAlreadySeparated)
- {
-MessageBoxW(NULL, L"bAlreadySeparated failed", NULL, MB_OK);
continue;
- }
+
bAlreadySeparated = TRUE;
}
else if (miiSrc.hSubMenu)
@@ -914,10 +910,9 @@
{
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
- if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
- {MessageBoxW(NULL, L"uIDAdjustMax 111 failed", NULL, MB_OK);
+ if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
continue;
- }
+
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
uIDMax = miiSrc.wID + 1;
}
@@ -942,10 +937,9 @@
{
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
- if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */{
-MessageBoxW(NULL, L"uIDAdjustMax max 222 failed", NULL, MB_OK);
+ if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
continue;
- }
+
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
uIDMax = miiSrc.wID + 1;
@@ -956,7 +950,6 @@
*/
if (!InsertMenuItemW(hmDst, uInsert, TRUE, &miiSrc))
{
-MessageBoxW(NULL, L"InsertMenuItemW failed", NULL, MB_OK);
return(uIDMax);
}
}