2 * Some unit tests for ddraw reference counting
4 * Copyright (C) 2006 Stefan Dösinger
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/test.h"
28 static HRESULT (WINAPI
*pDirectDrawCreateEx
)(LPGUID
,LPVOID
*,REFIID
,LPUNKNOWN
);
30 static void init_function_pointers(void)
32 HMODULE hmod
= GetModuleHandleA("ddraw.dll");
33 pDirectDrawCreateEx
= (void*)GetProcAddress(hmod
, "DirectDrawCreateEx");
36 static unsigned long getRefcount(IUnknown
*iface
)
38 IUnknown_AddRef(iface
);
39 return IUnknown_Release(iface
);
42 static void test_ddraw_objects(void)
50 IDirectDrawPalette
*palette
;
51 IDirectDrawSurface7
*surface
= NULL
;
52 IDirectDrawSurface
*surface1
;
53 IDirectDrawSurface4
*surface4
;
54 PALETTEENTRY Table
[256];
57 hr
= pDirectDrawCreateEx(NULL
, (void **) &DDraw7
, &IID_IDirectDraw7
, NULL
);
58 ok(hr
== DD_OK
|| hr
==DDERR_NODIRECTDRAWSUPPORT
, "DirectDrawCreateEx returned: %x\n", hr
);
61 trace("Couldn't create DDraw interface, skipping tests\n");
65 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw4
, (void **) &DDraw4
);
66 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
67 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw2
, (void **) &DDraw2
);
68 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
69 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw
, (void **) &DDraw1
);
70 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
72 ref
= getRefcount( (IUnknown
*) DDraw7
);
73 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
75 /* Fails without a cooplevel */
76 hr
= IDirectDraw7_CreatePalette(DDraw7
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
77 ok(hr
== DDERR_NOCOOPERATIVELEVELSET
, "CreatePalette returned %08x\n", hr
);
79 /* This check is before the cooplevel check */
80 hr
= IDirectDraw7_CreatePalette(DDraw7
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, (void *) 0xdeadbeef);
81 ok(hr
== CLASS_E_NOAGGREGATION
, "CreatePalette returned %08x\n", hr
);
83 hr
= IDirectDraw7_SetCooperativeLevel(DDraw7
, 0, DDSCL_NORMAL
);
84 ok(hr
== DD_OK
, "SetCooperativeLevel failed with %08x\n", hr
);
86 memset(&ddsd
, 0, sizeof(ddsd
));
87 ddsd
.dwSize
= sizeof(ddsd
);
88 ddsd
.dwFlags
= DDSD_CAPS
| DDSD_WIDTH
| DDSD_HEIGHT
| DDSD_PIXELFORMAT
;
91 ddsd
.ddsCaps
.dwCaps
= DDSCAPS_OFFSCREENPLAIN
;
92 U4(ddsd
).ddpfPixelFormat
.dwSize
= sizeof(U4(ddsd
).ddpfPixelFormat
);
93 U4(ddsd
).ddpfPixelFormat
.dwFlags
= DDPF_PALETTEINDEXED8
| DDPF_RGB
;
94 U1(U4(ddsd
).ddpfPixelFormat
).dwRGBBitCount
= 8;
96 hr
= IDirectDraw7_CreateSurface(DDraw7
, &ddsd
, &surface
, NULL
);
99 win_skip("Could not create surface : %08x\n", hr
);
100 IDirectDraw7_Release(DDraw7
);
103 ok(hr
== DD_OK
, "CreateSurface failed with %08x\n", hr
);
105 /* DDraw refcount increased by 1 */
106 ref
= getRefcount( (IUnknown
*) DDraw7
);
107 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
109 /* Surface refcount starts with 1 */
110 ref
= getRefcount( (IUnknown
*) surface
);
111 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
113 hr
= IDirectDraw7_CreatePalette(DDraw7
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
114 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
116 /* DDraw refcount increased by 1 */
117 ref
= getRefcount( (IUnknown
*) DDraw7
);
118 ok(ref
== 3, "Got refcount %ld, expected 3\n", ref
);
120 /* Palette starts with 1 */
121 ref
= getRefcount( (IUnknown
*) palette
);
122 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
124 /* Test attaching a palette to a surface */
125 hr
= IDirectDrawSurface7_SetPalette(surface
, palette
);
126 ok(hr
== DD_OK
, "IDirectDrawSurface_SetPalette failed with %08x\n", hr
);
128 /* Palette refcount increased, surface stays the same */
129 ref
= getRefcount( (IUnknown
*) palette
);
130 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
131 ref
= getRefcount( (IUnknown
*) surface
);
132 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
134 IDirectDrawSurface7_Release(surface
);
135 /* Increased before - decrease now */
136 ref
= getRefcount( (IUnknown
*) DDraw7
);
137 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
139 /* Releasing the surface detaches the palette */
140 ref
= getRefcount( (IUnknown
*) palette
);
141 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
143 IDirectDrawPalette_Release(palette
);
145 /* Increased before - decrease now */
146 ref
= getRefcount( (IUnknown
*) DDraw7
);
147 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
149 /* Not all interfaces are AddRefed when a palette is created */
150 hr
= IDirectDraw4_CreatePalette(DDraw4
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
151 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
152 ref
= getRefcount( (IUnknown
*) DDraw4
);
153 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
154 IDirectDrawPalette_Release(palette
);
157 hr
= IDirectDraw2_CreatePalette(DDraw2
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
158 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
159 ref
= getRefcount( (IUnknown
*) DDraw2
);
160 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
161 IDirectDrawPalette_Release(palette
);
164 hr
= IDirectDraw_CreatePalette(DDraw1
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
165 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
166 ref
= getRefcount( (IUnknown
*) DDraw1
);
167 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
168 IDirectDrawPalette_Release(palette
);
170 /* Similar for surfaces */
171 hr
= IDirectDraw4_CreateSurface(DDraw4
, &ddsd
, &surface4
, NULL
);
172 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
173 ref
= getRefcount( (IUnknown
*) DDraw4
);
174 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
175 IDirectDrawSurface4_Release(surface4
);
177 ddsd
.dwSize
= sizeof(DDSURFACEDESC
);
178 hr
= IDirectDraw2_CreateSurface(DDraw2
, (DDSURFACEDESC
*) &ddsd
, &surface1
, NULL
);
179 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
180 ref
= getRefcount( (IUnknown
*) DDraw2
);
181 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
182 IDirectDrawSurface_Release(surface1
);
184 hr
= IDirectDraw_CreateSurface(DDraw1
, (DDSURFACEDESC
*) &ddsd
, &surface1
, NULL
);
185 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
186 ref
= getRefcount( (IUnknown
*) DDraw1
);
187 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
188 IDirectDrawSurface_Release(surface1
);
190 IDirectDraw7_Release(DDraw7
);
191 IDirectDraw4_Release(DDraw4
);
192 IDirectDraw2_Release(DDraw2
);
193 IDirectDraw_Release(DDraw1
);
196 static void test_iface_refcnt(void)
200 IDirectDraw2
*DDraw2
;
201 IDirectDraw4
*DDraw4
;
202 IDirectDraw7
*DDraw7
;
209 hr
= pDirectDrawCreateEx(NULL
, (void **) &DDraw7
, &IID_IDirectDraw7
, NULL
);
210 ok(hr
== DD_OK
|| hr
==DDERR_NODIRECTDRAWSUPPORT
, "DirectDrawCreateEx returned: %x\n", hr
);
213 trace("Couldn't create DDraw interface, skipping tests\n");
217 ref
= getRefcount( (IUnknown
*) DDraw7
);
218 ok(ref
== 1, "Initial IDirectDraw7 reference count is %ld\n", ref
);
220 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw4
, (void **) &DDraw4
);
221 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
222 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw2
, (void **) &DDraw2
);
223 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterf&ace returned %08x\n", hr
);
224 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw
, (void **) &DDraw1
);
225 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
227 /* All interfaces now have refcount 1! */
228 ref
= getRefcount( (IUnknown
*) DDraw7
);
229 ok(ref
== 1, "IDirectDraw7 reference count is %ld\n", ref
);
230 ref
= getRefcount( (IUnknown
*) DDraw7
);
231 ok(ref
== 1, "IDirectDraw7 reference count is %ld\n", ref
);
232 ref
= getRefcount( (IUnknown
*) DDraw4
);
233 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
234 ref
= getRefcount( (IUnknown
*) DDraw2
);
235 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
236 ref
= getRefcount( (IUnknown
*) DDraw1
);
237 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
239 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D7
, (void **) &D3D7
);
240 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
242 /* Apparently IDirectDrawX and IDirect3DX are linked together */
243 ref
= getRefcount( (IUnknown
*) D3D7
);
244 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
);
245 ref
= getRefcount( (IUnknown
*) DDraw7
);
246 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
);
248 IDirectDraw7_AddRef(DDraw7
);
249 ref
= getRefcount( (IUnknown
*) D3D7
);
250 ok(ref
== 3, "IDirect3D7 reference count is %ld\n", ref
);
251 ref
= getRefcount( (IUnknown
*) DDraw7
);
252 ok(ref
== 3, "IDirectDraw7 reference count is %ld\n", ref
);
254 IDirect3D7_Release(D3D7
);
255 ref
= getRefcount( (IUnknown
*) D3D7
);
256 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
);
257 ref
= getRefcount( (IUnknown
*) DDraw7
);
258 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
);
260 /* Can't get older d3d interfaces. WHY????? */
261 hr
= IDirectDraw7_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
262 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
263 if(hr
== DD_OK
&& D3D3
) IDirect3D3_Release(D3D3
);
265 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
266 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
267 if(hr
== DD_OK
&& D3D3
) IDirect3D3_Release(D3D3
);
269 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D2
, (void **) &D3D2
);
270 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
271 if(hr
== DD_OK
&& D3D2
) IDirect3D2_Release(D3D2
);
273 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D2
, (void **) &D3D2
);
274 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
275 if(hr
== DD_OK
&& D3D2
) IDirect3D2_Release(D3D2
);
277 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D
, (void **) &D3D1
);
278 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
279 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
281 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D
, (void **) &D3D1
);
282 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
283 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
285 hr
= IDirect3D7_QueryInterface(D3D7
, &IID_IDirect3D
, (void **) &D3D1
);
286 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirect3D7_QueryInterface returned %08x\n", hr
);
287 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
289 /* Try an AddRef, it only affects the AddRefed interface */
290 IDirectDraw4_AddRef(DDraw4
);
291 ref
= getRefcount( (IUnknown
*) DDraw7
);
292 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
); /* <-- From the d3d query */
293 ref
= getRefcount( (IUnknown
*) DDraw4
);
294 ok(ref
== 2, "IDirectDraw4 reference count is %ld\n", ref
); /* <-- The AddRef call */
295 ref
= getRefcount( (IUnknown
*) DDraw2
);
296 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
297 ref
= getRefcount( (IUnknown
*) DDraw1
);
298 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
299 ref
= getRefcount( (IUnknown
*) D3D7
);
300 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
); /* <-- From the d3d query */
301 IDirectDraw4_Release(DDraw4
);
303 /* Make sure that they are one object, not different ones */
304 hr
= IDirectDraw4_SetCooperativeLevel(DDraw4
, GetDesktopWindow(), DDSCL_EXCLUSIVE
| DDSCL_FULLSCREEN
);
305 ok(hr
== DD_OK
, "IDirectDraw4::SetCooperativeLevel returned %08x\n", hr
);
306 /* After an window has been set, DDSCL_SETFOCUSWINDOW should return DDERR_HWNDALREADYSET, see the mode test */
307 hr
= IDirectDraw7_SetCooperativeLevel(DDraw7
, NULL
, DDSCL_SETFOCUSWINDOW
);
308 ok(hr
== DDERR_HWNDALREADYSET
, "IDirectDraw7::SetCooperativeLevel returned %08x\n", hr
);
310 /* All done, release all interfaces */
311 IDirectDraw7_Release(DDraw7
);
312 IDirectDraw4_Release(DDraw4
);
313 IDirectDraw2_Release(DDraw2
);
314 IDirectDraw_Release(DDraw1
);
315 IDirect3D7_Release(D3D7
);
318 static void test_d3d_ifaces(void)
321 IDirectDraw2
*DDraw2
;
322 IDirectDraw4
*DDraw4
;
330 hr
= DirectDrawCreate(NULL
, &DDraw1
, NULL
);
331 ok(hr
== DD_OK
|| hr
==DDERR_NODIRECTDRAWSUPPORT
, "DirectDrawCreateEx returned: %x\n", hr
);
334 trace("DirectDrawCreate failed with %08x\n", hr
);
338 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirectDraw2
, (void **) &DDraw2
);
339 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
340 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirectDraw4
, (void **) &DDraw4
);
341 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
343 ref
= getRefcount( (IUnknown
*) DDraw4
);
344 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
345 ref
= getRefcount( (IUnknown
*) DDraw2
);
346 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
347 ref
= getRefcount( (IUnknown
*) DDraw1
);
348 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
350 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D
, (void **) &D3D1
);
351 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
352 ref
= getRefcount( (IUnknown
*) DDraw4
);
353 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
354 ref
= getRefcount( (IUnknown
*) DDraw2
);
355 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
356 ref
= getRefcount( (IUnknown
*) DDraw1
);
357 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
358 IDirect3D_Release(D3D1
);
360 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D2
, (void **) &D3D2
);
361 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
362 ref
= getRefcount( (IUnknown
*) DDraw4
);
363 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
364 ref
= getRefcount( (IUnknown
*) DDraw2
);
365 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
366 ref
= getRefcount( (IUnknown
*) DDraw1
);
367 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
368 IDirect3D2_Release(D3D2
);
370 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
371 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
372 ref
= getRefcount( (IUnknown
*) DDraw4
);
373 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
374 ref
= getRefcount( (IUnknown
*) DDraw2
);
375 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
376 ref
= getRefcount( (IUnknown
*) DDraw1
);
377 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
378 IDirect3D3_Release(D3D3
);
380 /* Try to AddRef the D3D3 interface that has been released already */
381 IDirect3D3_AddRef(D3D3
);
382 ref
= getRefcount( (IUnknown
*) DDraw1
);
383 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
384 ref
= getRefcount( (IUnknown
*) D3D3
);
385 ok(ref
== 2, "IDirect3D3 reference count is %ld\n", ref
);
386 /* The newer interfaces remain untouched */
387 ref
= getRefcount( (IUnknown
*) DDraw4
);
388 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
389 ref
= getRefcount( (IUnknown
*) DDraw2
);
390 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
391 IDirect3D3_Release(D3D3
);
392 ref
= getRefcount( (IUnknown
*) DDraw1
);
393 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
394 ref
= getRefcount( (IUnknown
*) DDraw1
);
395 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
397 /* It is possible to query any IDirect3D interfaces from any IDirectDraw interface,
398 * Except IDirect3D7, it can only be returned by IDirectDraw7(which can't return older ifaces)
400 hr
= IDirectDraw_QueryInterface(DDraw2
, &IID_IDirect3D
, (void **) &D3D1
);
401 ok(hr
== DD_OK
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
402 IDirect3D_Release(D3D1
);
403 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D
, (void **) &D3D1
);
404 ok(hr
== DD_OK
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
405 IDirect3D_Release(D3D1
);
407 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D2
, (void **) &D3D2
);
408 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
409 IDirect3D_Release(D3D2
);
410 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D2
, (void **) &D3D2
);
411 ok(hr
== DD_OK
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
412 IDirect3D_Release(D3D2
);
414 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D3
, (void **) &D3D3
);
415 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
416 IDirect3D_Release(D3D3
);
417 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D3
, (void **) &D3D3
);
418 ok(hr
== DD_OK
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
419 IDirect3D_Release(D3D3
);
421 /* This does NOT work */
422 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D7
, (void **) &D3D7
);
423 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
424 if(D3D7
) IDirect3D_Release(D3D7
);
425 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D7
, (void **) &D3D7
);
426 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
427 if(D3D7
) IDirect3D_Release(D3D7
);
428 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D7
, (void **) &D3D7
);
429 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
430 if(D3D7
) IDirect3D_Release(D3D7
);
432 /* Release the interfaces */
433 IDirectDraw4_Release(DDraw4
);
434 IDirectDraw2_Release(DDraw2
);
435 IDirectDraw_Release(DDraw1
);
440 init_function_pointers();
441 if(!pDirectDrawCreateEx
)
443 win_skip("function DirectDrawCreateEx not available\n");
446 test_ddraw_objects();