dmusic: Check wrong params when creating a port + tests.
This commit is contained in:
parent
7776591ff4
commit
c05c04952e
|
@ -167,7 +167,8 @@ static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer (LPDIRECTMUSIC8 iface,
|
|||
return DMUSIC_CreateDirectMusicBufferImpl(&IID_IDirectMusicBuffer, (LPVOID)ppBuffer, NULL);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter) {
|
||||
static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter)
|
||||
{
|
||||
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
||||
int i;
|
||||
DMUS_PORTCAPS PortCaps;
|
||||
|
@ -181,8 +182,17 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLS
|
|||
if (TRACE_ON(dmusic))
|
||||
dump_DMUS_PORTPARAMS(pPortParams);
|
||||
|
||||
if(!rclsidPort)
|
||||
if (!rclsidPort)
|
||||
return E_POINTER;
|
||||
if (!pPortParams)
|
||||
return E_INVALIDARG;
|
||||
if (!ppPort)
|
||||
return E_POINTER;
|
||||
if (pUnkOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (TRACE_ON(dmusic))
|
||||
dump_DMUS_PORTPARAMS(pPortParams);
|
||||
|
||||
ZeroMemory(&PortCaps, sizeof(DMUS_PORTCAPS));
|
||||
PortCaps.dwSize = sizeof(DMUS_PORTCAPS);
|
||||
|
|
|
@ -66,6 +66,16 @@ static void test_dmusic(void)
|
|||
hr = IDirectMusic_SetDirectSound(dmusic, NULL, NULL);
|
||||
ok(hr == S_OK, "IDirectMusic_SetDirectSound returned: %x\n", hr);
|
||||
|
||||
/* Check wrong params */
|
||||
hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, &port, (IUnknown*)dmusic);
|
||||
ok(hr == CLASS_E_NOAGGREGATION, "IDirectMusic_CreatePort returned: %x\n", hr);
|
||||
hr = IDirectMusic_CreatePort(dmusic, NULL, &port_params, &port, NULL);
|
||||
ok(hr == E_POINTER, "IDirectMusic_CreatePort returned: %x\n", hr);
|
||||
hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, NULL, &port, NULL);
|
||||
ok(hr == E_INVALIDARG, "IDirectMusic_CreatePort returned: %x\n", hr);
|
||||
hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, NULL, NULL);
|
||||
ok(hr == E_POINTER, "IDirectMusic_CreatePort returned: %x\n", hr);
|
||||
|
||||
/* Test creation of default port with GUID_NULL */
|
||||
hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, &port, NULL);
|
||||
ok(hr == S_OK, "IDirectMusic_CreatePort returned: %x\n", hr);
|
||||
|
|
Loading…
Reference in New Issue