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
;
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
);
97 ok(hr
== DD_OK
, "CreateSurface failed with %08x\n", hr
);
99 /* DDraw refcount increased by 1 */
100 ref
= getRefcount( (IUnknown
*) DDraw7
);
101 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
103 /* Surface refcount starts with 1 */
104 ref
= getRefcount( (IUnknown
*) surface
);
105 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
107 hr
= IDirectDraw7_CreatePalette(DDraw7
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
108 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
110 /* DDraw refcount increased by 1 */
111 ref
= getRefcount( (IUnknown
*) DDraw7
);
112 ok(ref
== 3, "Got refcount %ld, expected 3\n", ref
);
114 /* Palette starts with 1 */
115 ref
= getRefcount( (IUnknown
*) palette
);
116 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
118 /* Test attaching a palette to a surface */
119 hr
= IDirectDrawSurface7_SetPalette(surface
, palette
);
120 ok(hr
== DD_OK
, "IDirectDrawSurface_SetPalette failed with %08x\n", hr
);
122 /* Palette refcount increased, surface stays the same */
123 ref
= getRefcount( (IUnknown
*) palette
);
124 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
125 ref
= getRefcount( (IUnknown
*) surface
);
126 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
128 IDirectDrawSurface7_Release(surface
);
129 /* Increased before - decrease now */
130 ref
= getRefcount( (IUnknown
*) DDraw7
);
131 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
133 /* Releasing the surface detaches the palette */
134 ref
= getRefcount( (IUnknown
*) palette
);
135 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
137 IDirectDrawPalette_Release(palette
);
139 /* Increased before - decrease now */
140 ref
= getRefcount( (IUnknown
*) DDraw7
);
141 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
143 /* Not all interfaces are AddRefed when a palette is created */
144 hr
= IDirectDraw4_CreatePalette(DDraw4
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
145 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
146 ref
= getRefcount( (IUnknown
*) DDraw4
);
147 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
148 IDirectDrawPalette_Release(palette
);
151 hr
= IDirectDraw2_CreatePalette(DDraw2
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
152 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
153 ref
= getRefcount( (IUnknown
*) DDraw2
);
154 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
155 IDirectDrawPalette_Release(palette
);
158 hr
= IDirectDraw_CreatePalette(DDraw1
, DDPCAPS_ALLOW256
| DDPCAPS_8BIT
, Table
, &palette
, NULL
);
159 ok(hr
== DD_OK
, "CreatePalette returned %08x\n", hr
);
160 ref
= getRefcount( (IUnknown
*) DDraw1
);
161 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
162 IDirectDrawPalette_Release(palette
);
164 /* Similar for surfaces */
165 hr
= IDirectDraw4_CreateSurface(DDraw4
, &ddsd
, &surface4
, NULL
);
166 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
167 ref
= getRefcount( (IUnknown
*) DDraw4
);
168 ok(ref
== 2, "Got refcount %ld, expected 2\n", ref
);
169 IDirectDrawSurface4_Release(surface4
);
171 ddsd
.dwSize
= sizeof(DDSURFACEDESC
);
172 hr
= IDirectDraw2_CreateSurface(DDraw2
, (DDSURFACEDESC
*) &ddsd
, &surface1
, NULL
);
173 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
174 ref
= getRefcount( (IUnknown
*) DDraw2
);
175 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
176 IDirectDrawSurface_Release(surface1
);
178 hr
= IDirectDraw_CreateSurface(DDraw1
, (DDSURFACEDESC
*) &ddsd
, &surface1
, NULL
);
179 ok(hr
== DD_OK
, "CreateSurface returned %08x\n", hr
);
180 ref
= getRefcount( (IUnknown
*) DDraw1
);
181 ok(ref
== 1, "Got refcount %ld, expected 1\n", ref
);
182 IDirectDrawSurface_Release(surface1
);
184 IDirectDraw7_Release(DDraw7
);
185 IDirectDraw4_Release(DDraw4
);
186 IDirectDraw2_Release(DDraw2
);
187 IDirectDraw_Release(DDraw1
);
190 static void test_iface_refcnt(void)
194 IDirectDraw2
*DDraw2
;
195 IDirectDraw4
*DDraw4
;
196 IDirectDraw7
*DDraw7
;
203 hr
= pDirectDrawCreateEx(NULL
, (void **) &DDraw7
, &IID_IDirectDraw7
, NULL
);
204 ok(hr
== DD_OK
|| hr
==DDERR_NODIRECTDRAWSUPPORT
, "DirectDrawCreateEx returned: %x\n", hr
);
207 trace("Couldn't create DDraw interface, skipping tests\n");
211 ref
= getRefcount( (IUnknown
*) DDraw7
);
212 ok(ref
== 1, "Initial IDirectDraw7 reference count is %ld\n", ref
);
214 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw4
, (void **) &DDraw4
);
215 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
216 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw2
, (void **) &DDraw2
);
217 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterf&ace returned %08x\n", hr
);
218 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirectDraw
, (void **) &DDraw1
);
219 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
221 /* All interfaces now have refcount 1! */
222 ref
= getRefcount( (IUnknown
*) DDraw7
);
223 ok(ref
== 1, "IDirectDraw7 reference count is %ld\n", ref
);
224 ref
= getRefcount( (IUnknown
*) DDraw7
);
225 ok(ref
== 1, "IDirectDraw7 reference count is %ld\n", ref
);
226 ref
= getRefcount( (IUnknown
*) DDraw4
);
227 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
228 ref
= getRefcount( (IUnknown
*) DDraw2
);
229 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
230 ref
= getRefcount( (IUnknown
*) DDraw1
);
231 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
233 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D7
, (void **) &D3D7
);
234 ok(hr
== DD_OK
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
236 /* Apparently IDirectDrawX and IDirect3DX are linked together */
237 ref
= getRefcount( (IUnknown
*) D3D7
);
238 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
);
239 ref
= getRefcount( (IUnknown
*) DDraw7
);
240 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
);
242 IDirectDraw7_AddRef(DDraw7
);
243 ref
= getRefcount( (IUnknown
*) D3D7
);
244 ok(ref
== 3, "IDirect3D7 reference count is %ld\n", ref
);
245 ref
= getRefcount( (IUnknown
*) DDraw7
);
246 ok(ref
== 3, "IDirectDraw7 reference count is %ld\n", ref
);
248 IDirect3D7_Release(D3D7
);
249 ref
= getRefcount( (IUnknown
*) D3D7
);
250 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
);
251 ref
= getRefcount( (IUnknown
*) DDraw7
);
252 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
);
254 /* Can't get older d3d interfaces. WHY????? */
255 hr
= IDirectDraw7_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
256 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
257 if(hr
== DD_OK
&& D3D3
) IDirect3D3_Release(D3D3
);
259 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
260 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
261 if(hr
== DD_OK
&& D3D3
) IDirect3D3_Release(D3D3
);
263 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D2
, (void **) &D3D2
);
264 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
265 if(hr
== DD_OK
&& D3D2
) IDirect3D2_Release(D3D2
);
267 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D2
, (void **) &D3D2
);
268 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
269 if(hr
== DD_OK
&& D3D2
) IDirect3D2_Release(D3D2
);
271 hr
= IDirectDraw7_QueryInterface(DDraw7
, &IID_IDirect3D
, (void **) &D3D1
);
272 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw7_QueryInterface returned %08x\n", hr
);
273 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
275 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D
, (void **) &D3D1
);
276 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
277 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
279 hr
= IDirect3D7_QueryInterface(D3D7
, &IID_IDirect3D
, (void **) &D3D1
);
280 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirect3D7_QueryInterface returned %08x\n", hr
);
281 if(hr
== DD_OK
&& D3D1
) IDirect3D_Release(D3D1
);
283 /* Try an AddRef, it only affects the AddRefed interface */
284 IDirectDraw4_AddRef(DDraw4
);
285 ref
= getRefcount( (IUnknown
*) DDraw7
);
286 ok(ref
== 2, "IDirectDraw7 reference count is %ld\n", ref
); /* <-- From the d3d query */
287 ref
= getRefcount( (IUnknown
*) DDraw4
);
288 ok(ref
== 2, "IDirectDraw4 reference count is %ld\n", ref
); /* <-- The AddRef call */
289 ref
= getRefcount( (IUnknown
*) DDraw2
);
290 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
291 ref
= getRefcount( (IUnknown
*) DDraw1
);
292 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
293 ref
= getRefcount( (IUnknown
*) D3D7
);
294 ok(ref
== 2, "IDirect3D7 reference count is %ld\n", ref
); /* <-- From the d3d query */
295 IDirectDraw4_Release(DDraw4
);
297 /* Make sure that they are one object, not different ones */
298 hr
= IDirectDraw4_SetCooperativeLevel(DDraw4
, GetDesktopWindow(), DDSCL_EXCLUSIVE
| DDSCL_FULLSCREEN
);
299 ok(hr
== DD_OK
, "IDirectDraw4::SetCooperativeLevel returned %08x\n", hr
);
300 /* After an window has been set, DDSCL_SETFOCUSWINDOW should return DDERR_HWNDALREADYSET, see the mode test */
301 hr
= IDirectDraw7_SetCooperativeLevel(DDraw7
, NULL
, DDSCL_SETFOCUSWINDOW
);
302 ok(hr
== DDERR_HWNDALREADYSET
, "IDirectDraw7::SetCooperativeLevel returned %08x\n", hr
);
304 /* All done, release all interfaces */
305 IDirectDraw7_Release(DDraw7
);
306 IDirectDraw4_Release(DDraw4
);
307 IDirectDraw2_Release(DDraw2
);
308 IDirectDraw_Release(DDraw1
);
309 IDirect3D7_Release(D3D7
);
312 static void test_d3d_ifaces(void)
315 IDirectDraw2
*DDraw2
;
316 IDirectDraw4
*DDraw4
;
324 hr
= DirectDrawCreate(NULL
, &DDraw1
, NULL
);
325 ok(hr
== DD_OK
|| hr
==DDERR_NODIRECTDRAWSUPPORT
, "DirectDrawCreateEx returned: %x\n", hr
);
328 trace("DirectDrawCreate failed with %08x\n", hr
);
332 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirectDraw2
, (void **) &DDraw2
);
333 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
334 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirectDraw4
, (void **) &DDraw4
);
335 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
337 ref
= getRefcount( (IUnknown
*) DDraw4
);
338 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
339 ref
= getRefcount( (IUnknown
*) DDraw2
);
340 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
341 ref
= getRefcount( (IUnknown
*) DDraw1
);
342 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
344 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D
, (void **) &D3D1
);
345 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
346 ref
= getRefcount( (IUnknown
*) DDraw4
);
347 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
348 ref
= getRefcount( (IUnknown
*) DDraw2
);
349 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
350 ref
= getRefcount( (IUnknown
*) DDraw1
);
351 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
352 IDirect3D_Release(D3D1
);
354 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D2
, (void **) &D3D2
);
355 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
== 2, "IDirectDraw reference count is %ld\n", ref
);
362 IDirect3D2_Release(D3D2
);
364 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D3
, (void **) &D3D3
);
365 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
366 ref
= getRefcount( (IUnknown
*) DDraw4
);
367 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
368 ref
= getRefcount( (IUnknown
*) DDraw2
);
369 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
370 ref
= getRefcount( (IUnknown
*) DDraw1
);
371 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
372 IDirect3D3_Release(D3D3
);
374 /* Try to AddRef the D3D3 interface that has been released already */
375 IDirect3D3_AddRef(D3D3
);
376 ref
= getRefcount( (IUnknown
*) DDraw1
);
377 ok(ref
== 2, "IDirectDraw reference count is %ld\n", ref
);
378 ref
= getRefcount( (IUnknown
*) D3D3
);
379 ok(ref
== 2, "IDirect3D3 reference count is %ld\n", ref
);
380 /* The newer interfaces remain untouched */
381 ref
= getRefcount( (IUnknown
*) DDraw4
);
382 ok(ref
== 1, "IDirectDraw4 reference count is %ld\n", ref
);
383 ref
= getRefcount( (IUnknown
*) DDraw2
);
384 ok(ref
== 1, "IDirectDraw2 reference count is %ld\n", ref
);
385 IDirect3D3_Release(D3D3
);
386 ref
= getRefcount( (IUnknown
*) DDraw1
);
387 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
388 ref
= getRefcount( (IUnknown
*) DDraw1
);
389 ok(ref
== 1, "IDirectDraw reference count is %ld\n", ref
);
391 /* It is possible to query any IDirect3D interfaces from any IDirectDraw interface,
392 * Except IDirect3D7, it can only be returned by IDirectDraw7(which can't return older ifaces)
394 hr
= IDirectDraw_QueryInterface(DDraw2
, &IID_IDirect3D
, (void **) &D3D1
);
395 ok(hr
== DD_OK
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
396 IDirect3D_Release(D3D1
);
397 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D
, (void **) &D3D1
);
398 ok(hr
== DD_OK
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
399 IDirect3D_Release(D3D1
);
401 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D2
, (void **) &D3D2
);
402 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
403 IDirect3D_Release(D3D2
);
404 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D2
, (void **) &D3D2
);
405 ok(hr
== DD_OK
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
406 IDirect3D_Release(D3D2
);
408 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D3
, (void **) &D3D3
);
409 ok(hr
== DD_OK
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
410 IDirect3D_Release(D3D3
);
411 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D3
, (void **) &D3D3
);
412 ok(hr
== DD_OK
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
413 IDirect3D_Release(D3D3
);
415 /* This does NOT work */
416 hr
= IDirectDraw_QueryInterface(DDraw1
, &IID_IDirect3D7
, (void **) &D3D7
);
417 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw_QueryInterface returned %08x\n", hr
);
418 if(D3D7
) IDirect3D_Release(D3D7
);
419 hr
= IDirectDraw2_QueryInterface(DDraw2
, &IID_IDirect3D7
, (void **) &D3D7
);
420 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw2_QueryInterface returned %08x\n", hr
);
421 if(D3D7
) IDirect3D_Release(D3D7
);
422 hr
= IDirectDraw4_QueryInterface(DDraw4
, &IID_IDirect3D7
, (void **) &D3D7
);
423 todo_wine
ok(hr
== E_NOINTERFACE
, "IDirectDraw4_QueryInterface returned %08x\n", hr
);
424 if(D3D7
) IDirect3D_Release(D3D7
);
426 /* Release the interfaces */
427 IDirectDraw4_Release(DDraw4
);
428 IDirectDraw2_Release(DDraw2
);
429 IDirectDraw_Release(DDraw1
);
434 init_function_pointers();
435 if(!pDirectDrawCreateEx
)
437 skip("function DirectDrawCreateEx not available\n");
440 test_ddraw_objects();