Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/msdmo/dmoreg.c | 15 +++++++++------ dlls/msdmo/tests/msdmo.c | 7 +++++++ 2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c index 864cb859e6..1c06bbfe16 100644 --- a/dlls/msdmo/dmoreg.c +++ b/dlls/msdmo/dmoreg.c @@ -530,7 +530,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
TRACE("(%p)->(%d %p %p %p)\n", This, cItemsToFetch, pCLSID, Names, pcItemsFetched);
- if (!pCLSID || !Names) + if (!pCLSID) return E_POINTER;
if (!pcItemsFetched && cItemsToFetch > 1) @@ -656,14 +656,17 @@ static HRESULT WINAPI IEnumDMO_fnNext( }
/* Media object wasn't filtered so add it to return list */ - Names[count] = NULL; len = MAX_PATH * sizeof(WCHAR); ret = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE)szValue, &len); - if (ERROR_SUCCESS == ret) + if (Names) { - Names[count] = CoTaskMemAlloc((strlenW(szValue) + 1) * sizeof(WCHAR)); - if (Names[count]) - strcpyW(Names[count], szValue); + Names[count] = NULL; + if (ret == ERROR_SUCCESS) + { + Names[count] = CoTaskMemAlloc((strlenW(szValue) + 1) * sizeof(WCHAR)); + if (Names[count]) + strcpyW(Names[count], szValue); + } } wsprintfW(szGuidKey,szToGuidFmt,szNextKey); CLSIDFromString(szGuidKey, &pCLSID[count]); diff --git a/dlls/msdmo/tests/msdmo.c b/dlls/msdmo/tests/msdmo.c index 7617123aa5..68de11f21a 100644 --- a/dlls/msdmo/tests/msdmo.c +++ b/dlls/msdmo/tests/msdmo.c @@ -107,6 +107,13 @@ static void test_DMOEnum(void) ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); ok(count == 0, "expected 0, got %d\n", count);
+ hr = IEnumDMO_Next(enum_dmo, 2, NULL, &name, &count); + ok(hr == E_POINTER, "expected S_FALSE, got %#x\n", hr); + + hr = IEnumDMO_Next(enum_dmo, 2, &clsid, NULL, &count); + ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); + ok(count == 0, "expected 0, got %d\n", count); + IEnumDMO_Release(enum_dmo); }
Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/devenum/mediacatenum.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 5fa2f008dc..3e97f6da67 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -865,7 +865,6 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, LONG res; ULONG fetched = 0; MediaCatMoniker * pMoniker; - WCHAR *name; CLSID clsid; HRESULT hr; HKEY hkey; @@ -877,7 +876,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, /* FIXME: try PNP devices first */
/* try DMOs */ - if ((hr = IEnumDMO_Next(This->dmo_enum, 1, &clsid, &name, NULL)) == S_OK) + if ((hr = IEnumDMO_Next(This->dmo_enum, 1, &clsid, NULL, NULL)) == S_OK) { if (!(pMoniker = DEVENUM_IMediaCatMoniker_Construct())) return E_OUTOFMEMORY;