[PATCH 3/5] msdmo: Return the number of media types retrieved from DMOGetTypes().
Zebediah Figura
z.figura12 at gmail.com
Mon Jul 13 09:38:03 CDT 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/msdmo/dmoreg.c | 22 ++++++++--------------
dlls/msdmo/tests/msdmo.c | 2 +-
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c
index cd253c3e9a2..8c32a8f59fb 100644
--- a/dlls/msdmo/dmoreg.c
+++ b/dlls/msdmo/dmoreg.c
@@ -730,22 +730,16 @@ HRESULT WINAPI DMOGetTypes(REFCLSID clsid, ULONG input_count, ULONG *ret_input_c
}
*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);
- }
+ 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 = min(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);
- }
+ 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 = min(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 2afa56e5a6c..a1ab8ee00dc 100644
--- a/dlls/msdmo/tests/msdmo.c
+++ b/dlls/msdmo/tests/msdmo.c
@@ -144,7 +144,7 @@ static void test_DMOGetTypes(void)
memset(types, 0, sizeof(types));
hr = DMOGetTypes(&GUID_unknowndmo, 1, &input_count, types, 0, &output_count, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(input_count == 1, "Got input count %u.\n", input_count);
+ 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");
--
2.27.0
More information about the wine-devel
mailing list