diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 492f79fae51..0178e103ba4 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -235,6 +235,7 @@ enum tid_t { IShellFolderViewDual3_tid, Folder3_tid, FolderItem2_tid, + FolderItems3_tid, FolderItemVerb_tid, FolderItemVerbs_tid, LAST_tid diff --git a/dlls/shell32/shelldispatch.c b/dlls/shell32/shelldispatch.c index 62c1bd35b56..93c851f7660 100644 --- a/dlls/shell32/shelldispatch.c +++ b/dlls/shell32/shelldispatch.c @@ -48,6 +48,7 @@ static const IID * const tid_ids[] = &IID_IShellFolderViewDual3, &IID_Folder3, &IID_FolderItem2, + &IID_FolderItems3, &IID_FolderItemVerb, &IID_FolderItemVerbs }; @@ -64,6 +65,11 @@ typedef struct { VARIANT dir; } FolderImpl; +typedef struct { + FolderItems3 FolderItems3_iface; + LONG ref; +} FolderItemsImpl; + typedef struct { FolderItem2 FolderItem2_iface; LONG ref; @@ -97,6 +103,11 @@ static inline FolderImpl *impl_from_Folder(Folder3 *iface) return CONTAINING_RECORD(iface, FolderImpl, Folder3_iface); } +static inline FolderItemsImpl *impl_from_FolderItems(FolderItems3 *iface) +{ + return CONTAINING_RECORD(iface, FolderItemsImpl, FolderItems3_iface); +} + static inline FolderItemImpl *impl_from_FolderItem(FolderItem2 *iface) { return CONTAINING_RECORD(iface, FolderItemImpl, FolderItem2_iface); @@ -939,6 +950,196 @@ static HRESULT FolderItem_Constructor(VARIANT *dir, FolderItem **ppfi) return ret; } +static HRESULT WINAPI FolderItemsImpl_QueryInterface(FolderItems3 *iface, + REFIID riid, LPVOID *ppv) +{ + FolderItemsImpl *This = impl_from_FolderItems(iface); + + TRACE("(%p,%s,%p)\n", iface, shdebugstr_guid(riid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, riid) || + IsEqualIID(&IID_IDispatch, riid) || + IsEqualIID(&IID_FolderItems, riid) || + IsEqualIID(&IID_FolderItems2, riid) || + IsEqualIID(&IID_FolderItems3, riid)) + *ppv = &This->FolderItems3_iface; + else + { + FIXME("not implemented for %s\n", shdebugstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI FolderItemsImpl_AddRef(FolderItems3 *iface) +{ + FolderItemsImpl *This = impl_from_FolderItems(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p), new refcount=%i\n", iface, ref); + + return ref; +} + +static ULONG WINAPI FolderItemsImpl_Release(FolderItems3 *iface) +{ + FolderItemsImpl *This = impl_from_FolderItems(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p), new refcount=%i\n", iface, ref); + + if (!ref) + HeapFree(GetProcessHeap(), 0, This); + return ref; +} + +static HRESULT WINAPI FolderItemsImpl_GetTypeInfoCount(FolderItems3 *iface, + UINT *count) +{ + TRACE("(%p,%p)\n", iface, count); + + *count = 1; + return S_OK; +} + +static HRESULT WINAPI FolderItemsImpl_GetTypeInfo(FolderItems3 *iface, + UINT type, LCID lcid, ITypeInfo **ppti) +{ + HRESULT hr; + + TRACE("(%p,%u,%d,%p)\n", iface, type, lcid, ppti); + + hr = get_typeinfo(FolderItems3_tid, ppti); + if (SUCCEEDED(hr)) + ITypeInfo_AddRef(*ppti); + return hr; +} + +static HRESULT WINAPI FolderItemsImpl_GetIDsOfNames(FolderItems3 *iface, + REFIID riid, LPOLESTR *names, UINT count, LCID lcid, DISPID *dispid) +{ + ITypeInfo *ti; + HRESULT hr; + + TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), names, count, lcid, dispid); + + hr = get_typeinfo(FolderItems3_tid, &ti); + if (SUCCEEDED(hr)) + hr = ITypeInfo_GetIDsOfNames(ti, names, count, dispid); + return hr; +} + +static HRESULT WINAPI FolderItemsImpl_Invoke(FolderItems3 *iface, + DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *result, EXCEPINFO *ei, UINT *err) +{ + FolderItemsImpl *This = impl_from_FolderItems(iface); + ITypeInfo *ti; + HRESULT hr; + + TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispid, shdebugstr_guid(riid), lcid, flags, params, result, ei, err); + + hr = get_typeinfo(FolderItems3_tid, &ti); + if (SUCCEEDED(hr)) + hr = ITypeInfo_Invoke(ti, This, dispid, flags, params, result, ei, err); + return hr; +} + +static HRESULT WINAPI FolderItemsImpl_get_Count(FolderItems3 *iface, LONG *count) +{ + FIXME("(%p,%p)\n", iface, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI FolderItemsImpl_get_Application(FolderItems3 *iface, IDispatch **ppid) +{ + FIXME("(%p,%p)\n", iface, ppid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI FolderItemsImpl_get_Parent(FolderItems3 *iface, IDispatch **ppid) +{ + FIXME("(%p,%p)\n", iface, ppid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI FolderItemsImpl_Item(FolderItems3 *iface, VARIANT index, FolderItem **ppid) +{ + FIXME("(%p,%s,%p)\n", iface, debugstr_variant(&index), ppid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI FolderItemsImpl__NewEnum(FolderItems3 *iface, IUnknown **ppunk) +{ + FIXME("(%p,%p)\n", iface, ppunk); + + return E_NOTIMPL; +} + +static HRESULT WINAPI FolderItemsImpl_InvokeVerbEx(FolderItems3 *iface, VARIANT verb, VARIANT args) +{ + FIXME("(%p,%s,%s)\n", iface, debugstr_variant(&verb), debugstr_variant(&args)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI FolderItemsImpl_Filter(FolderItems3 *iface, LONG flags, BSTR spec) +{ + FIXME("(%p,%d,%s)\n", iface, flags, wine_dbgstr_w(spec)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI FolderItemsImpl_get_Verbs(FolderItems3 *iface, FolderItemVerbs **ppfic) +{ + FIXME("(%p,%p)\n", iface, ppfic); + + return E_NOTIMPL; +} + +static const FolderItems3Vtbl FolderItemsImpl_Vtbl = { + FolderItemsImpl_QueryInterface, + FolderItemsImpl_AddRef, + FolderItemsImpl_Release, + FolderItemsImpl_GetTypeInfoCount, + FolderItemsImpl_GetTypeInfo, + FolderItemsImpl_GetIDsOfNames, + FolderItemsImpl_Invoke, + FolderItemsImpl_get_Count, + FolderItemsImpl_get_Application, + FolderItemsImpl_get_Parent, + FolderItemsImpl_Item, + FolderItemsImpl__NewEnum, + FolderItemsImpl_InvokeVerbEx, + FolderItemsImpl_Filter, + FolderItemsImpl_get_Verbs +}; + +static HRESULT FolderItems_Constructor(FolderItems **ppfi) +{ + FolderItemsImpl *This; + + TRACE("\n"); + + *ppfi = NULL; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderItemsImpl)); + if (!This) return E_OUTOFMEMORY; + This->FolderItems3_iface.lpVtbl = &FolderItemsImpl_Vtbl; + This->ref = 1; + + *ppfi = (FolderItems*)&This->FolderItems3_iface; + return S_OK; +} + static HRESULT WINAPI FolderImpl_QueryInterface(Folder3 *iface, REFIID riid, LPVOID *ppv) { @@ -1093,8 +1294,7 @@ static HRESULT WINAPI FolderImpl_Items(Folder3 *iface, FolderItems **ppid) { FIXME("(%p,%p)\n", iface, ppid); - *ppid = NULL; - return E_NOTIMPL; + return FolderItems_Constructor(ppid); } static HRESULT WINAPI FolderImpl_ParseName(Folder3 *iface, BSTR name, FolderItem **item)