Commit 61e0ffcd authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

msdmo: Allow for names to be NULL in IEnumDMO_Next.

parent e41502b4
...@@ -530,7 +530,7 @@ static HRESULT WINAPI IEnumDMO_fnNext( ...@@ -530,7 +530,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
TRACE("(%p)->(%d %p %p %p)\n", This, cItemsToFetch, pCLSID, Names, pcItemsFetched); TRACE("(%p)->(%d %p %p %p)\n", This, cItemsToFetch, pCLSID, Names, pcItemsFetched);
if (!pCLSID || !Names) if (!pCLSID)
return E_POINTER; return E_POINTER;
if (!pcItemsFetched && cItemsToFetch > 1) if (!pcItemsFetched && cItemsToFetch > 1)
...@@ -656,14 +656,17 @@ static HRESULT WINAPI IEnumDMO_fnNext( ...@@ -656,14 +656,17 @@ static HRESULT WINAPI IEnumDMO_fnNext(
} }
/* Media object wasn't filtered so add it to return list */ /* Media object wasn't filtered so add it to return list */
Names[count] = NULL;
len = MAX_PATH * sizeof(WCHAR); len = MAX_PATH * sizeof(WCHAR);
ret = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE)szValue, &len); ret = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE)szValue, &len);
if (ERROR_SUCCESS == ret) if (Names)
{ {
Names[count] = CoTaskMemAlloc((strlenW(szValue) + 1) * sizeof(WCHAR)); Names[count] = NULL;
if (Names[count]) if (ret == ERROR_SUCCESS)
strcpyW(Names[count], szValue); {
Names[count] = CoTaskMemAlloc((strlenW(szValue) + 1) * sizeof(WCHAR));
if (Names[count])
strcpyW(Names[count], szValue);
}
} }
wsprintfW(szGuidKey,szToGuidFmt,szNextKey); wsprintfW(szGuidKey,szToGuidFmt,szNextKey);
CLSIDFromString(szGuidKey, &pCLSID[count]); CLSIDFromString(szGuidKey, &pCLSID[count]);
......
...@@ -107,6 +107,13 @@ static void test_DMOEnum(void) ...@@ -107,6 +107,13 @@ static void test_DMOEnum(void)
ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
ok(count == 0, "expected 0, got %d\n", count); 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); IEnumDMO_Release(enum_dmo);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment