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
22 #include "wine/test.h"
27 static HRESULT (WINAPI
*pDirectDrawCreateEx
)(GUID
*driver_guid
,
28 void **ddraw
, REFIID interface_iid
, IUnknown
*outer
);
30 static void init_function_pointers(void)
32 HMODULE hmod
= GetModuleHandleA("ddraw.dll");
33 pDirectDrawCreateEx
= (void*)GetProcAddress(hmod
, "DirectDrawCreateEx");
36 static ULONG
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 %d, 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 IDirectDraw_Release(DDraw1
);
101 IDirectDraw2_Release(DDraw2
);
102 IDirectDraw4_Release(DDraw4
);
103 IDirectDraw7_Release(DDraw7
);
106 ok(hr
== DD_OK
, "CreateSurface failed with %08x\n", hr
);
108 /* DDraw refcount increased by 1 */
109 ref
= getRefcount( (IUnknown
*) DDraw7
);
110 ok(ref
== 2, "Got refcount %d, expected 2\n", ref
);
112 /* Surface refcount starts with 1 */
113 ref
= getRefcount( (IUnknown
*) surface
);
114 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
116 hr
= IDirectDraw7_CreatePalette(DDraw7
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
117 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
119 /* DDraw refcount increased by 1 */
120 ref
= getRefcount( (IUnknown
*) DDraw7
);
121 ok(ref
== 3, "Got refcount %d, expected 3\n", ref
);
123 /* Palette starts with 1 */
124 ref
= getRefcount( (IUnknown
*) palette
);
125 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
127 /* Test attaching a palette to a surface */
128 hr
= IDirectDrawSurface7_SetPalette(surface
, palette
);
129 ok(hr
== DD_OK
, "IDirectDrawSurface_SetPalette failed with %08x\n", hr
);
131 /* Palette refcount increased, surface stays the same */
132 ref
= getRefcount( (IUnknown
*) palette
);
133 ok(ref
== 2, "Got refcount %d, expected 2\n", ref
);
134 ref
= getRefcount( (IUnknown
*) surface
);
135 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
137 IDirectDrawSurface7_Release(surface
);
138 /* Increased before - decrease now */
139 ref
= getRefcount( (IUnknown
*) DDraw7
);
140 ok(ref
== 2, "Got refcount %d, expected 2\n", ref
);
142 /* Releasing the surface detaches the palette */
143 ref
= getRefcount( (IUnknown
*) palette
);
144 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
146 IDirectDrawPalette_Release(palette
);
148 /* Increased before - decrease now */
149 ref
= getRefcount( (IUnknown
*) DDraw7
);
150 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
152 /* Not all interfaces are AddRefed when a palette is created */
153 hr
= IDirectDraw4_CreatePalette(DDraw4
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
154 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
155 ref
= getRefcount( (IUnknown
*) DDraw4
);
156 ok(ref
== 2, "Got refcount %d, expected 2\n", ref
);
157 IDirectDrawPalette_Release(palette
);
160 hr
= IDirectDraw2_CreatePalette(DDraw2
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
161 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
162 ref
= getRefcount( (IUnknown
*) DDraw2
);
163 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
164 IDirectDrawPalette_Release(palette
);
167 hr
= IDirectDraw_CreatePalette(DDraw1
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
168 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
169 ref
= getRefcount( (IUnknown
*) DDraw1
);
170 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
171 IDirectDrawPalette_Release(palette
);
173 /* Similar for surfaces */
174 hr
= IDirectDraw4_CreateSurface(DDraw4
, &ddsd
, &surface4
, NULL
);
175 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
176 ref
= getRefcount( (IUnknown
*) DDraw4
);
177 ok(ref
== 2, "Got refcount %d, expected 2\n", ref
);
178 IDirectDrawSurface4_Release(surface4
);
180 ddsd
.dwSize
= sizeof(DDSURFACEDESC
);
181 hr
= IDirectDraw2_CreateSurface(DDraw2
, (DDSURFACEDESC
*) &ddsd
, &surface1
, NULL
);
182 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
183 ref
= getRefcount( (IUnknown
*) DDraw2
);
184 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
185 IDirectDrawSurface_Release(surface1
);
187 hr
= IDirectDraw_CreateSurface(DDraw1
, (DDSURFACEDESC
*) &ddsd
, &surface1
, NULL
);
188 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
189 ref
= getRefcount( (IUnknown
*) DDraw1
);
190 ok(ref
== 1, "Got refcount %d, expected 1\n", ref
);
191 IDirectDrawSurface_Release(surface1
);
193 IDirectDraw7_Release(DDraw7
);
194 IDirectDraw4_Release(DDraw4
);
195 IDirectDraw2_Release(DDraw2
);
196 IDirectDraw_Release(DDraw1
);
199 static void test_iface_refcnt(void)
203 IDirectDraw2
*DDraw2
;
204 IDirectDraw4
*DDraw4
;
205 IDirectDraw7
*DDraw7
;
212 hr
= pDirectDrawCreateEx(NULL
, (void **) &DDraw7
, &IID_IDirectDraw7
, NULL
);
213 ok(hr
== DD_OK
|| hr
==DDERR_NODIRECTDRAWSUPPORT
, "DirectDrawCreateEx returned: %x\n", hr
);
216 trace("Couldn't create DDraw interface, skipping tests\n");
220 ref
= getRefcount( (IUnknown
*) DDraw7
);
221 ok(ref
== 1, "Initial IDirectDraw7 reference count is %ld\n", ref
);
223 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw4
, (void **) &DDraw4
);
224 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
225 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw2
, (void **) &DDraw2
);
226 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterf&ace returned %08x\n", hr
);
227 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw
, (void **) &DDraw1
);
228 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
230 /* All interfaces now have refcount 1! */
231 ref
= getRefcount( (IUnknown
*) DDraw7
);
232 ok(ref
== 1, "IDirectDraw7 reference count is %ld\n", ref
);
233 ref
= getRefcount( (IUnknown
*) DDraw7
);
234 ok(ref
== 1, "IDirectDraw7 reference count is %ld\n", ref
);
235 ref
= getRefcount( (IUnknown
*) DDraw4
);
236 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
237 ref
= getRefcount( (IUnknown
*) DDraw2
);
238 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
239 ref
= getRefcount( (IUnknown
*) DDraw1
);
240 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
242 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D7
, (void **) &D3D7
);
243 ok(hr
== DD_OK
|| hr
== E_NOINTERFACE
, /* win64 */
244 "IDirectDraw7_QueryInterface returned %08x\n", hr
);
247 IDirectDraw7_Release(DDraw7
);
248 IDirectDraw4_Release(DDraw4
);
249 IDirectDraw2_Release(DDraw2
);
250 IDirectDraw_Release(DDraw1
);
251 skip( "no IDirect3D7 support\n" );
255 /* Apparently IDirectDrawX and IDirect3DX are linked together */
256 ref
= getRefcount( (IUnknown
*) D3D7
);
257 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
);
258 ref
= getRefcount( (IUnknown
*) DDraw7
);
259 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
);
261 IDirectDraw7_AddRef(DDraw7
);
262 ref
= getRefcount( (IUnknown
*) D3D7
);
263 ok(ref
== 3, "IDirect3D7 reference count is %ld\n", ref
);
264 ref
= getRefcount( (IUnknown
*) DDraw7
);
265 ok(ref
== 3, "IDirectDraw7 reference count is %ld\n", ref
);
267 IDirect3D7_Release(D3D7
);
268 ref
= getRefcount( (IUnknown
*) D3D7
);
269 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
);
270 ref
= getRefcount( (IUnknown
*) DDraw7
);
271 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
);
273 /* Can't get older d3d interfaces. WHY????? */
274 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D3
, (void **) &D3D3
);
275 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
276 if(hr
== DD_OK
&& D3D3
) IDirect3D3_Release(D3D3
);
278 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
279 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
280 if(hr
== DD_OK
&& D3D3
) IDirect3D3_Release(D3D3
);
282 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D2
, (void **) &D3D2
);
283 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
284 if(hr
== DD_OK
&& D3D2
) IDirect3D2_Release(D3D2
);
286 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D2
, (void **) &D3D2
);
287 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
288 if(hr
== DD_OK
&& D3D2
) IDirect3D2_Release(D3D2
);
290 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D
, (void **) &D3D1
);
291 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
292 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
294 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D
, (void **) &D3D1
);
295 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
296 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
298 hr
= IDirect3D7_QueryInterface(D3D7
, &IID_IDirect3D
, (void **) &D3D1
);
299 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirect3D7_QueryInterface returned %08x\n", hr
);
300 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
302 /* Try an AddRef, it only affects the AddRefed interface */
303 IDirectDraw4_AddRef(DDraw4
);
304 ref
= getRefcount( (IUnknown
*) DDraw7
);
305 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
); /* <-- From the d3d query */
306 ref
= getRefcount( (IUnknown
*) DDraw4
);
307 ok(ref
== 2, "IDirectDraw4 reference count is %ld\n", ref
); /* <-- The AddRef call */
308 ref
= getRefcount( (IUnknown
*) DDraw2
);
309 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
310 ref
= getRefcount( (IUnknown
*) DDraw1
);
311 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
312 ref
= getRefcount( (IUnknown
*) D3D7
);
313 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
); /* <-- From the d3d query */
314 IDirectDraw4_Release(DDraw4
);
316 /* Make sure that they are one object, not different ones */
317 hr
= IDirectDraw4_SetCooperativeLevel(DDraw4
, GetDesktopWindow(), DDSCL_EXCLUSIVE
| DDSCL_FULLSCREEN
);
318 ok(hr
== DD_OK
, "IDirectDraw4::SetCooperativeLevel returned %08x\n", hr
);
319 /* After an window has been set, DDSCL_SETFOCUSWINDOW should return DDERR_HWNDALREADYSET, see the mode test */
320 hr
= IDirectDraw7_SetCooperativeLevel(DDraw7
, NULL
, DDSCL_SETFOCUSWINDOW
);
321 ok(hr
== DDERR_HWNDALREADYSET
, "IDirectDraw7::SetCooperativeLevel returned %08x\n", hr
);
323 /* All done, release all interfaces */
324 IDirectDraw7_Release(DDraw7
);
325 IDirectDraw4_Release(DDraw4
);
326 IDirectDraw2_Release(DDraw2
);
327 IDirectDraw_Release(DDraw1
);
328 IDirect3D7_Release(D3D7
);
331 static void test_d3d_ifaces(void)
334 IDirectDraw2
*DDraw2
;
335 IDirectDraw4
*DDraw4
;
343 hr
= DirectDrawCreate(NULL
, &DDraw1
, NULL
);
344 ok(hr
== DD_OK
|| hr
==DDERR_NODIRECTDRAWSUPPORT
, "DirectDrawCreateEx returned: %x\n", hr
);
347 trace("DirectDrawCreate failed with %08x\n", hr
);
351 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirectDraw2
, (void **) &DDraw2
);
352 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
353 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirectDraw4
, (void **) &DDraw4
);
354 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
356 ref
= getRefcount( (IUnknown
*) DDraw4
);
357 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
358 ref
= getRefcount( (IUnknown
*) DDraw2
);
359 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
360 ref
= getRefcount( (IUnknown
*) DDraw1
);
361 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
363 /* FIXME: This test suggests that IDirect3D, IDirect3D2 and IDirect3D3 are linked
364 * to IDirectDraw. However, they are linked to whatever interface is used to QI the
365 * first IDirect3D? interface. If DDraw1 is replaced with DDraw4 here the tests break */
366 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D
, (void **) &D3D1
);
367 if (hr
== E_NOINTERFACE
) /* win64 */
369 IDirectDraw4_Release(DDraw4
);
370 IDirectDraw2_Release(DDraw2
);
371 IDirectDraw_Release(DDraw1
);
372 skip( "no IDirect3D support\n" );
375 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
376 ref
= getRefcount( (IUnknown
*) DDraw4
);
377 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
378 ref
= getRefcount( (IUnknown
*) DDraw2
);
379 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
380 ref
= getRefcount( (IUnknown
*) DDraw1
);
381 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
382 IDirect3D_Release(D3D1
);
384 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D2
, (void **) &D3D2
);
385 ok(hr
== DD_OK
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
386 ref
= getRefcount( (IUnknown
*) DDraw4
);
387 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
388 ref
= getRefcount( (IUnknown
*) DDraw2
);
389 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
390 ref
= getRefcount( (IUnknown
*) DDraw1
);
391 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
392 IDirect3D2_Release(D3D2
);
394 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
395 ok(hr
== DD_OK
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
396 ref
= getRefcount( (IUnknown
*) DDraw4
);
397 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
398 ref
= getRefcount( (IUnknown
*) DDraw2
);
399 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
400 ref
= getRefcount( (IUnknown
*) DDraw1
);
401 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
402 IDirect3D3_Release(D3D3
);
404 /* Try to AddRef the D3D3 interface that has been released already */
405 IDirect3D3_AddRef(D3D3
);
406 ref
= getRefcount( (IUnknown
*) DDraw1
);
407 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
408 ref
= getRefcount( (IUnknown
*) D3D3
);
409 ok(ref
== 2, "IDirect3D3 reference count is %ld\n", ref
);
410 /* The newer interfaces remain untouched */
411 ref
= getRefcount( (IUnknown
*) DDraw4
);
412 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
413 ref
= getRefcount( (IUnknown
*) DDraw2
);
414 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
415 IDirect3D3_Release(D3D3
);
416 ref
= getRefcount( (IUnknown
*) DDraw1
);
417 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
418 ref
= getRefcount( (IUnknown
*) DDraw1
);
419 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
421 /* It is possible to query any IDirect3D interfaces from any IDirectDraw interface,
422 * Except IDirect3D7, it can only be returned by IDirectDraw7(which can't return older ifaces)
424 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D
, (void **) &D3D1
);
425 ok(hr
== DD_OK
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
426 IDirect3D_Release(D3D1
);
427 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D
, (void **) &D3D1
);
428 ok(hr
== DD_OK
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
429 IDirect3D_Release(D3D1
);
431 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D2
, (void **) &D3D2
);
432 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
433 IDirect3D_Release(D3D2
);
434 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D2
, (void **) &D3D2
);
435 ok(hr
== DD_OK
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
436 IDirect3D_Release(D3D2
);
438 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D3
, (void **) &D3D3
);
439 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
440 IDirect3D_Release(D3D3
);
441 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D3
, (void **) &D3D3
);
442 ok(hr
== DD_OK
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
443 IDirect3D_Release(D3D3
);
445 /* This does NOT work */
446 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D7
, (void **) &D3D7
);
447 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
448 if(D3D7
) IDirect3D_Release(D3D7
);
449 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D7
, (void **) &D3D7
);
450 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
451 if(D3D7
) IDirect3D_Release(D3D7
);
452 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D7
, (void **) &D3D7
);
453 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
454 if(D3D7
) IDirect3D_Release(D3D7
);
456 /* Release the interfaces */
457 IDirectDraw4_Release(DDraw4
);
458 IDirectDraw2_Release(DDraw2
);
459 IDirectDraw_Release(DDraw1
);
464 init_function_pointers();
465 if(!pDirectDrawCreateEx
)
467 win_skip("function DirectDrawCreateEx not available\n");
470 test_ddraw_objects();