msdmo: Fix pointer checking in IEnumDMO_Next().

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-05-08 18:55:00 -05:00 committed by Alexandre Julliard
parent 216e1f25a4
commit e2e3f70ed7
2 changed files with 14 additions and 4 deletions

View File

@ -519,9 +519,12 @@ static HRESULT WINAPI IEnumDMO_fnNext(
TRACE("(%p)->(%d %p %p %p)\n", This, cItemsToFetch, pCLSID, Names, pcItemsFetched);
if (!pCLSID || !Names || !pcItemsFetched)
if (!pCLSID || !Names)
return E_POINTER;
if (!pcItemsFetched && cItemsToFetch > 1)
return E_INVALIDARG;
while (count < cItemsToFetch)
{
This->index++;
@ -656,8 +659,8 @@ static HRESULT WINAPI IEnumDMO_fnNext(
count++;
}
*pcItemsFetched = count;
if (*pcItemsFetched < cItemsToFetch)
if (pcItemsFetched) *pcItemsFetched = count;
if (count < cItemsToFetch)
hres = S_FALSE;
TRACE("<-- %i found\n",count);

View File

@ -92,14 +92,21 @@ static void test_DMOEnum(void)
HRESULT hr;
CLSID clsid;
WCHAR *name;
DWORD count;
hr = DMOEnum(&GUID_unknowncategory, 0, 0, NULL, 0, NULL, &enum_dmo);
ok(hr == S_OK, "DMOEnum() failed with %#x\n", hr);
hr = IEnumDMO_Next(enum_dmo, 1, &clsid, &name, NULL);
todo_wine
ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
hr = IEnumDMO_Next(enum_dmo, 2, &clsid, &name, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
hr = IEnumDMO_Next(enum_dmo, 2, &clsid, &name, &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);
}