ddraw: Add a NULL callback pointer check in the EnumDevices implementations.

This commit is contained in:
Andrew Nguyen 2011-05-31 05:49:57 -05:00 committed by Alexandre Julliard
parent 7cd97b2ed4
commit cf6d56a43a
2 changed files with 18 additions and 0 deletions

View File

@ -4234,6 +4234,9 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
if (!callback)
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
hr = IDirect3DImpl_GetCaps(This->wineD3D, &device_desc1, &device_desc7);
@ -4291,6 +4294,9 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
if (!callback)
return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
hr = IDirect3DImpl_GetCaps(This->wineD3D, &device_desc1, &device_desc7);

View File

@ -865,8 +865,12 @@ static HRESULT WINAPI enumDevicesCallbackTest7(LPSTR DeviceDescription, LPSTR De
IDirect3D7_EnumDevices. */
static void D3D7EnumTest(void)
{
HRESULT hr;
D3D7ETest d3d7et;
hr = IDirect3D7_EnumDevices(lpD3D, NULL, NULL);
ok(hr == DDERR_INVALIDPARAMS, "IDirect3D7_EnumDevices returned 0x%08x\n", hr);
memset(&d3d7et, 0, sizeof(d3d7et));
IDirect3D7_EnumDevices(lpD3D, enumDevicesCallbackTest7, &d3d7et);
@ -892,6 +896,10 @@ static void CapsTest(void)
ok(hr == DD_OK, "Cannot create a DirectDraw 1 interface, hr = %08x\n", hr);
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirect3D3, (void **) &d3d3);
ok(hr == D3D_OK, "IDirectDraw_QueryInterface returned %08x\n", hr);
hr = IDirect3D3_EnumDevices(d3d3, NULL, NULL);
ok(hr == DDERR_INVALIDPARAMS, "IDirect3D3_EnumDevices returned 0x%08x\n", hr);
ver = 3;
IDirect3D3_EnumDevices(d3d3, enumDevicesCallback, &ver);
@ -902,6 +910,10 @@ static void CapsTest(void)
ok(hr == DD_OK, "Cannot create a DirectDraw 1 interface, hr = %08x\n", hr);
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirect3D2, (void **) &d3d2);
ok(hr == D3D_OK, "IDirectDraw_QueryInterface returned %08x\n", hr);
hr = IDirect3D2_EnumDevices(d3d2, NULL, NULL);
ok(hr == DDERR_INVALIDPARAMS, "IDirect3D2_EnumDevices returned 0x%08x\n", hr);
ver = 2;
IDirect3D2_EnumDevices(d3d2, enumDevicesCallback, &ver);