[PATCH 2/3] shell32: Implement FolderItems_Item.
Nikolay Sivov
bunglehead at gmail.com
Fri Sep 8 03:28:40 CDT 2017
On 08.09.2017 8:29, Alex Henrie wrote:
> typedef struct {
> FolderItems3 FolderItems3_iface;
> LONG ref;
> + VARIANT dir;
> + WCHAR **item_filenames;
> + LONG item_count;
> } FolderItemsImpl;
If 'dir' is always a string maybe store it as such?
> 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);
> + WCHAR path_str[MAX_PATH];
> + VARIANT path_var;
> + HRESULT ret;
> +
> + TRACE("(%p,%s,%p)\n", iface, debugstr_variant(&index), ppid);
>
> *ppid = NULL;
> - return E_NOTIMPL;
> +
> + if (!PathIsDirectoryW(V_BSTR(&This->dir)))
> + return S_FALSE;
How could it not be a directory?
> + TRACE("(%p,%s,%p)\n", iface, debugstr_variant(&index), ppid);
Could add some spaces in argument list? Most of the wine code is doing
that I think.
> + if (!PathCombineW(path_str, V_BSTR(&This->dir), This->item_filenames[V_I4(&index)]))
> + return E_OUTOFMEMORY;
Why E_OUTOFMEMORY?
> + do
> + {
> + if (!strcmpW(file_info.cFileName, dot) || !strcmpW(file_info.cFileName, dot_dot))
> + continue;
> +
> + if (This->item_count >= item_size)
> + {
> + item_size *= 2;
> + filenames = HeapReAlloc(GetProcessHeap(), 0, This->item_filenames, item_size * sizeof(WCHAR*));
> + if (!filenames)
> + goto fail;
> + This->item_filenames = filenames;
> + }
> +
> + This->item_filenames[This->item_count] = strdupW(file_info.cFileName);
> + if (!This->item_filenames[This->item_count])
> + goto fail;
> + This->item_count++;
> + }
> + while (FindNextFileW(first_file, &file_info));
Do we have tests showing that it takes a snapshot like that? For example
if new file is created after FolderItems was created, is it accessible
with BSTR index for example?
More information about the wine-devel
mailing list