[PATCH v2 2/3] shell32: Implement FolderItems_Item.
Alex Henrie
alexhenrie24 at gmail.com
Tue Sep 12 00:07:56 CDT 2017
2017-09-11 12:05 GMT-06:00 Matteo Bruni <matteo.mystral at gmail.com>:
> 2017-09-11 6:43 GMT+02:00 Alex Henrie <alexhenrie24 at gmail.com>:
>> v2:
>> - Changed E_OUTOFMEMORY to ERROR_BUFFER_OVERFLOW
>
>> 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 canonicalized_index[MAX_PATH], 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;
>> +
>> + switch (V_VT(&index))
>> + {
>> + case VT_I2:
>> + VariantChangeType(&index, &index, 0, VT_I4);
>> + /* fall through */
>> +
>> + case VT_I4:
>> + if (V_I4(&index) >= This->item_count || V_I4(&index) < 0)
>> + return S_FALSE;
>> +
>> + if (!PathCombineW(path_str, V_BSTR(&This->dir), This->item_filenames[V_I4(&index)]))
>> + return ERROR_BUFFER_OVERFLOW;
>
> That's not a valid HRESULT though, e.g. FAILED(ERROR_BUFFER_OVERFLOW) is FALSE.
You're right, sorry. I ran some more tests today, and it looks like
FolderItems_Item returns S_FALSE no matter what the specific error
was. I don't think I need to include the tests for this because I
don't think the error code really matters, but I will submit a revised
patch.
-Alex
More information about the wine-devel
mailing list