From 6ef2b65531688d87a11fa879bdd55080cffda429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 16 Dec 2008 20:56:41 +0100 Subject: [PATCH] ddraw: Reject IDirectDraw3 QI in ddraw.dll. --- dlls/ddraw/ddraw.c | 7 +++++-- dlls/ddraw/tests/ddrawmodes.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 7024a0f1f91..286e4b32f07 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -121,8 +121,11 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface, } else if ( IsEqualGUID( &IID_IDirectDraw3, refiid ) ) { - *obj = ICOM_INTERFACE(This, IDirectDraw3); - TRACE("(%p) Returning IDirectDraw3 interface at %p\n", This, *obj); + /* This Interface exists in ddrawex.dll, it is implemented in a wrapper */ + WARN("IDirectDraw3 is not valid in ddraw.dll\n"); + *obj = NULL; + LeaveCriticalSection(&ddraw_cs); + return E_NOINTERFACE; } else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) { diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index d21c3b4f350..67dd9d4cbf4 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -385,6 +385,21 @@ static void testcooperativelevels_exclusive(void) /* All done */ } +static void testddraw3(void) +{ + const GUID My_IID_IDirectDraw3 = { + 0x618f8ad4, + 0x8b7a, + 0x11d0, + { 0x8f,0xcc,0x0,0xc0,0x4f,0xd9,0x18,0x9d } + }; + IDirectDraw3 *dd3; + HRESULT hr; + hr = IDirectDraw_QueryInterface(lpDD, &My_IID_IDirectDraw3, (void **) &dd3); + ok(hr == E_NOINTERFACE, "QueryInterface for IID_IDirectDraw3 returned 0x%08x, expected E_NOINTERFACE\n", hr); + if(SUCCEEDED(hr) && dd3) IDirectDraw3_Release(dd3); +} + START_TEST(ddrawmodes) { createwindow(); @@ -394,6 +409,7 @@ START_TEST(ddrawmodes) if (winetest_interactive) testdisplaymodes(); flushdisplaymodes(); + testddraw3(); releasedirectdraw(); createdirectdraw();