On 22.07.2016 6:51, Alex Henrie wrote:
> Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
> ---
> dlls/shell32/shelldispatch.c | 83 +++++++++++++++++++++++++++++++++++---
> dlls/shell32/tests/shelldispatch.c | 17 +++++---
> 2 files changed, 89 insertions(+), 11 deletions(-)
>
> diff --git a/dlls/shell32/shelldispatch.c b/dlls/shell32/shelldispatch.c
> index ac79302..4b4c822 100644
> --- a/dlls/shell32/shelldispatch.c
> +++ b/dlls/shell32/shelldispatch.c
> @@ -68,6 +68,8 @@ typedef struct {
> typedef struct {
> FolderItems3 FolderItems3_iface;
> LONG ref;
> + BSTR *item_paths;
> + LONG item_count;
> } FolderItemsImpl;
>
Is it possible we'll need special folder indices here as well? I didn't
check thoroughly.
> static HRESULT WINAPI FolderItemsImpl_Item(FolderItems3 *iface, VARIANT index, FolderItem **ppid)
> {
> - FIXME("(%p,%s,%p)\n", iface, debugstr_variant(&index), ppid);
> + FolderItemsImpl *This = impl_from_FolderItems(iface);
> + VARIANT path;
> +
> + TRACE("(%p,%s,%p)\n", iface, debugstr_variant(&index), ppid);
>
> *ppid = NULL;
> - return E_NOTIMPL;
> +
> + if (V_I4(&index) >= This->item_count)
> + return S_FALSE;
> +
> + V_VT(&path) = VT_BSTR;
> + V_BSTR(&path) = This->item_paths[V_I4(&index)];
> +
> + return FolderItem_Constructor(&path, ppid);
> }
This is assuming you always have VT_I4 on input, but it's obviously
possible to call it with any type.
>
> static HRESULT WINAPI FolderItemsImpl__NewEnum(FolderItems3 *iface, IUnknown **ppunk)
> @@ -1139,9 +1157,17 @@ static const FolderItems3Vtbl FolderItemsImpl_Vtbl = {
> FolderItemsImpl_get_Verbs
> };
>
> -static HRESULT FolderItems_Constructor(FolderItems **ppfi)
> +static HRESULT FolderItems_Constructor(VARIANT *dir, FolderItems **ppfi)
> {
> + static const WCHAR backslash_star[] = {'\\','*',0};
> + static const WCHAR dot[] = {'.',0};
> + static const WCHAR dot_dot[] = {'.','.',0};
> FolderItemsImpl *This;
> + WCHAR path[MAX_PATH];
> + HANDLE first_file;
> + WIN32_FIND_DATAW file_info;
> + BSTR *paths;
> + HRESULT ret = S_OK;
>
> TRACE("\n");
>
> @@ -1152,8 +1178,51 @@ static HRESULT FolderItems_Constructor(FolderItems **ppfi)
> This->FolderItems3_iface.lpVtbl = &FolderItemsImpl_Vtbl;
> This->ref = 1;
>
> + This->item_paths = HeapAlloc(GetProcessHeap(), 0, sizeof(BSTR));
> + if (!This->item_paths)
> + {
> + HeapFree(GetProcessHeap(), 0, This);
> + return E_OUTOFMEMORY;
> + }
> + This->item_count = 0;
> +
> + lstrcpyW(path, V_BSTR(dir));
> + lstrcatW(path, backslash_star);
> + first_file = FindFirstFileW(path, &file_info);
> + if (first_file != INVALID_HANDLE_VALUE)
'dir' is not necessary VT_BSTR.