browseui: Added IEnumString stub for ACListISF.

This commit is contained in:
Nikolay Sivov 2015-06-07 02:14:11 +03:00 committed by Alexandre Julliard
parent 1de3aec336
commit ab958dcf0c
2 changed files with 124 additions and 31 deletions

View File

@ -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_IACList2(iface);
return InterlockedIncrement(&This->refCount);
ACLShellSource *This = impl_from_IEnumString(iface);
ULONG ref = InterlockedIncrement(&This->refCount);
TRACE("(%p)->(%u)\n", This, ref);
return ref;
}
static ULONG WINAPI ACLShellSource_Release(IACList2 *iface)
static ULONG WINAPI ACLShellSource_Release(IEnumString *iface)
{
ACLShellSource *This = impl_from_IACList2(iface);
ULONG ret;
ACLShellSource *This = impl_from_IEnumString(iface);
ULONG ref = InterlockedDecrement(&This->refCount);
ret = InterlockedDecrement(&This->refCount);
if (ret == 0)
TRACE("(%p)->(%u)\n", This, ref);
if (ref == 0)
ACLShellSource_Destructor(This);
return ret;
return ref;
}
static HRESULT WINAPI ACLShellSource_Expand(IACList2 *iface, LPCWSTR wstr)
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 IEnumString_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
}
static ULONG WINAPI ACList_AddRef(IACList2 *iface)
{
ACLShellSource *This = impl_from_IACList2(iface);
return IEnumString_AddRef(&This->IEnumString_iface);
}
static ULONG WINAPI ACList_Release(IACList2 *iface)
{
ACLShellSource *This = impl_from_IACList2(iface);
return IEnumString_Release(&This->IEnumString_iface);
}
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;
}

View File

@ -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();
}