devenum: Always scan for devices in CreateClassEnumerator().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-03-08 23:42:16 -06:00 committed by Alexandre Julliard
parent fe7313e09d
commit 6c30370ef5
2 changed files with 0 additions and 24 deletions

View File

@ -547,12 +547,6 @@ static void register_vfw_codecs(void)
RegCloseKey(basekey);
}
static HANDLE DEVENUM_populate_handle;
static const WCHAR DEVENUM_populate_handle_nameW[] =
{'_','_','W','I','N','E','_',
'D','e','v','e','n','u','m','_',
'P','o','p','u','l','a','t','e',0};
static HRESULT register_codecs(void)
{
HRESULT res;
@ -566,21 +560,6 @@ static HRESULT register_codecs(void)
REGFILTERPINS2 rfp2;
HKEY basekey;
if (DEVENUM_populate_handle)
return S_OK;
DEVENUM_populate_handle = CreateEventW(NULL, TRUE, FALSE, DEVENUM_populate_handle_nameW);
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
/* Webcams can take some time to scan if the driver is badly written and it enables them,
* so have a 10 s timeout here
*/
if (WaitForSingleObject(DEVENUM_populate_handle, 10000) == WAIT_TIMEOUT)
WARN("Waiting for object timed out\n");
TRACE("No need to rescan\n");
return S_OK;
}
TRACE("Scanning for devices\n");
/* Since devices can change between session, for example because you just plugged in a webcam
* or switched from pulseaudio to alsa, delete all old devices first
*/
@ -878,6 +857,5 @@ static HRESULT register_codecs(void)
register_vfw_codecs();
SetEvent(DEVENUM_populate_handle);
return res;
}

View File

@ -445,11 +445,9 @@ static void test_codec(void)
/* unlike DirectShow filters, these are automatically generated, so
* enumerating them will destroy the key */
todo_wine
ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "codec should not be registered\n");
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
IPropertyBag_Release(prop_bag);