Commit 14744c44 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

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

parent d5c2a358
...@@ -684,7 +684,6 @@ IDirect3DImpl_3_FindDevice(IDirect3D3 *iface, ...@@ -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");
......
...@@ -3403,6 +3403,11 @@ static void FindDevice(void) ...@@ -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) ...@@ -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. */
for (i = 0; i < sizeof(nonexistent_deviceGUIDs)/sizeof(nonexistent_deviceGUIDs[0]); i++)
{
search.dwSize = sizeof(search); search.dwSize = sizeof(search);
search.dwFlags = D3DFDS_GUID; search.dwFlags = D3DFDS_GUID;
search.guid = IID_IDirect3DRefDevice; search.guid = *nonexistent_deviceGUIDs[i];
result.dwSize = sizeof(result); 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,
"Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr); "[%d] Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", i, 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++)
......
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