Module: wine Branch: master Commit: ab958dcf0cdaf82e42185021ed306a33dfcb2be4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ab958dcf0cdaf82e42185021ed...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Jun 7 02:14:11 2015 +0300
browseui: Added IEnumString stub for ACListISF.
---
dlls/browseui/aclsource.c | 129 ++++++++++++++++++++++++++++--------- dlls/browseui/tests/autocomplete.c | 24 +++++++ 2 files changed, 123 insertions(+), 30 deletions(-)
diff --git a/dlls/browseui/aclsource.c b/dlls/browseui/aclsource.c index 07033cc..71e9d39 100644 --- a/dlls/browseui/aclsource.c +++ b/dlls/browseui/aclsource.c @@ -42,7 +42,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
-typedef struct tagACLMulti { +typedef struct tagACLShellSource { + IEnumString IEnumString_iface; IACList2 IACList2_iface; LONG refCount; DWORD dwOptions; @@ -53,26 +54,37 @@ static inline ACLShellSource *impl_from_IACList2(IACList2 *iface) return CONTAINING_RECORD(iface, ACLShellSource, IACList2_iface); }
+static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface) +{ + return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface); +} + static void ACLShellSource_Destructor(ACLShellSource *This) { TRACE("destroying %p\n", This); heap_free(This); }
-static HRESULT WINAPI ACLShellSource_QueryInterface(IACList2 *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut) { - ACLShellSource *This = impl_from_IACList2(iface); + ACLShellSource *This = impl_from_IEnumString(iface); + + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), ppvOut); + *ppvOut = NULL;
- if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IACList2) || - IsEqualIID(iid, &IID_IACList)) + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString)) + { + *ppvOut = &This->IEnumString_iface; + } + else if (IsEqualIID(iid, &IID_IACList2) || IsEqualIID(iid, &IID_IACList)) { *ppvOut = &This->IACList2_iface; }
if (*ppvOut) { - IACList2_AddRef(iface); + IEnumString_AddRef(iface); return S_OK; }
@@ -80,40 +92,98 @@ static HRESULT WINAPI ACLShellSource_QueryInterface(IACList2 *iface, REFIID iid, return E_NOINTERFACE; }
-static ULONG WINAPI ACLShellSource_AddRef(IACList2 *iface) +static ULONG WINAPI ACLShellSource_AddRef(IEnumString *iface) +{ + ACLShellSource *This = impl_from_IEnumString(iface); + ULONG ref = InterlockedIncrement(&This->refCount); + TRACE("(%p)->(%u)\n", This, ref); + return ref; +} + +static ULONG WINAPI ACLShellSource_Release(IEnumString *iface) +{ + ACLShellSource *This = impl_from_IEnumString(iface); + ULONG ref = InterlockedDecrement(&This->refCount); + + TRACE("(%p)->(%u)\n", This, ref); + + if (ref == 0) + ACLShellSource_Destructor(This); + return ref; +} + +static HRESULT WINAPI ACLShellSource_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt, + ULONG *fetched) +{ + ACLShellSource *This = impl_from_IEnumString(iface); + FIXME("(%p)->(%u %p %p): stub\n", This, celt, rgelt, fetched); + return E_NOTIMPL; +} + +static HRESULT WINAPI ACLShellSource_Skip(IEnumString *iface, ULONG celt) +{ + ACLShellSource *This = impl_from_IEnumString(iface); + FIXME("(%p)->(%u): stub\n", This, celt); + return E_NOTIMPL; +} + +static HRESULT WINAPI ACLShellSource_Reset(IEnumString *iface) +{ + ACLShellSource *This = impl_from_IEnumString(iface); + FIXME("(%p): stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ACLShellSource_Clone(IEnumString *iface, IEnumString **ppenum) +{ + ACLShellSource *This = impl_from_IEnumString(iface); + FIXME("(%p)->(%p): stub\n", This, ppenum); + return E_NOTIMPL; +} + +static const IEnumStringVtbl ACLShellSourceVtbl = { + ACLShellSource_QueryInterface, + ACLShellSource_AddRef, + ACLShellSource_Release, + ACLShellSource_Next, + ACLShellSource_Skip, + ACLShellSource_Reset, + ACLShellSource_Clone +}; + +static HRESULT WINAPI ACList_QueryInterface(IACList2 *iface, REFIID iid, void **ppvOut) { ACLShellSource *This = impl_from_IACList2(iface); - return InterlockedIncrement(&This->refCount); + return IEnumString_QueryInterface(&This->IEnumString_iface, iid, ppvOut); }
-static ULONG WINAPI ACLShellSource_Release(IACList2 *iface) +static ULONG WINAPI ACList_AddRef(IACList2 *iface) { ACLShellSource *This = impl_from_IACList2(iface); - ULONG ret; + return IEnumString_AddRef(&This->IEnumString_iface); +}
- ret = InterlockedDecrement(&This->refCount); - if (ret == 0) - ACLShellSource_Destructor(This); - return ret; +static ULONG WINAPI ACList_Release(IACList2 *iface) +{ + ACLShellSource *This = impl_from_IACList2(iface); + return IEnumString_Release(&This->IEnumString_iface); }
-static HRESULT WINAPI ACLShellSource_Expand(IACList2 *iface, LPCWSTR wstr) +static HRESULT WINAPI ACList_Expand(IACList2 *iface, LPCWSTR wstr) { ACLShellSource *This = impl_from_IACList2(iface); FIXME("STUB:(%p) %s\n",This,debugstr_w(wstr)); return E_NOTIMPL; }
- -static HRESULT WINAPI ACLShellSource_GetOptions(IACList2 *iface, - DWORD *pdwFlag) +static HRESULT WINAPI ACList_GetOptions(IACList2 *iface, DWORD *pdwFlag) { ACLShellSource *This = impl_from_IACList2(iface); *pdwFlag = This->dwOptions; return S_OK; }
-static HRESULT WINAPI ACLShellSource_SetOptions(IACList2 *iface, +static HRESULT WINAPI ACList_SetOptions(IACList2 *iface, DWORD dwFlag) { ACLShellSource *This = impl_from_IACList2(iface); @@ -121,16 +191,14 @@ static HRESULT WINAPI ACLShellSource_SetOptions(IACList2 *iface, return S_OK; }
-static const IACList2Vtbl ACLMulti_ACList2Vtbl = +static const IACList2Vtbl ACListVtbl = { - ACLShellSource_QueryInterface, - ACLShellSource_AddRef, - ACLShellSource_Release, - - ACLShellSource_Expand, - - ACLShellSource_SetOptions, - ACLShellSource_GetOptions + ACList_QueryInterface, + ACList_AddRef, + ACList_Release, + ACList_Expand, + ACList_SetOptions, + ACList_GetOptions };
HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) @@ -143,10 +211,11 @@ HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (This == NULL) return E_OUTOFMEMORY;
- This->IACList2_iface.lpVtbl = &ACLMulti_ACList2Vtbl; + This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl; + This->IACList2_iface.lpVtbl = &ACListVtbl; This->refCount = 1;
TRACE("returning %p\n", This); - *ppOut = (IUnknown *)&This->IACList2_iface; + *ppOut = (IUnknown *)&This->IEnumString_iface; return S_OK; } diff --git a/dlls/browseui/tests/autocomplete.c b/dlls/browseui/tests/autocomplete.c index e7da647..0b04ab2 100644 --- a/dlls/browseui/tests/autocomplete.c +++ b/dlls/browseui/tests/autocomplete.c @@ -364,9 +364,33 @@ static void test_ACLMulti(void) CoTaskMemFree(acl2); }
+static void test_ACListISF(void) +{ + IEnumString *enumstring; + IACList *list, *list2; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_ACListISF, NULL, CLSCTX_INPROC, &IID_IACList, (void**)&list); + ok(hr == S_OK, "failed to create ACListISF instance, 0x%08x\n", hr); + + hr = IACList_QueryInterface(list, &IID_IEnumString, (void**)&enumstring); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IEnumString_QueryInterface(enumstring, &IID_IACList, (void**)&list2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(list == list2, "got %p, %p\n", list, list2); + IACList_Release(list2); + + IEnumString_Release(enumstring); + IACList_Release(list); +} + START_TEST(autocomplete) { CoInitialize(NULL); + test_ACLMulti(); + test_ACListISF(); + CoUninitialize(); }