Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/dmsynth/synth.c | 3 +++ dlls/dmsynth/tests/dmsynth.c | 11 +++++++++++ 2 files changed, 14 insertions(+)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 51b33e8df8d..f05f769761e 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -295,6 +295,9 @@ static HRESULT WINAPI IDirectMusicSynth8Impl_GetPortCaps(IDirectMusicSynth8 *ifa
TRACE("(%p)->(%p)\n", This, caps);
+ if (!caps || caps->dwSize < sizeof(*caps)) + return E_INVALIDARG; + *caps = This->caps;
return S_OK; diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c index e27d8abdb26..59ced1f0f21 100644 --- a/dlls/dmsynth/tests/dmsynth.c +++ b/dlls/dmsynth/tests/dmsynth.c @@ -64,6 +64,7 @@ static void test_dmsynth(void) KSPROPERTY property; ULONG value; ULONG bytes; + DMUS_PORTCAPS caps;
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth, (LPVOID*)&dmsynth); ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr); @@ -146,6 +147,16 @@ static void test_dmsynth(void) ref_clock_synth = get_refcount(clock_synth); ok(ref_clock_synth > ref_clock_sink + 1, "Latency clock refcount didn't increase\n");
+ /* GetPortCaps */ + hr = IDirectMusicSynth_GetPortCaps(dmsynth, NULL); + ok(hr == E_INVALIDARG, "GetPortCaps failed: %#x\n", hr); + memset(&caps, 0, sizeof(caps)); + hr = IDirectMusicSynth_GetPortCaps(dmsynth, &caps); + ok(hr == E_INVALIDARG, "GetPortCaps failed: %#x\n", hr); + caps.dwSize = sizeof(caps) + 1; + hr = IDirectMusicSynth_GetPortCaps(dmsynth, &caps); + ok(hr == S_OK, "GetPortCaps failed: %#x\n", hr); + if (control_synth) IDirectMusicSynth_Release(control_synth); if (control_sink)