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); }