wiaservc: Added a stub for IEnumWIA_DEV_INFO.

Based on original patch by Mikael Ståldal <mikael@staldal.nu>.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-10-08 21:09:11 +03:00 committed by Alexandre Julliard
parent c575f04b68
commit 9cb1981e30
2 changed files with 125 additions and 6 deletions

View File

@ -40,21 +40,19 @@ static void test_EnumDeviceInfo(void)
ok(FAILED(hr), "got 0x%08x\n", hr);
hr = IWiaDevMgr_EnumDeviceInfo(devmanager, WIA_DEVINFO_ENUM_LOCAL, &devenum);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
if (hr == S_OK) {
hr = IEnumWIA_DEV_INFO_GetCount(devenum, NULL);
ok(FAILED(hr), "got 0x%08x\n", hr);
count = 1000;
hr = IEnumWIA_DEV_INFO_GetCount(devenum, &count);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(count != 1000, "got %u\n", count);
IEnumWIA_DEV_INFO_Release(devenum);
}
}
START_TEST(wia)
{

View File

@ -29,11 +29,119 @@
WINE_DEFAULT_DEBUG_CHANNEL(wia);
typedef struct
{
IEnumWIA_DEV_INFO IEnumWIA_DEV_INFO_iface;
LONG ref;
} enumwiadevinfo;
static inline wiadevmgr *impl_from_IWiaDevMgr(IWiaDevMgr *iface)
{
return CONTAINING_RECORD(iface, wiadevmgr, IWiaDevMgr_iface);
}
static inline enumwiadevinfo *impl_from_IEnumWIA_DEV_INFO(IEnumWIA_DEV_INFO *iface)
{
return CONTAINING_RECORD(iface, enumwiadevinfo, IEnumWIA_DEV_INFO_iface);
}
static HRESULT WINAPI enumwiadevinfo_QueryInterface(IEnumWIA_DEV_INFO *iface, REFIID riid, void **obj)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumWIA_DEV_INFO))
*obj = iface;
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
*obj = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*obj);
return S_OK;
}
static ULONG WINAPI enumwiadevinfo_AddRef(IEnumWIA_DEV_INFO *iface)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%u)\n", This, ref);
return ref;
}
static ULONG WINAPI enumwiadevinfo_Release(IEnumWIA_DEV_INFO *iface)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%u)\n", This, ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
static HRESULT WINAPI enumwiadevinfo_Next(IEnumWIA_DEV_INFO *iface, ULONG count, IWiaPropertyStorage **elem, ULONG *fetched)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
FIXME("(%p, %d, %p, %p): stub\n", This, count, elem, fetched);
*fetched = 0;
return E_NOTIMPL;
}
static HRESULT WINAPI enumwiadevinfo_Skip(IEnumWIA_DEV_INFO *iface, ULONG count)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
FIXME("(%p, %u): stub\n", This, count);
return E_NOTIMPL;
}
static HRESULT WINAPI enumwiadevinfo_Reset(IEnumWIA_DEV_INFO *iface)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI enumwiadevinfo_Clone(IEnumWIA_DEV_INFO *iface, IEnumWIA_DEV_INFO **ret)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
FIXME("(%p, %p): stub\n", This, ret);
return E_NOTIMPL;
}
static HRESULT WINAPI enumwiadevinfo_GetCount(IEnumWIA_DEV_INFO *iface, ULONG *count)
{
enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
FIXME("(%p, %p): stub\n", This, count);
*count = 0;
return E_NOTIMPL;
}
static const IEnumWIA_DEV_INFOVtbl EnumWIA_DEV_INFOVtbl =
{
enumwiadevinfo_QueryInterface,
enumwiadevinfo_AddRef,
enumwiadevinfo_Release,
enumwiadevinfo_Next,
enumwiadevinfo_Skip,
enumwiadevinfo_Reset,
enumwiadevinfo_Clone,
enumwiadevinfo_GetCount
};
static HRESULT WINAPI wiadevmgr_QueryInterface(IWiaDevMgr *iface, REFIID riid, void **ppvObject)
{
wiadevmgr *This = impl_from_IWiaDevMgr(iface);
@ -69,11 +177,24 @@ static ULONG WINAPI wiadevmgr_Release(IWiaDevMgr *iface)
return ref;
}
static HRESULT WINAPI wiadevmgr_EnumDeviceInfo(IWiaDevMgr *iface, LONG lFlag, IEnumWIA_DEV_INFO **ppIEnum)
static HRESULT WINAPI wiadevmgr_EnumDeviceInfo(IWiaDevMgr *iface, LONG flag, IEnumWIA_DEV_INFO **ret)
{
wiadevmgr *This = impl_from_IWiaDevMgr(iface);
FIXME("(%p, %d, %p): stub\n", This, lFlag, ppIEnum);
return E_NOTIMPL;
enumwiadevinfo *enuminfo;
TRACE("(%p)->(%x, %p)\n", This, flag, ret);
*ret = NULL;
enuminfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*enuminfo));
if (!enuminfo)
return E_OUTOFMEMORY;
enuminfo->IEnumWIA_DEV_INFO_iface.lpVtbl = &EnumWIA_DEV_INFOVtbl;
enuminfo->ref = 1;
*ret = &enuminfo->IEnumWIA_DEV_INFO_iface;
return S_OK;
}
static HRESULT WINAPI wiadevmgr_CreateDevice(IWiaDevMgr *iface, BSTR bstrDeviceID, IWiaItem **ppWiaItemRoot)