Commit e835e143 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmsynth: Add error handling to the synth GetPortCaps method.

parent 340e1fee
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment