ddraw: Don't permit the enumeration of the Direct3D reference device in IDirect3D1::FindDevice.

This commit is contained in:
Andrew Nguyen 2010-07-18 16:26:57 -05:00 committed by Alexandre Julliard
parent d5c2a358b7
commit 14744c44b1
2 changed files with 16 additions and 10 deletions

View File

@ -684,7 +684,6 @@ IDirect3DImpl_3_FindDevice(IDirect3D3 *iface,
TRACE(" trying to match guid %s.\n", debugstr_guid(&(D3DDFS->guid))); TRACE(" trying to match guid %s.\n", debugstr_guid(&(D3DDFS->guid)));
if ((IsEqualGUID(&IID_D3DDEVICE_WineD3D, &(D3DDFS->guid)) == 0) && if ((IsEqualGUID(&IID_D3DDEVICE_WineD3D, &(D3DDFS->guid)) == 0) &&
(IsEqualGUID(&IID_IDirect3DHALDevice, &(D3DDFS->guid)) == 0) && (IsEqualGUID(&IID_IDirect3DHALDevice, &(D3DDFS->guid)) == 0) &&
(IsEqualGUID(&IID_IDirect3DRefDevice, &(D3DDFS->guid)) == 0) &&
(IsEqualGUID(&IID_IDirect3DRGBDevice, &(D3DDFS->guid)) == 0)) (IsEqualGUID(&IID_IDirect3DRGBDevice, &(D3DDFS->guid)) == 0))
{ {
TRACE(" no match for this GUID.\n"); TRACE(" no match for this GUID.\n");

View File

@ -3403,6 +3403,11 @@ static void FindDevice(void)
{&IID_IDirect3DRGBDevice}, {&IID_IDirect3DRGBDevice},
}; };
static const GUID *nonexistent_deviceGUIDs[] = {&IID_IDirect3DMMXDevice,
&IID_IDirect3DRefDevice,
&IID_IDirect3DTnLHalDevice,
&IID_IDirect3DNullDevice};
D3DFINDDEVICESEARCH search = {0}; D3DFINDDEVICESEARCH search = {0};
D3DFINDDEVICERESULT result = {0}; D3DFINDDEVICERESULT result = {0};
HRESULT hr; HRESULT hr;
@ -3454,16 +3459,18 @@ static void FindDevice(void)
ok(hr == DDERR_NOTFOUND, ok(hr == DDERR_NOTFOUND,
"Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr); "Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr);
/* The reference device GUID can't be enumerated. */ /* These GUIDs appear to be never present. */
search.dwSize = sizeof(search); for (i = 0; i < sizeof(nonexistent_deviceGUIDs)/sizeof(nonexistent_deviceGUIDs[0]); i++)
search.dwFlags = D3DFDS_GUID; {
search.guid = IID_IDirect3DRefDevice; search.dwSize = sizeof(search);
result.dwSize = sizeof(result); search.dwFlags = D3DFDS_GUID;
search.guid = *nonexistent_deviceGUIDs[i];
result.dwSize = sizeof(result);
hr = IDirect3D_FindDevice(Direct3D1, &search, &result); hr = IDirect3D_FindDevice(Direct3D1, &search, &result);
todo_wine ok(hr == DDERR_NOTFOUND,
ok(hr == DDERR_NOTFOUND, "[%d] Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", i, hr);
"Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr); }
/* These GUIDs appear to be always present. */ /* These GUIDs appear to be always present. */
for (i = 0; i < sizeof(deviceGUIDs)/sizeof(deviceGUIDs[0]); i++) for (i = 0; i < sizeof(deviceGUIDs)/sizeof(deviceGUIDs[0]); i++)