shell32: Return the IEnumIDList object on its creation.

This commit is contained in:
Michael Stefaniuc 2011-10-10 01:02:48 +02:00 committed by Alexandre Julliard
parent 27b284d4c9
commit bd407b700e
8 changed files with 52 additions and 43 deletions

View File

@ -445,16 +445,18 @@ static HRESULT WINAPI ISF_ControlPanel_fnEnumObjects(IShellFolder2 *iface, HWND
DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
{
ICPanelImpl *This = impl_from_IShellFolder2(iface);
IEnumIDListImpl *list;
TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
*ppEnumIDList = IEnumIDList_Constructor();
if (*ppEnumIDList)
CreateCPanelEnumList(*ppEnumIDList, dwFlags);
if (!(list = IEnumIDList_Constructor()))
return E_OUTOFMEMORY;
*ppEnumIDList = &list->IEnumIDList_iface;
CreateCPanelEnumList(*ppEnumIDList, dwFlags);
TRACE("--(%p)->(new ID List: %p)\n", This, *ppEnumIDList);
return(*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
return S_OK;
}
/**************************************************************************

View File

@ -36,22 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
struct enumlist
{
struct enumlist *pNext;
LPITEMIDLIST pidl;
};
typedef struct
{
IEnumIDList IEnumIDList_iface;
LONG ref;
struct enumlist *mpFirst;
struct enumlist *mpLast;
struct enumlist *mpCurrent;
} IEnumIDListImpl;
/**************************************************************************
* AddToEnumList()
*/
@ -340,7 +324,7 @@ static const IEnumIDListVtbl eidlvt =
IEnumIDList_fnClone,
};
IEnumIDList *IEnumIDList_Constructor(void)
IEnumIDListImpl *IEnumIDList_Constructor(void)
{
IEnumIDListImpl *lpeidl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lpeidl));
@ -349,10 +333,8 @@ IEnumIDList *IEnumIDList_Constructor(void)
lpeidl->ref = 1;
lpeidl->IEnumIDList_iface.lpVtbl = &eidlvt;
}
else
return NULL;
TRACE("-- (%p)->()\n",lpeidl);
return &lpeidl->IEnumIDList_iface;
return lpeidl;
}

View File

@ -408,7 +408,7 @@ static HRESULT WINAPI RecycleBin_ParseDisplayName(IShellFolder2 *This, HWND hwnd
static HRESULT WINAPI RecycleBin_EnumObjects(IShellFolder2 *iface, HWND hwnd, SHCONTF grfFlags, IEnumIDList **ppenumIDList)
{
RecycleBin *This = impl_from_IShellFolder2(iface);
IEnumIDList *list;
IEnumIDListImpl *list;
LPITEMIDLIST *pidls;
HRESULT ret = E_OUTOFMEMORY;
int pidls_count;
@ -426,16 +426,16 @@ static HRESULT WINAPI RecycleBin_EnumObjects(IShellFolder2 *iface, HWND hwnd, SH
if (FAILED(ret = TRASH_EnumItems(&pidls, &pidls_count)))
goto failed;
for (i=0; i<pidls_count; i++)
if (!AddToEnumList(list, pidls[i]))
if (!AddToEnumList(&list->IEnumIDList_iface, pidls[i]))
goto failed;
}
*ppenumIDList = list;
*ppenumIDList = &list->IEnumIDList_iface;
return S_OK;
failed:
if (list)
IEnumIDList_Release(list);
IEnumIDList_Release(&list->IEnumIDList_iface);
for (; i<pidls_count; i++)
ILFree(pidls[i]);
SHFree(pidls);

View File

@ -205,8 +205,24 @@ HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN;
BOOL SHELL_IsShortcut(LPCITEMIDLIST) DECLSPEC_HIDDEN;
/* IEnumIDList stuff */
struct enumlist
{
struct enumlist *pNext;
LPITEMIDLIST pidl;
};
typedef struct
{
IEnumIDList IEnumIDList_iface;
LONG ref;
struct enumlist *mpFirst;
struct enumlist *mpLast;
struct enumlist *mpCurrent;
} IEnumIDListImpl;
/* Creates an IEnumIDList; add LPITEMIDLISTs to it with AddToEnumList. */
LPENUMIDLIST IEnumIDList_Constructor(void) DECLSPEC_HIDDEN;
IEnumIDListImpl *IEnumIDList_Constructor(void) DECLSPEC_HIDDEN;
BOOL AddToEnumList(IEnumIDList *list, LPITEMIDLIST pidl) DECLSPEC_HIDDEN;
/* Enumerates the folders and/or files (depending on dwFlags) in lpszPath and

View File

@ -345,17 +345,19 @@ static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
{
IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IEnumIDListImpl *list;
TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n",
This, hwndOwner, dwFlags, ppEnumIDList);
*ppEnumIDList = IEnumIDList_Constructor();
if (*ppEnumIDList)
CreateDesktopEnumList(*ppEnumIDList, dwFlags);
if (!(list = IEnumIDList_Constructor()))
return E_OUTOFMEMORY;
*ppEnumIDList = &list->IEnumIDList_iface;
CreateDesktopEnumList(*ppEnumIDList, dwFlags);
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
return S_OK;
}
/**************************************************************************

View File

@ -448,17 +448,19 @@ IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner,
DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
{
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
IEnumIDListImpl *list;
TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This, hwndOwner,
dwFlags, ppEnumIDList);
*ppEnumIDList = IEnumIDList_Constructor();
if (*ppEnumIDList)
CreateFolderEnumList(*ppEnumIDList, This->sPathTarget, dwFlags);
if (!(list = IEnumIDList_Constructor()))
return E_OUTOFMEMORY;
*ppEnumIDList = &list->IEnumIDList_iface;
CreateFolderEnumList(*ppEnumIDList, This->sPathTarget, dwFlags);
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
return S_OK;
}
/**************************************************************************

View File

@ -355,17 +355,19 @@ static HRESULT WINAPI ISF_MyComputer_fnEnumObjects (IShellFolder2 *iface,
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
{
IMyComputerFolderImpl *This = impl_from_IShellFolder2(iface);
IEnumIDListImpl *list;
TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This,
hwndOwner, dwFlags, ppEnumIDList);
*ppEnumIDList = IEnumIDList_Constructor();
if (*ppEnumIDList)
CreateMyCompEnumList(*ppEnumIDList, dwFlags);
if (!(list = IEnumIDList_Constructor()))
return E_OUTOFMEMORY;
*ppEnumIDList = &list->IEnumIDList_iface;
CreateMyCompEnumList(*ppEnumIDList, dwFlags);
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
return S_OK;
}
/**************************************************************************

View File

@ -244,15 +244,18 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnEnumObjects (IShellFolder2 * iface,
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
{
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
IEnumIDListImpl *list;
TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This,
hwndOwner, dwFlags, ppEnumIDList);
*ppEnumIDList = IEnumIDList_Constructor();
if (!(list = IEnumIDList_Constructor()))
return E_OUTOFMEMORY;
*ppEnumIDList = &list->IEnumIDList_iface;
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
return S_OK;
}
/**************************************************************************