From 14744c44b1e35694771810d11a19db615be2bff7 Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Sun, 18 Jul 2010 16:26:57 -0500 Subject: [PATCH] ddraw: Don't permit the enumeration of the Direct3D reference device in IDirect3D1::FindDevice. --- dlls/ddraw/direct3d.c | 1 - dlls/ddraw/tests/d3d.c | 25 ++++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c index edbcc28758e..15c30a5e87d 100644 --- a/dlls/ddraw/direct3d.c +++ b/dlls/ddraw/direct3d.c @@ -684,7 +684,6 @@ IDirect3DImpl_3_FindDevice(IDirect3D3 *iface, TRACE(" trying to match guid %s.\n", debugstr_guid(&(D3DDFS->guid))); if ((IsEqualGUID(&IID_D3DDEVICE_WineD3D, &(D3DDFS->guid)) == 0) && (IsEqualGUID(&IID_IDirect3DHALDevice, &(D3DDFS->guid)) == 0) && - (IsEqualGUID(&IID_IDirect3DRefDevice, &(D3DDFS->guid)) == 0) && (IsEqualGUID(&IID_IDirect3DRGBDevice, &(D3DDFS->guid)) == 0)) { TRACE(" no match for this GUID.\n"); diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 069bc963fde..aa87ca6b588 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -3403,6 +3403,11 @@ static void FindDevice(void) {&IID_IDirect3DRGBDevice}, }; + static const GUID *nonexistent_deviceGUIDs[] = {&IID_IDirect3DMMXDevice, + &IID_IDirect3DRefDevice, + &IID_IDirect3DTnLHalDevice, + &IID_IDirect3DNullDevice}; + D3DFINDDEVICESEARCH search = {0}; D3DFINDDEVICERESULT result = {0}; HRESULT hr; @@ -3454,16 +3459,18 @@ static void FindDevice(void) ok(hr == DDERR_NOTFOUND, "Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr); - /* The reference device GUID can't be enumerated. */ - search.dwSize = sizeof(search); - search.dwFlags = D3DFDS_GUID; - search.guid = IID_IDirect3DRefDevice; - result.dwSize = sizeof(result); + /* These GUIDs appear to be never present. */ + for (i = 0; i < sizeof(nonexistent_deviceGUIDs)/sizeof(nonexistent_deviceGUIDs[0]); i++) + { + search.dwSize = sizeof(search); + search.dwFlags = D3DFDS_GUID; + search.guid = *nonexistent_deviceGUIDs[i]; + result.dwSize = sizeof(result); - hr = IDirect3D_FindDevice(Direct3D1, &search, &result); - todo_wine - ok(hr == DDERR_NOTFOUND, - "Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr); + hr = IDirect3D_FindDevice(Direct3D1, &search, &result); + ok(hr == DDERR_NOTFOUND, + "[%d] Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", i, hr); + } /* These GUIDs appear to be always present. */ for (i = 0; i < sizeof(deviceGUIDs)/sizeof(deviceGUIDs[0]); i++)