Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46316 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/createdevenum.c | 18 +++++++++++++++++- dlls/devenum/tests/devenum.c | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index 44d478d325..2db5491190 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -861,7 +861,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; }
/********************************************************************** diff --git a/dlls/devenum/tests/devenum.c b/dlls/devenum/tests/devenum.c index 9fcfdcf316..945bc67919 100644 --- a/dlls/devenum/tests/devenum.c +++ b/dlls/devenum/tests/devenum.c @@ -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"); } }