Commit e0da0b77 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

devenum: Return S_FALSE from CreateClassEnumerator() if no devices exist.

parent 541c8d27
......@@ -862,7 +862,23 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator(
else if (IsEqualGUID(class, &CLSID_VideoInputDeviceCategory))
register_avicap_devices();
return create_EnumMoniker(class, out);
if (SUCCEEDED(hr = create_EnumMoniker(class, out)))
{
IMoniker *mon;
hr = IEnumMoniker_Next(*out, 1, &mon, NULL);
if (hr == S_OK)
{
IMoniker_Release(mon);
IEnumMoniker_Reset(*out);
}
else
{
IEnumMoniker_Release(*out);
*out = NULL;
}
}
return hr;
}
/**********************************************************************
......
......@@ -69,6 +69,7 @@ static void test_devenum(IBindCtx *bind_ctx)
WCHAR *displayname;
VARIANT var;
HRESULT hr;
int count;
hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
&IID_ICreateDevEnum, (LPVOID*)&create_devenum);
......@@ -105,6 +106,8 @@ static void test_devenum(IBindCtx *bind_ctx)
if (hr == S_OK)
{
count = 0;
while (IEnumMoniker_Next(enum_moniker, 1, &moniker, NULL) == S_OK)
{
hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &displayname);
......@@ -136,8 +139,11 @@ static void test_devenum(IBindCtx *bind_ctx)
CoTaskMemFree(displayname);
IPropertyBag_Release(prop_bag);
IMoniker_Release(moniker);
count++;
}
IEnumMoniker_Release(enum_moniker);
ok(count > 0, "CreateClassEnumerator() returned S_OK but no devices were enumerated.\n");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment