[PATCH v2 2/3] shell32: Implement FolderItems_Item.

Matteo Bruni matteo.mystral at gmail.com
Mon Sep 11 13:05:04 CDT 2017


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.



More information about the wine-devel mailing list