Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/createdevenum.c | 22 ---------------------- dlls/devenum/tests/devenum.c | 2 -- 2 files changed, 24 deletions(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index 7cfdbff..7c03852 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -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; } diff --git a/dlls/devenum/tests/devenum.c b/dlls/devenum/tests/devenum.c index 7e3270f..a08dece 100644 --- a/dlls/devenum/tests/devenum.c +++ b/dlls/devenum/tests/devenum.c @@ -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);
Since quartz can't read back version 1.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/createdevenum.c | 78 +++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 40 deletions(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index 7c03852..c1e29fc 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -124,7 +124,7 @@ static HKEY open_special_category_key(const CLSID *clsid, BOOL create) return ret; }
-static void DEVENUM_ReadPinTypes(HKEY hkeyPinKey, REGFILTERPINS *rgPin) +static void DEVENUM_ReadPinTypes(HKEY hkeyPinKey, REGFILTERPINS2 *rgPin) { HKEY hkeyTypes = NULL; DWORD dwMajorTypes, i; @@ -221,7 +221,11 @@ static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2) { HKEY hkeyPins = NULL; DWORD dwPinsSubkeys, i; - REGFILTERPINS *rgPins = NULL; + REGFILTERPINS2 *rgPins = NULL; + + rgf2->dwVersion = 2; + rgf2->u.s2.cPins2 = 0; + rgf2->u.s2.rgPins2 = NULL;
if (RegOpenKeyExW(hkeyFilterClass, wszPins, 0, KEY_READ, &hkeyPins) != ERROR_SUCCESS) return ; @@ -235,7 +239,7 @@ static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2)
if (dwPinsSubkeys) { - rgPins = CoTaskMemAlloc(sizeof(REGFILTERPINS) * dwPinsSubkeys); + rgPins = CoTaskMemAlloc(sizeof(REGFILTERPINS2) * dwPinsSubkeys); if (!rgPins) { RegCloseKey(hkeyPins); @@ -248,65 +252,64 @@ static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2) HKEY hkeyPinKey = NULL; WCHAR wszPinName[MAX_PATH]; DWORD cName = sizeof(wszPinName) / sizeof(WCHAR); - DWORD Type, cbData; - REGFILTERPINS *rgPin = &rgPins[rgf2->u.s1.cPins]; + REGFILTERPINS2 *rgPin = &rgPins[rgf2->u.s2.cPins2]; + DWORD value, size, Type; LONG lRet;
- rgPin->strName = NULL; - rgPin->clsConnectsToFilter = &GUID_NULL; - rgPin->strConnectsToPin = NULL; - rgPin->nMediaTypes = 0; - rgPin->lpMediaType = NULL; + memset(rgPin, 0, sizeof(*rgPin));
if (RegEnumKeyExW(hkeyPins, i, wszPinName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue;
if (RegOpenKeyExW(hkeyPins, wszPinName, 0, KEY_READ, &hkeyPinKey) != ERROR_SUCCESS) continue;
- rgPin->strName = CoTaskMemAlloc((strlenW(wszPinName) + 1) * sizeof(WCHAR)); - if (!rgPin->strName) goto error_cleanup; - - strcpyW(rgPin->strName, wszPinName); - - cbData = sizeof(rgPin->bMany); - lRet = RegQueryValueExW(hkeyPinKey, wszAllowedMany, NULL, &Type, (LPBYTE)&rgPin->bMany, &cbData); + size = sizeof(DWORD); + lRet = RegQueryValueExW(hkeyPinKey, wszAllowedMany, NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; + if (value) + rgPin->dwFlags |= REG_PINFLAG_B_MANY;
- cbData = sizeof(rgPin->bZero); - lRet = RegQueryValueExW(hkeyPinKey, wszAllowedZero, NULL, &Type, (LPBYTE)&rgPin->bZero, &cbData); + size = sizeof(DWORD); + lRet = RegQueryValueExW(hkeyPinKey, wszAllowedZero, NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; + if (value) + rgPin->dwFlags |= REG_PINFLAG_B_ZERO;
- cbData = sizeof(rgPin->bOutput); - lRet = RegQueryValueExW(hkeyPinKey, wszDirection, NULL, &Type, (LPBYTE)&rgPin->bOutput, &cbData); + size = sizeof(DWORD); + lRet = RegQueryValueExW(hkeyPinKey, wszDirection, NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; + if (value) + rgPin->dwFlags |= REG_PINFLAG_B_OUTPUT; +
- cbData = sizeof(rgPin->bRendered); - lRet = RegQueryValueExW(hkeyPinKey, wszIsRendered, NULL, &Type, (LPBYTE)&rgPin->bRendered, &cbData); + size = sizeof(DWORD); + lRet = RegQueryValueExW(hkeyPinKey, wszIsRendered, NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; + if (value) + rgPin->dwFlags |= REG_PINFLAG_B_RENDERER;
DEVENUM_ReadPinTypes(hkeyPinKey, rgPin);
- ++rgf2->u.s1.cPins; + ++rgf2->u.s2.cPins2; continue;
error_cleanup:
RegCloseKey(hkeyPinKey); - CoTaskMemFree(rgPin->strName); }
RegCloseKey(hkeyPins);
- if (rgPins && !rgf2->u.s1.cPins) + if (rgPins && !rgf2->u.s2.cPins2) { CoTaskMemFree(rgPins); rgPins = NULL; }
- rgf2->u.s1.rgPins = rgPins; + rgf2->u.s2.rgPins2 = rgPins; }
static HRESULT DEVENUM_RegisterLegacyAmFilters(void) @@ -374,10 +377,7 @@ static HRESULT DEVENUM_RegisterLegacyAmFilters(void) if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszRegKey, 0, KEY_READ, &hkeyFilterClass) != ERROR_SUCCESS) continue;
- rgf2.dwVersion = 1; rgf2.dwMerit = 0; - rgf2.u.s1.cPins = 0; - rgf2.u.s1.rgPins = NULL;
cbData = sizeof(wszFilterName); if (RegQueryValueExW(hkeyFilterClass, NULL, NULL, &Type, (LPBYTE)wszFilterName, &cbData) != ERROR_SUCCESS || @@ -403,29 +403,27 @@ static HRESULT DEVENUM_RegisterLegacyAmFilters(void)
if (hkeyFilterClass) RegCloseKey(hkeyFilterClass);
- if (rgf2.u.s1.rgPins) + if (rgf2.u.s2.rgPins2) { UINT iPin;
- for (iPin = 0; iPin < rgf2.u.s1.cPins; iPin++) + for (iPin = 0; iPin < rgf2.u.s2.cPins2; iPin++) { - CoTaskMemFree(rgf2.u.s1.rgPins[iPin].strName); - - if (rgf2.u.s1.rgPins[iPin].lpMediaType) + if (rgf2.u.s2.rgPins2[iPin].lpMediaType) { UINT iType;
- for (iType = 0; iType < rgf2.u.s1.rgPins[iPin].nMediaTypes; iType++) + for (iType = 0; iType < rgf2.u.s2.rgPins2[iPin].nMediaTypes; iType++) { - CoTaskMemFree((void*)rgf2.u.s1.rgPins[iPin].lpMediaType[iType].clsMajorType); - CoTaskMemFree((void*)rgf2.u.s1.rgPins[iPin].lpMediaType[iType].clsMinorType); + CoTaskMemFree((void*)rgf2.u.s2.rgPins2[iPin].lpMediaType[iType].clsMajorType); + CoTaskMemFree((void*)rgf2.u.s2.rgPins2[iPin].lpMediaType[iType].clsMinorType); }
- CoTaskMemFree((void*)rgf2.u.s1.rgPins[iPin].lpMediaType); + CoTaskMemFree((void*)rgf2.u.s2.rgPins2[iPin].lpMediaType); } }
- CoTaskMemFree((void*)rgf2.u.s1.rgPins); + CoTaskMemFree((void*)rgf2.u.s2.rgPins2); } } }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v3: don't ignore other return values (thanks Anton Romanov)
dlls/quartz/filtermapper.c | 7 +++++-- dlls/quartz/tests/filtermapper.c | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c index 4e4cb37..20c7e3a 100644 --- a/dlls/quartz/filtermapper.c +++ b/dlls/quartz/filtermapper.c @@ -1523,22 +1523,25 @@ static HRESULT WINAPI FilterMapper_UnregisterFilter(IFilterMapper * iface, CLSID strcatW(wszKeyName, wszClsid);
lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszKeyName, 0, KEY_WRITE, &hKey); + if (lRet == ERROR_FILE_NOT_FOUND) + goto done; hr = HRESULT_FROM_WIN32(lRet); }
if (SUCCEEDED(hr)) { lRet = RegDeleteValueW(hKey, wszMeritName); - if (lRet != ERROR_SUCCESS) + if (lRet != ERROR_SUCCESS && lRet != ERROR_FILE_NOT_FOUND) hr = HRESULT_FROM_WIN32(lRet);
lRet = RegDeleteTreeW(hKey, wszPins); - if (lRet != ERROR_SUCCESS) + if (lRet != ERROR_SUCCESS && lRet != ERROR_FILE_NOT_FOUND) hr = HRESULT_FROM_WIN32(lRet);
RegCloseKey(hKey); }
+done: CoTaskMemFree(wszClsid);
return hr; diff --git a/dlls/quartz/tests/filtermapper.c b/dlls/quartz/tests/filtermapper.c index 829e89b..c9578c6 100644 --- a/dlls/quartz/tests/filtermapper.c +++ b/dlls/quartz/tests/filtermapper.c @@ -297,6 +297,12 @@ static void test_legacy_filter_registration(void) ret = RegDeleteKeyW(HKEY_CLASSES_ROOT, key_name); ok(!ret, "RegDeleteKeyA failed: %lu\n", ret);
+ hr = IFilterMapper_RegisterFilter(mapper, clsid, testfilterW, MERIT_UNLIKELY); + ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr); + + hr = IFilterMapper_UnregisterFilter(mapper, clsid); + ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr); + IFilterMapper_Release(mapper); IFilterMapper2_Release(mapper2); }