Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msdmo/dmoreg.c | 92 +++++++++++++++++----------------------- dlls/msdmo/tests/msdmo.c | 2 +- 2 files changed, 39 insertions(+), 55 deletions(-)
diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c index a23bd95512d..cd253c3e9a2 100644 --- a/dlls/msdmo/dmoreg.c +++ b/dlls/msdmo/dmoreg.c @@ -706,62 +706,46 @@ static const IEnumDMOVtbl edmovt = IEnumDMO_fnClone, };
- -HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types ) -{ - DWORD len = requested * sizeof(DMO_PARTIAL_MEDIATYPE); - LONG ret = RegQueryValueExW(root, key, NULL, NULL, (BYTE *)types, &len); - - *supplied = len / sizeof(DMO_PARTIAL_MEDIATYPE); - return HRESULT_FROM_WIN32(ret); -} - /*************************************************************** * DMOGetTypes (MSDMO.@) */ -HRESULT WINAPI DMOGetTypes(REFCLSID clsidDMO, - ULONG ulInputTypesRequested, - ULONG* pulInputTypesSupplied, - DMO_PARTIAL_MEDIATYPE* pInputTypes, - ULONG ulOutputTypesRequested, - ULONG* pulOutputTypesSupplied, - DMO_PARTIAL_MEDIATYPE* pOutputTypes) +HRESULT WINAPI DMOGetTypes(REFCLSID clsid, ULONG input_count, ULONG *ret_input_count, DMO_PARTIAL_MEDIATYPE *input, + ULONG output_count, ULONG *ret_output_count, DMO_PARTIAL_MEDIATYPE *output) { - HKEY root,hkey; - HRESULT ret = S_OK; - WCHAR szguid[64]; - - TRACE ("(%s,%u,%p,%p,%u,%p,%p)\n", debugstr_guid(clsidDMO), ulInputTypesRequested, - pulInputTypesSupplied, pInputTypes, ulOutputTypesRequested, pulOutputTypesSupplied, - pOutputTypes); - - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"DirectShow\MediaObjects", 0, KEY_READ, &root)) - return E_FAIL; - - if (ERROR_SUCCESS != RegOpenKeyExW(root,GUIDToString(szguid,clsidDMO) , 0, - KEY_READ, &hkey)) - { - RegCloseKey(root); - return E_FAIL; - } - - if (ulInputTypesRequested > 0) - { - ret = read_types(hkey, L"InputTypes", pulInputTypesSupplied, ulInputTypesRequested, pInputTypes ); - } - else - *pulInputTypesSupplied = 0; - - if (ulOutputTypesRequested > 0) - { - HRESULT ret2; - ret2 = read_types(hkey, L"OutputTypes", pulOutputTypesSupplied, ulOutputTypesRequested, pOutputTypes ); - - if (ret == S_OK) - ret = ret2; - } - else - *pulOutputTypesSupplied = 0; - - return ret; + WCHAR guidstr[64]; + HKEY root, key; + LSTATUS ret; + DWORD size; + + TRACE("clsid %s, input_count %u, ret_input_count %p, input %p, output_count %u, ret_output_count %p, output %p.\n", + debugstr_guid(clsid), input_count, ret_input_count, input, output_count, ret_output_count, output); + + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"DirectShow\MediaObjects", 0, KEY_READ, &root)) + return E_FAIL; + + if (RegOpenKeyExW(root, GUIDToString(guidstr, clsid), 0, KEY_READ, &key)) + { + RegCloseKey(root); + return E_FAIL; + } + + *ret_input_count = 0; + if (input_count > 0) + { + size = input_count * sizeof(DMO_PARTIAL_MEDIATYPE); + ret = RegQueryValueExW(key, L"InputTypes", NULL, NULL, (BYTE *)input, &size); + if (!ret || ret == ERROR_MORE_DATA) + *ret_input_count = size / sizeof(DMO_PARTIAL_MEDIATYPE); + } + + *ret_output_count = 0; + if (output_count > 0) + { + size = output_count * sizeof(DMO_PARTIAL_MEDIATYPE); + ret = RegQueryValueExW(key, L"OutputTypes", NULL, NULL, (BYTE *)output, &size); + if (!ret || ret == ERROR_MORE_DATA) + *ret_output_count = size / sizeof(DMO_PARTIAL_MEDIATYPE); + } + + return S_OK; } diff --git a/dlls/msdmo/tests/msdmo.c b/dlls/msdmo/tests/msdmo.c index 14653ea8d75..2afa56e5a6c 100644 --- a/dlls/msdmo/tests/msdmo.c +++ b/dlls/msdmo/tests/msdmo.c @@ -143,7 +143,7 @@ static void test_DMOGetTypes(void)
memset(types, 0, sizeof(types)); hr = DMOGetTypes(&GUID_unknowndmo, 1, &input_count, types, 0, &output_count, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); todo_wine ok(input_count == 1, "Got input count %u.\n", input_count); ok(!output_count, "Got output count %u.\n", output_count); todo_wine ok(!memcmp(types, input_types, sizeof(DMO_PARTIAL_MEDIATYPE)), "Types didn't match.\n");