Author: akhaldi Date: Thu Nov 6 13:04:41 2014 New Revision: 65285
URL: http://svn.reactos.org/svn/reactos?rev=65285&view=rev Log: [SHELL32] * Another partial sync of shlmenu.c with Wine 1.7.27. CORE-8540
Modified: branches/shell-experiments/dll/win32/shell32/wine/shlmenu.c
Modified: branches/shell-experiments/dll/win32/shell32/wine/shlmenu.c URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shel... ============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/shlmenu.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/shlmenu.c [iso-8859-1] Thu Nov 6 13:04:41 2014 @@ -33,8 +33,6 @@ #include "pidl.h" #include "shell32_main.h"
-WINE_DEFAULT_DEBUG_CHANNEL(shellmenu); - #ifdef FM_SEPARATOR #undef FM_SEPARATOR #endif @@ -71,6 +69,8 @@
#define CCH_MAXITEMTEXT 256
+WINE_DEFAULT_DEBUG_CHANNEL(shell); + static LPFMINFO FM_GetMenuInfo(HMENU hmenu) { MENUINFO MenuInfo; @@ -127,9 +127,7 @@ * */ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl) -{ - IShellFolder *lpsf; - IShellFolder *lpsf2; +{ IShellFolder *lpsf, *lpsf2; ULONG ulItemAttr = SFGAO_FOLDER; UINT uID, uEnumFlags; LPFNFMCALLBACK lpfnCallback; @@ -173,7 +171,7 @@ { if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,&IID_IShellFolder,(LPVOID *)&lpsf2))) { - IEnumIDList *lpe; + IEnumIDList *lpe = NULL;
if (SUCCEEDED (IShellFolder_EnumObjects(lpsf2, 0, uEnumFlags, &lpe ))) { @@ -194,7 +192,7 @@ MENUINFO MenuInfo; HMENU hMenuPopup = CreatePopupMenu();
- lpFmMi = (LPFMINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); + lpFmMi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
lpFmMi->pidl = ILCombine(pidl, pidlTemp); lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS; @@ -224,8 +222,11 @@
NumberOfItems++; } + IEnumIDList_Release (lpe); } + IShellFolder_Release(lpsf2); } + IShellFolder_Release(lpsf); }
if ( GetMenuItemCount (hmenu) == 0 ) @@ -262,7 +263,7 @@ TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x hMenu=%p\n", crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);
- menudata = (LPFMINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); + menudata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); menudata->crBorderColor = crBorderColor; menudata->nBorderWidth = nBorderWidth; menudata->hBorderBmp = hBorderBmp; @@ -326,8 +327,8 @@ if (lpText != FM_SEPARATOR) { int len = strlenW (lpText); - myItem = (LPFMITEM)SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR)); - wcscpy (myItem->szItemText, lpText); + myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR)); + strcpyW (myItem->szItemText, lpText); myItem->cchItemText = len; myItem->iIconIndex = icon; myItem->hMenu = hMenu; @@ -378,7 +379,7 @@
/**********************************************************************/
-EXTERN_C BOOL WINAPI FileMenu_AppendItemAW( +BOOL WINAPI FileMenu_AppendItemAW( HMENU hMenu, LPCVOID lpText, UINT uID, @@ -391,13 +392,13 @@ if (!lpText) return FALSE;
if (SHELL_OsIsUnicode() || lpText == FM_SEPARATOR) - ret = FileMenu_AppendItemW(hMenu, (LPWSTR)lpText, uID, icon, hMenuPopup, nItemHeight); + ret = FileMenu_AppendItemW(hMenu, lpText, uID, icon, hMenuPopup, nItemHeight); else { - DWORD len = MultiByteToWideChar( CP_ACP, 0, (LPSTR)lpText, -1, NULL, 0 ); - LPWSTR lpszText = (LPWSTR)HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + 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, (LPSTR)lpText, -1, lpszText, len ); + MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len ); ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight); HeapFree( GetProcessHeap(), 0, lpszText ); } @@ -747,7 +748,7 @@ /************************************************************************* * FileMenu_DeleteItemByFirstID [SHELL32.141] */ -EXTERN_C BOOL WINAPI FileMenu_DeleteItemByFirstID( +BOOL WINAPI FileMenu_DeleteItemByFirstID( HMENU hMenu, UINT uID) { @@ -854,8 +855,7 @@ * Shell_MergeMenus [SHELL32.67] */ UINT 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;