msdmo: Use proper buffer types in IEnumDMO::Next.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Jacek Caban 2020-05-07 16:31:16 +02:00 committed by Alexandre Julliard
parent c69bb0342c
commit 8d0b0b7b0c
1 changed files with 9 additions and 20 deletions

View File

@ -519,6 +519,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
WCHAR szGuidKey[64]; WCHAR szGuidKey[64];
WCHAR szKey[MAX_PATH]; WCHAR szKey[MAX_PATH];
WCHAR szValue[MAX_PATH]; WCHAR szValue[MAX_PATH];
DMO_PARTIAL_MEDIATYPE types[100];
DWORD len; DWORD len;
UINT count = 0; UINT count = 0;
HRESULT hres = S_OK; HRESULT hres = S_OK;
@ -572,31 +573,25 @@ static HRESULT WINAPI IEnumDMO_fnNext(
{ {
UINT i, j; UINT i, j;
DWORD cInTypes; DWORD cInTypes;
DMO_PARTIAL_MEDIATYPE* pInTypes;
hres = read_types(hkey, szDMOInputType, &cInTypes,
sizeof(szValue)/sizeof(DMO_PARTIAL_MEDIATYPE),
(DMO_PARTIAL_MEDIATYPE*)szValue);
hres = read_types(hkey, szDMOInputType, &cInTypes, ARRAY_SIZE(types), types);
if (FAILED(hres)) if (FAILED(hres))
{ {
RegCloseKey(hkey); RegCloseKey(hkey);
continue; continue;
} }
pInTypes = (DMO_PARTIAL_MEDIATYPE *)szValue;
TRACE("read %d intypes for %s:\n", cInTypes, debugstr_w(szKey)); TRACE("read %d intypes for %s:\n", cInTypes, debugstr_w(szKey));
for (i = 0; i < cInTypes; i++) { for (i = 0; i < cInTypes; i++) {
TRACE("intype %d: type %s, subtype %s\n", i, debugstr_guid(&pInTypes[i].type), TRACE("intype %d: type %s, subtype %s\n", i, debugstr_guid(&types[i].type),
debugstr_guid(&pInTypes[i].subtype)); debugstr_guid(&types[i].subtype));
} }
for (i = 0; i < This->cInTypes; i++) for (i = 0; i < This->cInTypes; i++)
{ {
for (j = 0; j < cInTypes; j++) for (j = 0; j < cInTypes; j++)
{ {
if (IsMediaTypeEqual(&pInTypes[j], &This->pInTypes[i])) if (IsMediaTypeEqual(&types[j], &This->pInTypes[i]))
break; break;
} }
@ -615,31 +610,25 @@ static HRESULT WINAPI IEnumDMO_fnNext(
{ {
UINT i, j; UINT i, j;
DWORD cOutTypes; DWORD cOutTypes;
DMO_PARTIAL_MEDIATYPE* pOutTypes;
hres = read_types(hkey, szDMOOutputType, &cOutTypes,
sizeof(szValue)/sizeof(DMO_PARTIAL_MEDIATYPE),
(DMO_PARTIAL_MEDIATYPE*)szValue);
hres = read_types(hkey, szDMOOutputType, &cOutTypes, ARRAY_SIZE(types), types);
if (FAILED(hres)) if (FAILED(hres))
{ {
RegCloseKey(hkey); RegCloseKey(hkey);
continue; continue;
} }
pOutTypes = (DMO_PARTIAL_MEDIATYPE *)szValue;
TRACE("read %d outtypes for %s:\n", cOutTypes, debugstr_w(szKey)); TRACE("read %d outtypes for %s:\n", cOutTypes, debugstr_w(szKey));
for (i = 0; i < cOutTypes; i++) { for (i = 0; i < cOutTypes; i++) {
TRACE("outtype %d: type %s, subtype %s\n", i, debugstr_guid(&pOutTypes[i].type), TRACE("outtype %d: type %s, subtype %s\n", i, debugstr_guid(&types[i].type),
debugstr_guid(&pOutTypes[i].subtype)); debugstr_guid(&types[i].subtype));
} }
for (i = 0; i < This->cOutTypes; i++) for (i = 0; i < This->cOutTypes; i++)
{ {
for (j = 0; j < cOutTypes; j++) for (j = 0; j < cOutTypes; j++)
{ {
if (IsMediaTypeEqual(&pOutTypes[j], &This->pOutTypes[i])) if (IsMediaTypeEqual(&types[j], &This->pOutTypes[i]))
break; break;
} }