d3dx8: Add WINAPI to the prototypes of D3DXMatrixTransformation.
[wine/multimedia.git] / dlls / ddraw / ddraw_thunks.c
blobb748ad4798553dad7356a5e197d48c81c79d2793
1 /* Direct Draw Thunks and old vtables
2 * Copyright 2000 TransGaming Technologies Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
20 #include "wine/port.h"
22 #include <assert.h>
23 #include <stdarg.h>
24 #include <string.h>
25 #include <stdlib.h>
27 #define COBJMACROS
28 #define NONAMELESSUNION
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winerror.h"
33 #include "wingdi.h"
34 #include "wine/exception.h"
36 #include "ddraw.h"
37 #include "d3d.h"
39 #include "ddraw_private.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(ddraw_thunk);
43 WINE_DECLARE_DEBUG_CHANNEL(ddraw);
45 static HRESULT WINAPI
46 IDirectDrawImpl_QueryInterface(LPDIRECTDRAW This, REFIID iid, LPVOID *ppObj)
48 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
49 IDirectDraw,
50 IDirectDraw7, This),
51 iid, ppObj);
54 static HRESULT WINAPI
55 IDirectDraw2Impl_QueryInterface(LPDIRECTDRAW2 This, REFIID iid, LPVOID *ppObj)
57 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
58 IDirectDraw2,
59 IDirectDraw7, This),
60 iid, ppObj);
63 static HRESULT WINAPI
64 IDirectDraw3Impl_QueryInterface(LPDIRECTDRAW3 This, REFIID iid, LPVOID *ppObj)
66 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
67 IDirectDraw3,
68 IDirectDraw7, This),
69 iid, ppObj);
72 static HRESULT WINAPI
73 IDirectDraw4Impl_QueryInterface(LPDIRECTDRAW4 This, REFIID iid, LPVOID *ppObj)
75 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
76 IDirectDraw4,
77 IDirectDraw7, This),
78 iid, ppObj);
81 static ULONG WINAPI
82 IDirectDrawImpl_AddRef(LPDIRECTDRAW iface)
84 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
85 ULONG ref = InterlockedIncrement(&This->ref1);
87 TRACE("(%p) : incrementing IDirectDraw refcount from %u.\n", This, ref -1);
89 if(ref == 1) InterlockedIncrement(&This->numIfaces);
91 return ref;
94 static ULONG WINAPI
95 IDirectDraw2Impl_AddRef(LPDIRECTDRAW2 iface)
97 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
98 ULONG ref = InterlockedIncrement(&This->ref2);
100 TRACE("(%p) : incrementing IDirectDraw2 refcount from %u.\n", This, ref -1);
102 if(ref == 1) InterlockedIncrement(&This->numIfaces);
104 return ref;
107 static ULONG WINAPI
108 IDirectDraw3Impl_AddRef(LPDIRECTDRAW3 iface)
110 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
111 ULONG ref = InterlockedIncrement(&This->ref3);
113 TRACE("(%p) : incrementing IDirectDraw3 refcount from %u.\n", This, ref -1);
115 if(ref == 1) InterlockedIncrement(&This->numIfaces);
117 return ref;
120 static ULONG WINAPI
121 IDirectDraw4Impl_AddRef(LPDIRECTDRAW4 iface)
123 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
124 ULONG ref = InterlockedIncrement(&This->ref4);
126 TRACE("(%p) : incrementing IDirectDraw4 refcount from %u.\n", This, ref -1);
128 if(ref == 1) InterlockedIncrement(&This->numIfaces);
130 return ref;
133 static ULONG WINAPI
134 IDirectDrawImpl_Release(LPDIRECTDRAW iface)
136 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
137 ULONG ref = InterlockedDecrement(&This->ref1);
139 TRACE_(ddraw)("(%p)->() decrementing IDirectDraw refcount from %u.\n", This, ref +1);
141 if(ref == 0)
143 ULONG ifacecount = InterlockedDecrement(&This->numIfaces);
144 if(ifacecount == 0) IDirectDrawImpl_Destroy(This);
147 return ref;
150 static ULONG WINAPI
151 IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface)
153 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
154 ULONG ref = InterlockedDecrement(&This->ref2);
156 TRACE_(ddraw)("(%p)->() decrementing IDirectDraw2 refcount from %u.\n", This, ref +1);
158 if(ref == 0)
160 ULONG ifacecount = InterlockedDecrement(&This->numIfaces);
161 if(ifacecount == 0) IDirectDrawImpl_Destroy(This);
164 return ref;
167 static ULONG WINAPI
168 IDirectDraw3Impl_Release(LPDIRECTDRAW3 iface)
170 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
171 ULONG ref = InterlockedDecrement(&This->ref3);
173 TRACE_(ddraw)("(%p)->() decrementing IDirectDraw3 refcount from %u.\n", This, ref +1);
175 if(ref == 0)
177 ULONG ifacecount = InterlockedDecrement(&This->numIfaces);
178 if(ifacecount == 0) IDirectDrawImpl_Destroy(This);
181 return ref;
184 static ULONG WINAPI
185 IDirectDraw4Impl_Release(LPDIRECTDRAW4 iface)
187 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
188 ULONG ref = InterlockedDecrement(&This->ref4);
190 TRACE_(ddraw)("(%p)->() decrementing IDirectDraw4 refcount from %u.\n", This, ref +1);
192 if(ref == 0)
194 ULONG ifacecount = InterlockedDecrement(&This->numIfaces);
195 if(ifacecount == 0) IDirectDrawImpl_Destroy(This);
198 return ref;
201 static HRESULT WINAPI
202 IDirectDrawImpl_Compact(LPDIRECTDRAW This)
204 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
205 IDirectDraw, IDirectDraw7,
206 This));
209 static HRESULT WINAPI
210 IDirectDraw2Impl_Compact(LPDIRECTDRAW2 This)
212 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
213 IDirectDraw2, IDirectDraw7,
214 This));
217 static HRESULT WINAPI
218 IDirectDraw3Impl_Compact(LPDIRECTDRAW3 This)
220 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
221 IDirectDraw3, IDirectDraw7,
222 This));
225 static HRESULT WINAPI
226 IDirectDraw4Impl_Compact(LPDIRECTDRAW4 This)
228 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
229 IDirectDraw4, IDirectDraw7,
230 This));
233 static HRESULT WINAPI
234 IDirectDrawImpl_CreateClipper(LPDIRECTDRAW This, DWORD dwFlags,
235 LPDIRECTDRAWCLIPPER *ppClipper,
236 IUnknown *pUnkOuter)
238 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
239 IDirectDraw,
240 IDirectDraw7,
241 This),
242 dwFlags, ppClipper, pUnkOuter);
245 static HRESULT WINAPI
246 IDirectDraw2Impl_CreateClipper(LPDIRECTDRAW2 This, DWORD dwFlags,
247 LPDIRECTDRAWCLIPPER *ppClipper,
248 IUnknown *pUnkOuter)
250 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
251 IDirectDraw2,
252 IDirectDraw7,
253 This),
254 dwFlags, ppClipper, pUnkOuter);
257 static HRESULT WINAPI
258 IDirectDraw3Impl_CreateClipper(LPDIRECTDRAW3 This, DWORD dwFlags,
259 LPDIRECTDRAWCLIPPER *ppClipper,
260 IUnknown *pUnkOuter)
262 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
263 IDirectDraw3,
264 IDirectDraw7,
265 This),
266 dwFlags, ppClipper, pUnkOuter);
269 static HRESULT WINAPI
270 IDirectDraw4Impl_CreateClipper(LPDIRECTDRAW4 This, DWORD dwFlags,
271 LPDIRECTDRAWCLIPPER *ppClipper,
272 IUnknown *pUnkOuter)
274 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
275 IDirectDraw4,
276 IDirectDraw7,
277 This),
278 dwFlags, ppClipper, pUnkOuter);
281 static HRESULT WINAPI
282 IDirectDrawImpl_CreatePalette(LPDIRECTDRAW This, DWORD dwFlags,
283 LPPALETTEENTRY pEntries,
284 LPDIRECTDRAWPALETTE *ppPalette,
285 IUnknown *pUnkOuter)
287 HRESULT hr;
288 hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
289 IDirectDraw,
290 IDirectDraw7,
291 This),
292 dwFlags, pEntries, ppPalette, pUnkOuter);
293 if(SUCCEEDED(hr) && *ppPalette)
295 IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette);
296 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
297 IDirectDraw,
298 IDirectDraw7,
299 This));
300 impl->ifaceToRelease = NULL;
303 return hr;
306 static HRESULT WINAPI
307 IDirectDraw2Impl_CreatePalette(LPDIRECTDRAW2 This, DWORD dwFlags,
308 LPPALETTEENTRY pEntries,
309 LPDIRECTDRAWPALETTE *ppPalette,
310 IUnknown *pUnkOuter)
312 HRESULT hr;
313 hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
314 IDirectDraw2,
315 IDirectDraw7,
316 This),
317 dwFlags, pEntries, ppPalette, pUnkOuter);
318 if(SUCCEEDED(hr) && *ppPalette)
320 IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette);
321 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
322 IDirectDraw2,
323 IDirectDraw7,
324 This));
325 impl->ifaceToRelease = NULL;
327 return hr;
330 static HRESULT WINAPI
331 IDirectDraw3Impl_CreatePalette(LPDIRECTDRAW3 This, DWORD dwFlags,
332 LPPALETTEENTRY pEntries,
333 LPDIRECTDRAWPALETTE *ppPalette,
334 IUnknown *pUnkOuter)
336 HRESULT hr;
337 hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
338 IDirectDraw3,
339 IDirectDraw7,
340 This),
341 dwFlags, pEntries, ppPalette, pUnkOuter);
342 if(SUCCEEDED(hr) && *ppPalette)
344 IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette);
345 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
346 IDirectDraw3,
347 IDirectDraw7,
348 This));
349 IDirectDraw4_AddRef(This);
350 impl->ifaceToRelease = (IUnknown *) This;
352 return hr;
355 static HRESULT WINAPI
356 IDirectDraw4Impl_CreatePalette(LPDIRECTDRAW4 This, DWORD dwFlags,
357 LPPALETTEENTRY pEntries,
358 LPDIRECTDRAWPALETTE *ppPalette,
359 IUnknown *pUnkOuter)
361 HRESULT hr;
362 hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
363 IDirectDraw4,
364 IDirectDraw7,
365 This),
366 dwFlags, pEntries, ppPalette, pUnkOuter);
367 if(SUCCEEDED(hr) && *ppPalette)
369 IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette);
370 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
371 IDirectDraw4,
372 IDirectDraw7,
373 This));
374 IDirectDraw4_AddRef(This);
375 impl->ifaceToRelease = (IUnknown *) This;
377 return hr;
380 static HRESULT WINAPI
381 IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
382 LPDIRECTDRAWSURFACE *ppSurface,
383 IUnknown *pUnkOuter)
385 LPDIRECTDRAWSURFACE7 pSurface7;
386 IDirectDrawSurfaceImpl *impl;
387 HRESULT hr;
389 /* Remove front buffer flag, this causes failure in v7, and its added to normal
390 * primaries anyway
392 pSDesc->ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
393 /* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok,
394 * since the data layout is the same */
395 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
396 IDirectDraw,
397 IDirectDraw7,
398 This),
399 (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
401 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
402 * IDirectDrawSurface vtable layout at the beginning */
403 *ppSurface = (LPDIRECTDRAWSURFACE) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
404 IDirectDrawSurface7, IDirectDrawSurface3,
405 pSurface7);
407 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
408 if(SUCCEEDED(hr) && impl)
410 impl->version = 1;
411 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
412 IDirectDraw,
413 IDirectDraw7,
414 This));
415 impl->ifaceToRelease = NULL;
418 return hr;
421 static HRESULT WINAPI
422 IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc,
423 LPDIRECTDRAWSURFACE *ppSurface,
424 IUnknown *pUnkOuter)
426 LPDIRECTDRAWSURFACE7 pSurface7;
427 IDirectDrawSurfaceImpl *impl;
428 HRESULT hr;
430 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
431 IDirectDraw2,
432 IDirectDraw7,
433 This),
434 (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
436 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
437 * IDirectDrawSurface vtable layout at the beginning */
438 *ppSurface = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
439 IDirectDrawSurface7, IDirectDrawSurface3,
440 pSurface7);
442 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
443 if(SUCCEEDED(hr) && impl)
445 impl->version = 2;
446 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
447 IDirectDraw2,
448 IDirectDraw7,
449 This));
450 impl->ifaceToRelease = NULL;
453 return hr;
456 static HRESULT WINAPI
457 IDirectDraw3Impl_CreateSurface(LPDIRECTDRAW3 This, LPDDSURFACEDESC pSDesc,
458 LPDIRECTDRAWSURFACE *ppSurface,
459 IUnknown *pUnkOuter)
461 LPDIRECTDRAWSURFACE7 pSurface7;
462 IDirectDrawSurfaceImpl *impl;
463 HRESULT hr;
465 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
466 IDirectDraw3,
467 IDirectDraw7,
468 This),
469 (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
471 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
472 * IDirectDrawSurface vtable layout at the beginning */
473 *ppSurface = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
474 IDirectDrawSurface7, IDirectDrawSurface3,
475 pSurface7);
477 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
478 if(SUCCEEDED(hr) && impl)
480 impl->version = 3;
481 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
482 IDirectDraw3,
483 IDirectDraw7,
484 This));
485 IDirectDraw3_AddRef(This);
486 impl->ifaceToRelease = (IUnknown *) This;
489 return hr;
492 static HRESULT WINAPI
493 IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc,
494 LPDIRECTDRAWSURFACE4 *ppSurface,
495 IUnknown *pUnkOuter)
497 HRESULT hr;
498 IDirectDrawSurfaceImpl *impl;
500 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
501 IDirectDraw4,
502 IDirectDraw7,
503 This),
504 pSDesc,
505 (LPDIRECTDRAWSURFACE7 *)ppSurface,
506 pUnkOuter);
507 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurface);
508 if(SUCCEEDED(hr) && impl)
510 impl->version = 4;
511 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
512 IDirectDraw4,
513 IDirectDraw7,
514 This));
515 IDirectDraw4_AddRef(This);
516 impl->ifaceToRelease = (IUnknown *) This;
518 return hr;
521 static HRESULT WINAPI
522 IDirectDrawImpl_DuplicateSurface(LPDIRECTDRAW This, LPDIRECTDRAWSURFACE pSrc,
523 LPDIRECTDRAWSURFACE *ppDst)
525 LPDIRECTDRAWSURFACE7 pDst7;
526 HRESULT hr;
528 hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
529 IDirectDraw,
530 IDirectDraw7, This),
531 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
532 IDirectDrawSurface3,
533 IDirectDrawSurface7,
534 pSrc),
535 &pDst7);
537 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
538 * IDirectDrawSurface vtable layout at the beginning */
539 *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
540 IDirectDrawSurface3, pDst7);
542 return hr;
545 static HRESULT WINAPI
546 IDirectDraw2Impl_DuplicateSurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE pSrc,
547 LPDIRECTDRAWSURFACE *ppDst)
549 LPDIRECTDRAWSURFACE7 pDst7;
550 HRESULT hr;
552 hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
553 IDirectDraw2,
554 IDirectDraw7, This),
555 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
556 IDirectDrawSurface3,
557 IDirectDrawSurface7,
558 pSrc),
559 &pDst7);
561 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
562 * IDirectDrawSurface vtable layout at the beginning */
563 *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
564 IDirectDrawSurface3, pDst7);
566 return hr;
569 static HRESULT WINAPI
570 IDirectDraw3Impl_DuplicateSurface(LPDIRECTDRAW3 This, LPDIRECTDRAWSURFACE pSrc,
571 LPDIRECTDRAWSURFACE *ppDst)
573 LPDIRECTDRAWSURFACE7 pDst7;
574 HRESULT hr;
576 hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
577 IDirectDraw3,
578 IDirectDraw7, This),
579 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
580 IDirectDrawSurface3,
581 IDirectDrawSurface7,
582 pSrc),
583 &pDst7);
585 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
586 * IDirectDrawSurface vtable layout at the beginning */
587 *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
588 IDirectDrawSurface3, pDst7);
590 return hr;
593 static HRESULT WINAPI
594 IDirectDraw4Impl_DuplicateSurface(LPDIRECTDRAW4 This,
595 LPDIRECTDRAWSURFACE4 pSrc,
596 LPDIRECTDRAWSURFACE4 *ppDst)
598 return IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
599 IDirectDraw4,
600 IDirectDraw7,
601 This),
602 (LPDIRECTDRAWSURFACE7)pSrc,
603 (LPDIRECTDRAWSURFACE7 *)ppDst);
606 struct displaymodescallback_context
608 LPDDENUMMODESCALLBACK func;
609 LPVOID context;
612 static HRESULT CALLBACK
613 EnumDisplayModesCallbackThunk(LPDDSURFACEDESC2 pDDSD2, LPVOID context)
615 DDSURFACEDESC DDSD;
616 struct displaymodescallback_context *cbcontext = context;
618 memcpy(&DDSD,pDDSD2,sizeof(DDSD));
619 DDSD.dwSize = sizeof(DDSD);
621 return cbcontext->func(&DDSD, cbcontext->context);
624 static HRESULT WINAPI
625 IDirectDrawImpl_EnumDisplayModes(LPDIRECTDRAW This, DWORD dwFlags,
626 LPDDSURFACEDESC pDDSD, LPVOID context,
627 LPDDENUMMODESCALLBACK cb)
629 struct displaymodescallback_context cbcontext;
631 cbcontext.func = cb;
632 cbcontext.context = context;
634 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
635 IDirectDraw,
636 IDirectDraw7,
637 This),
638 dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext,
639 EnumDisplayModesCallbackThunk);
642 static HRESULT WINAPI
643 IDirectDraw2Impl_EnumDisplayModes(LPDIRECTDRAW2 This, DWORD dwFlags,
644 LPDDSURFACEDESC pDDSD, LPVOID context,
645 LPDDENUMMODESCALLBACK cb)
647 struct displaymodescallback_context cbcontext;
649 cbcontext.func = cb;
650 cbcontext.context = context;
652 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
653 IDirectDraw2,
654 IDirectDraw7,
655 This),
656 dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext,
657 EnumDisplayModesCallbackThunk);
660 static HRESULT WINAPI
661 IDirectDraw3Impl_EnumDisplayModes(LPDIRECTDRAW3 This, DWORD dwFlags,
662 LPDDSURFACEDESC pDDSD, LPVOID context,
663 LPDDENUMMODESCALLBACK cb)
665 struct displaymodescallback_context cbcontext;
667 cbcontext.func = cb;
668 cbcontext.context = context;
670 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
671 IDirectDraw3,
672 IDirectDraw7,
673 This),
674 dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext,
675 EnumDisplayModesCallbackThunk);
678 static HRESULT WINAPI
679 IDirectDraw4Impl_EnumDisplayModes(LPDIRECTDRAW4 This, DWORD dwFlags,
680 LPDDSURFACEDESC2 pDDSD, LPVOID context,
681 LPDDENUMMODESCALLBACK2 cb)
683 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
684 IDirectDraw4,
685 IDirectDraw7,
686 This),
687 dwFlags, pDDSD, context, cb);
690 struct surfacescallback_context
692 LPDDENUMSURFACESCALLBACK func;
693 LPVOID context;
696 static HRESULT CALLBACK
697 EnumSurfacesCallbackThunk(LPDIRECTDRAWSURFACE7 pSurf, LPDDSURFACEDESC2 pDDSD,
698 LPVOID context)
700 struct surfacescallback_context *cbcontext = context;
702 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
703 * IDirectDrawSurface vtable layout at the beginning */
704 return cbcontext->func((LPDIRECTDRAWSURFACE)
705 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
706 IDirectDrawSurface7,
707 IDirectDrawSurface3, pSurf),
708 (LPDDSURFACEDESC)pDDSD, cbcontext->context);
711 static HRESULT WINAPI
712 IDirectDrawImpl_EnumSurfaces(LPDIRECTDRAW This, DWORD dwFlags,
713 LPDDSURFACEDESC pDDSD, LPVOID context,
714 LPDDENUMSURFACESCALLBACK cb)
716 struct surfacescallback_context cbcontext;
718 cbcontext.func = cb;
719 cbcontext.context = context;
721 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
722 IDirectDraw,
723 IDirectDraw7, This),
724 dwFlags, (LPDDSURFACEDESC2)pDDSD,
725 &cbcontext, EnumSurfacesCallbackThunk);
728 static HRESULT WINAPI
729 IDirectDraw2Impl_EnumSurfaces(LPDIRECTDRAW2 This, DWORD dwFlags,
730 LPDDSURFACEDESC pDDSD, LPVOID context,
731 LPDDENUMSURFACESCALLBACK cb)
733 struct surfacescallback_context cbcontext;
735 cbcontext.func = cb;
736 cbcontext.context = context;
738 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
739 IDirectDraw2,
740 IDirectDraw7, This),
741 dwFlags, (LPDDSURFACEDESC2)pDDSD,
742 &cbcontext, EnumSurfacesCallbackThunk);
745 static HRESULT WINAPI
746 IDirectDraw3Impl_EnumSurfaces(LPDIRECTDRAW3 This, DWORD dwFlags,
747 LPDDSURFACEDESC pDDSD, LPVOID context,
748 LPDDENUMSURFACESCALLBACK cb)
750 struct surfacescallback_context cbcontext;
752 cbcontext.func = cb;
753 cbcontext.context = context;
755 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
756 IDirectDraw3,
757 IDirectDraw7, This),
758 dwFlags, (LPDDSURFACEDESC2)pDDSD,
759 &cbcontext, EnumSurfacesCallbackThunk);
762 static HRESULT WINAPI
763 IDirectDraw4Impl_EnumSurfaces(LPDIRECTDRAW4 This, DWORD dwFlags,
764 LPDDSURFACEDESC2 pDDSD, LPVOID context,
765 LPDDENUMSURFACESCALLBACK2 cb)
767 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
768 IDirectDraw4,
769 IDirectDraw7, This),
770 dwFlags, pDDSD, context,
771 (LPDDENUMSURFACESCALLBACK7)cb);
774 static HRESULT WINAPI
775 IDirectDrawImpl_FlipToGDISurface(LPDIRECTDRAW This)
777 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
778 IDirectDraw,
779 IDirectDraw7,
780 This));
783 static HRESULT WINAPI
784 IDirectDraw2Impl_FlipToGDISurface(LPDIRECTDRAW2 This)
786 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
787 IDirectDraw2,
788 IDirectDraw7,
789 This));
792 static HRESULT WINAPI
793 IDirectDraw3Impl_FlipToGDISurface(LPDIRECTDRAW3 This)
795 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
796 IDirectDraw3,
797 IDirectDraw7,
798 This));
801 static HRESULT WINAPI
802 IDirectDraw4Impl_FlipToGDISurface(LPDIRECTDRAW4 This)
804 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
805 IDirectDraw4,
806 IDirectDraw7,
807 This));
810 static HRESULT WINAPI
811 IDirectDrawImpl_GetCaps(LPDIRECTDRAW This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
813 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
814 IDirectDraw, IDirectDraw7,
815 This), pDDC1, pDDC2);
818 static HRESULT WINAPI
819 IDirectDraw2Impl_GetCaps(LPDIRECTDRAW2 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
821 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
822 IDirectDraw2, IDirectDraw7,
823 This), pDDC1, pDDC2);
826 static HRESULT WINAPI
827 IDirectDraw3Impl_GetCaps(LPDIRECTDRAW3 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
829 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
830 IDirectDraw3, IDirectDraw7,
831 This), pDDC1, pDDC2);
834 static HRESULT WINAPI
835 IDirectDraw4Impl_GetCaps(LPDIRECTDRAW4 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
837 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
838 IDirectDraw4, IDirectDraw7,
839 This), pDDC1, pDDC2);
842 static HRESULT WINAPI
843 IDirectDrawImpl_GetDisplayMode(LPDIRECTDRAW This, LPDDSURFACEDESC pDDSD)
845 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
846 IDirectDraw,
847 IDirectDraw7, This),
848 (LPDDSURFACEDESC2)pDDSD);
851 static HRESULT WINAPI
852 IDirectDraw2Impl_GetDisplayMode(LPDIRECTDRAW2 This, LPDDSURFACEDESC pDDSD)
854 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
855 IDirectDraw2,
856 IDirectDraw7, This),
857 (LPDDSURFACEDESC2)pDDSD);
860 static HRESULT WINAPI
861 IDirectDraw3Impl_GetDisplayMode(LPDIRECTDRAW3 This, LPDDSURFACEDESC pDDSD)
863 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
864 IDirectDraw3,
865 IDirectDraw7, This),
866 (LPDDSURFACEDESC2)pDDSD);
869 static HRESULT WINAPI
870 IDirectDraw4Impl_GetDisplayMode(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pDDSD)
872 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
873 IDirectDraw4,
874 IDirectDraw7, This),
875 pDDSD);
878 static HRESULT WINAPI
879 IDirectDrawImpl_GetFourCCCodes(LPDIRECTDRAW This, LPDWORD lpNumCodes,
880 LPDWORD lpCodes)
882 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
883 IDirectDraw,
884 IDirectDraw7,
885 This),
886 lpNumCodes, lpCodes);
889 static HRESULT WINAPI
890 IDirectDraw2Impl_GetFourCCCodes(LPDIRECTDRAW2 This, LPDWORD lpNumCodes,
891 LPDWORD lpCodes)
893 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
894 IDirectDraw2,
895 IDirectDraw7,
896 This),
897 lpNumCodes, lpCodes);
900 static HRESULT WINAPI
901 IDirectDraw3Impl_GetFourCCCodes(LPDIRECTDRAW3 This, LPDWORD lpNumCodes,
902 LPDWORD lpCodes)
904 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
905 IDirectDraw3,
906 IDirectDraw7,
907 This),
908 lpNumCodes, lpCodes);
911 static HRESULT WINAPI
912 IDirectDraw4Impl_GetFourCCCodes(LPDIRECTDRAW4 This, LPDWORD lpNumCodes,
913 LPDWORD lpCodes)
915 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
916 IDirectDraw4,
917 IDirectDraw7,
918 This),
919 lpNumCodes, lpCodes);
922 static HRESULT WINAPI
923 IDirectDrawImpl_GetGDISurface(LPDIRECTDRAW This, LPDIRECTDRAWSURFACE *ppSurf)
925 LPDIRECTDRAWSURFACE7 pSurf7;
926 HRESULT hr;
928 hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
929 IDirectDraw,
930 IDirectDraw7,
931 This), &pSurf7);
933 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
934 * IDirectDrawSurface vtable layout at the beginning */
935 *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
936 IDirectDrawSurface3, pSurf7);
938 return hr;
941 static HRESULT WINAPI
942 IDirectDraw2Impl_GetGDISurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE *ppSurf)
944 LPDIRECTDRAWSURFACE7 pSurf7;
945 HRESULT hr;
947 hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
948 IDirectDraw2,
949 IDirectDraw7,
950 This), &pSurf7);
952 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
953 * IDirectDrawSurface vtable layout at the beginning */
954 *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
955 IDirectDrawSurface3, pSurf7);
957 return hr;
960 static HRESULT WINAPI
961 IDirectDraw3Impl_GetGDISurface(LPDIRECTDRAW3 This, LPDIRECTDRAWSURFACE *ppSurf)
963 LPDIRECTDRAWSURFACE7 pSurf7;
964 HRESULT hr;
966 hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
967 IDirectDraw3,
968 IDirectDraw7,
969 This), &pSurf7);
971 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
972 * IDirectDrawSurface vtable layout at the beginning */
973 *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
974 IDirectDrawSurface3, pSurf7);
976 return hr;
979 static HRESULT WINAPI
980 IDirectDraw4Impl_GetGDISurface(LPDIRECTDRAW4 This,
981 LPDIRECTDRAWSURFACE4 *ppSurf)
983 return IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
984 IDirectDraw4,
985 IDirectDraw7,
986 This),
987 (LPDIRECTDRAWSURFACE7 *)ppSurf);
990 static HRESULT WINAPI
991 IDirectDrawImpl_GetMonitorFrequency(LPDIRECTDRAW This, LPDWORD pdwFreq)
993 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
994 IDirectDraw,
995 IDirectDraw7,
996 This),
997 pdwFreq);
1000 static HRESULT WINAPI
1001 IDirectDraw2Impl_GetMonitorFrequency(LPDIRECTDRAW2 This, LPDWORD pdwFreq)
1003 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
1004 IDirectDraw2,
1005 IDirectDraw7,
1006 This),
1007 pdwFreq);
1010 static HRESULT WINAPI
1011 IDirectDraw3Impl_GetMonitorFrequency(LPDIRECTDRAW3 This, LPDWORD pdwFreq)
1013 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
1014 IDirectDraw3,
1015 IDirectDraw7,
1016 This),
1017 pdwFreq);
1020 static HRESULT WINAPI
1021 IDirectDraw4Impl_GetMonitorFrequency(LPDIRECTDRAW4 This, LPDWORD pdwFreq)
1023 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
1024 IDirectDraw4,
1025 IDirectDraw7,
1026 This),
1027 pdwFreq);
1030 static HRESULT WINAPI
1031 IDirectDrawImpl_GetScanLine(LPDIRECTDRAW This, LPDWORD pdwLine)
1033 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
1034 IDirectDraw,
1035 IDirectDraw7,
1036 This), pdwLine);
1039 static HRESULT WINAPI
1040 IDirectDraw2Impl_GetScanLine(LPDIRECTDRAW2 This, LPDWORD pdwLine)
1042 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
1043 IDirectDraw2,
1044 IDirectDraw7,
1045 This), pdwLine);
1048 static HRESULT WINAPI
1049 IDirectDraw3Impl_GetScanLine(LPDIRECTDRAW3 This, LPDWORD pdwLine)
1051 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
1052 IDirectDraw3,
1053 IDirectDraw7,
1054 This), pdwLine);
1057 static HRESULT WINAPI
1058 IDirectDraw4Impl_GetScanLine(LPDIRECTDRAW4 This, LPDWORD pdwLine)
1060 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
1061 IDirectDraw4,
1062 IDirectDraw7,
1063 This), pdwLine);
1066 static HRESULT WINAPI
1067 IDirectDrawImpl_GetVerticalBlankStatus(LPDIRECTDRAW This, LPBOOL lpbIsInVB)
1069 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
1070 IDirectDraw,
1071 IDirectDraw7,
1072 This),
1073 lpbIsInVB);
1076 static HRESULT WINAPI
1077 IDirectDraw2Impl_GetVerticalBlankStatus(LPDIRECTDRAW2 This, LPBOOL lpbIsInVB)
1079 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
1080 IDirectDraw2,
1081 IDirectDraw7,
1082 This),
1083 lpbIsInVB);
1086 static HRESULT WINAPI
1087 IDirectDraw3Impl_GetVerticalBlankStatus(LPDIRECTDRAW3 This, LPBOOL lpbIsInVB)
1089 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
1090 IDirectDraw3,
1091 IDirectDraw7,
1092 This),
1093 lpbIsInVB);
1096 static HRESULT WINAPI
1097 IDirectDraw4Impl_GetVerticalBlankStatus(LPDIRECTDRAW4 This, LPBOOL lpbIsInVB)
1099 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
1100 IDirectDraw4,
1101 IDirectDraw7,
1102 This),
1103 lpbIsInVB);
1106 static HRESULT WINAPI
1107 IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID)
1109 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
1110 HRESULT ret_value;
1112 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
1114 return ret_value;
1117 static HRESULT WINAPI
1118 IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID)
1120 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
1121 HRESULT ret_value;
1123 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
1125 return ret_value;
1128 static HRESULT WINAPI
1129 IDirectDraw3Impl_Initialize(LPDIRECTDRAW3 iface, LPGUID pGUID)
1131 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw3, iface);
1132 HRESULT ret_value;
1134 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
1136 return ret_value;
1139 static HRESULT WINAPI
1140 IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID)
1142 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
1143 HRESULT ret_value;
1145 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
1147 return ret_value;
1151 static HRESULT WINAPI
1152 IDirectDrawImpl_RestoreDisplayMode(LPDIRECTDRAW This)
1154 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1155 IDirectDraw,
1156 IDirectDraw7,
1157 This));
1160 static HRESULT WINAPI
1161 IDirectDraw2Impl_RestoreDisplayMode(LPDIRECTDRAW2 This)
1163 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1164 IDirectDraw2,
1165 IDirectDraw7,
1166 This));
1169 static HRESULT WINAPI
1170 IDirectDraw3Impl_RestoreDisplayMode(LPDIRECTDRAW3 This)
1172 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1173 IDirectDraw3,
1174 IDirectDraw7,
1175 This));
1178 static HRESULT WINAPI
1179 IDirectDraw4Impl_RestoreDisplayMode(LPDIRECTDRAW4 This)
1181 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1182 IDirectDraw4,
1183 IDirectDraw7,
1184 This));
1187 static HRESULT WINAPI
1188 IDirectDrawImpl_SetCooperativeLevel(LPDIRECTDRAW This, HWND hWnd,
1189 DWORD dwFlags)
1191 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
1192 IDirectDraw,
1193 IDirectDraw7,
1194 This),
1195 hWnd, dwFlags);
1198 static HRESULT WINAPI
1199 IDirectDraw2Impl_SetCooperativeLevel(LPDIRECTDRAW2 This, HWND hWnd,
1200 DWORD dwFlags)
1202 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
1203 IDirectDraw2,
1204 IDirectDraw7,
1205 This),
1206 hWnd, dwFlags);
1209 static HRESULT WINAPI
1210 IDirectDraw3Impl_SetCooperativeLevel(LPDIRECTDRAW3 This, HWND hWnd,
1211 DWORD dwFlags)
1213 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
1214 IDirectDraw3,
1215 IDirectDraw7,
1216 This),
1217 hWnd, dwFlags);
1220 static HRESULT WINAPI
1221 IDirectDraw4Impl_SetCooperativeLevel(LPDIRECTDRAW4 This, HWND hWnd,
1222 DWORD dwFlags)
1224 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
1225 IDirectDraw4,
1226 IDirectDraw7,
1227 This),
1228 hWnd, dwFlags);
1231 static HRESULT WINAPI
1232 IDirectDrawImpl_SetDisplayMode(LPDIRECTDRAW This, DWORD a, DWORD b, DWORD c)
1234 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1235 IDirectDraw,
1236 IDirectDraw7,
1237 This),
1238 a, b, c, 0, 0);
1241 static HRESULT WINAPI
1242 IDirectDraw2Impl_SetDisplayMode(LPDIRECTDRAW2 This, DWORD a, DWORD b, DWORD c,
1243 DWORD d, DWORD e)
1245 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1246 IDirectDraw2,
1247 IDirectDraw7,
1248 This),
1249 a, b, c, d, e);
1252 static HRESULT WINAPI
1253 IDirectDraw3Impl_SetDisplayMode(LPDIRECTDRAW3 This, DWORD a, DWORD b, DWORD c,
1254 DWORD d, DWORD e)
1256 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1257 IDirectDraw3,
1258 IDirectDraw7,
1259 This),
1260 a, b, c, d, e);
1263 static HRESULT WINAPI
1264 IDirectDraw4Impl_SetDisplayMode(LPDIRECTDRAW4 This, DWORD a, DWORD b, DWORD c,
1265 DWORD d, DWORD e)
1267 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
1268 IDirectDraw4,
1269 IDirectDraw7,
1270 This),
1271 a, b, c, d, e);
1274 static HRESULT WINAPI
1275 IDirectDrawImpl_WaitForVerticalBlank(LPDIRECTDRAW This, DWORD dwFlags,
1276 HANDLE hEvent)
1278 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
1279 IDirectDraw,
1280 IDirectDraw7,
1281 This),
1282 dwFlags, hEvent);
1285 static HRESULT WINAPI
1286 IDirectDraw2Impl_WaitForVerticalBlank(LPDIRECTDRAW2 This, DWORD dwFlags,
1287 HANDLE hEvent)
1289 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
1290 IDirectDraw2,
1291 IDirectDraw7,
1292 This),
1293 dwFlags, hEvent);
1296 static HRESULT WINAPI
1297 IDirectDraw3Impl_WaitForVerticalBlank(LPDIRECTDRAW3 This, DWORD dwFlags,
1298 HANDLE hEvent)
1300 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
1301 IDirectDraw3,
1302 IDirectDraw7,
1303 This),
1304 dwFlags, hEvent);
1307 static HRESULT WINAPI
1308 IDirectDraw4Impl_WaitForVerticalBlank(LPDIRECTDRAW4 This, DWORD dwFlags,
1309 HANDLE hEvent)
1311 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
1312 IDirectDraw4,
1313 IDirectDraw7,
1314 This),
1315 dwFlags, hEvent);
1318 static HRESULT WINAPI
1319 IDirectDraw2Impl_GetAvailableVidMem(LPDIRECTDRAW2 This, LPDDSCAPS pCaps,
1320 LPDWORD pdwTotal, LPDWORD pdwFree)
1322 DDSCAPS2 Caps2;
1323 DDRAW_Convert_DDSCAPS_1_To_2(pCaps, &Caps2);
1325 return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl,
1326 IDirectDraw2,
1327 IDirectDraw7,
1328 This),
1329 &Caps2, pdwTotal, pdwFree);
1332 static HRESULT WINAPI
1333 IDirectDraw3Impl_GetAvailableVidMem(LPDIRECTDRAW3 This, LPDDSCAPS pCaps,
1334 LPDWORD pdwTotal, LPDWORD pdwFree)
1336 DDSCAPS2 Caps2;
1337 DDRAW_Convert_DDSCAPS_1_To_2(pCaps, &Caps2);
1339 return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl,
1340 IDirectDraw3,
1341 IDirectDraw7,
1342 This),
1343 &Caps2, pdwTotal, pdwFree);
1346 static HRESULT WINAPI
1347 IDirectDraw4Impl_GetAvailableVidMem(LPDIRECTDRAW4 This, LPDDSCAPS2 pCaps,
1348 LPDWORD pdwTotal, LPDWORD pdwFree)
1350 return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl,
1351 IDirectDraw4,
1352 IDirectDraw7,
1353 This),
1354 pCaps, pdwTotal, pdwFree);
1357 static HRESULT WINAPI
1358 IDirectDraw3Impl_GetSurfaceFromDC(LPDIRECTDRAW3 This, HDC hDC,
1359 LPDIRECTDRAWSURFACE *pSurf)
1361 return IDirectDraw7_GetSurfaceFromDC(COM_INTERFACE_CAST(IDirectDrawImpl,
1362 IDirectDraw3,
1363 IDirectDraw7,
1364 This),
1365 hDC, (LPDIRECTDRAWSURFACE7 *)pSurf);
1368 static HRESULT WINAPI
1369 IDirectDraw4Impl_GetSurfaceFromDC(LPDIRECTDRAW4 This, HDC hDC,
1370 LPDIRECTDRAWSURFACE4 *pSurf)
1372 return IDirectDraw7_GetSurfaceFromDC(COM_INTERFACE_CAST(IDirectDrawImpl,
1373 IDirectDraw4,
1374 IDirectDraw7,
1375 This),
1376 hDC, (LPDIRECTDRAWSURFACE7 *)pSurf);
1379 static HRESULT WINAPI
1380 IDirectDraw4Impl_RestoreAllSurfaces(LPDIRECTDRAW4 This)
1382 return IDirectDraw7_RestoreAllSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
1383 IDirectDraw4,
1384 IDirectDraw7,
1385 This));
1388 static HRESULT WINAPI
1389 IDirectDraw4Impl_TestCooperativeLevel(LPDIRECTDRAW4 This)
1391 return IDirectDraw7_TestCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
1392 IDirectDraw4,
1393 IDirectDraw7,
1394 This));
1397 static HRESULT WINAPI
1398 IDirectDraw4Impl_GetDeviceIdentifier(LPDIRECTDRAW4 This,
1399 LPDDDEVICEIDENTIFIER pDDDI, DWORD dwFlags)
1401 DDDEVICEIDENTIFIER2 DDDI2;
1402 HRESULT hr;
1404 hr = IDirectDraw7_GetDeviceIdentifier(COM_INTERFACE_CAST(IDirectDrawImpl,
1405 IDirectDraw4,
1406 IDirectDraw7,
1407 This),
1408 &DDDI2, dwFlags);
1410 DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(&DDDI2, pDDDI);
1412 return hr;
1415 const IDirectDrawVtbl IDirectDraw1_Vtbl =
1417 IDirectDrawImpl_QueryInterface,
1418 IDirectDrawImpl_AddRef,
1419 IDirectDrawImpl_Release,
1420 IDirectDrawImpl_Compact,
1421 IDirectDrawImpl_CreateClipper,
1422 IDirectDrawImpl_CreatePalette,
1423 IDirectDrawImpl_CreateSurface,
1424 IDirectDrawImpl_DuplicateSurface,
1425 IDirectDrawImpl_EnumDisplayModes,
1426 IDirectDrawImpl_EnumSurfaces,
1427 IDirectDrawImpl_FlipToGDISurface,
1428 IDirectDrawImpl_GetCaps,
1429 IDirectDrawImpl_GetDisplayMode,
1430 IDirectDrawImpl_GetFourCCCodes,
1431 IDirectDrawImpl_GetGDISurface,
1432 IDirectDrawImpl_GetMonitorFrequency,
1433 IDirectDrawImpl_GetScanLine,
1434 IDirectDrawImpl_GetVerticalBlankStatus,
1435 IDirectDrawImpl_Initialize,
1436 IDirectDrawImpl_RestoreDisplayMode,
1437 IDirectDrawImpl_SetCooperativeLevel,
1438 IDirectDrawImpl_SetDisplayMode,
1439 IDirectDrawImpl_WaitForVerticalBlank,
1442 const IDirectDraw2Vtbl IDirectDraw2_Vtbl =
1444 IDirectDraw2Impl_QueryInterface,
1445 IDirectDraw2Impl_AddRef,
1446 IDirectDraw2Impl_Release,
1447 IDirectDraw2Impl_Compact,
1448 IDirectDraw2Impl_CreateClipper,
1449 IDirectDraw2Impl_CreatePalette,
1450 IDirectDraw2Impl_CreateSurface,
1451 IDirectDraw2Impl_DuplicateSurface,
1452 IDirectDraw2Impl_EnumDisplayModes,
1453 IDirectDraw2Impl_EnumSurfaces,
1454 IDirectDraw2Impl_FlipToGDISurface,
1455 IDirectDraw2Impl_GetCaps,
1456 IDirectDraw2Impl_GetDisplayMode,
1457 IDirectDraw2Impl_GetFourCCCodes,
1458 IDirectDraw2Impl_GetGDISurface,
1459 IDirectDraw2Impl_GetMonitorFrequency,
1460 IDirectDraw2Impl_GetScanLine,
1461 IDirectDraw2Impl_GetVerticalBlankStatus,
1462 IDirectDraw2Impl_Initialize,
1463 IDirectDraw2Impl_RestoreDisplayMode,
1464 IDirectDraw2Impl_SetCooperativeLevel,
1465 IDirectDraw2Impl_SetDisplayMode,
1466 IDirectDraw2Impl_WaitForVerticalBlank,
1467 IDirectDraw2Impl_GetAvailableVidMem
1470 const IDirectDraw3Vtbl IDirectDraw3_Vtbl =
1472 IDirectDraw3Impl_QueryInterface,
1473 IDirectDraw3Impl_AddRef,
1474 IDirectDraw3Impl_Release,
1475 IDirectDraw3Impl_Compact,
1476 IDirectDraw3Impl_CreateClipper,
1477 IDirectDraw3Impl_CreatePalette,
1478 IDirectDraw3Impl_CreateSurface,
1479 IDirectDraw3Impl_DuplicateSurface,
1480 IDirectDraw3Impl_EnumDisplayModes,
1481 IDirectDraw3Impl_EnumSurfaces,
1482 IDirectDraw3Impl_FlipToGDISurface,
1483 IDirectDraw3Impl_GetCaps,
1484 IDirectDraw3Impl_GetDisplayMode,
1485 IDirectDraw3Impl_GetFourCCCodes,
1486 IDirectDraw3Impl_GetGDISurface,
1487 IDirectDraw3Impl_GetMonitorFrequency,
1488 IDirectDraw3Impl_GetScanLine,
1489 IDirectDraw3Impl_GetVerticalBlankStatus,
1490 IDirectDraw3Impl_Initialize,
1491 IDirectDraw3Impl_RestoreDisplayMode,
1492 IDirectDraw3Impl_SetCooperativeLevel,
1493 IDirectDraw3Impl_SetDisplayMode,
1494 IDirectDraw3Impl_WaitForVerticalBlank,
1495 IDirectDraw3Impl_GetAvailableVidMem,
1496 IDirectDraw3Impl_GetSurfaceFromDC,
1499 const IDirectDraw4Vtbl IDirectDraw4_Vtbl =
1501 IDirectDraw4Impl_QueryInterface,
1502 IDirectDraw4Impl_AddRef,
1503 IDirectDraw4Impl_Release,
1504 IDirectDraw4Impl_Compact,
1505 IDirectDraw4Impl_CreateClipper,
1506 IDirectDraw4Impl_CreatePalette,
1507 IDirectDraw4Impl_CreateSurface,
1508 IDirectDraw4Impl_DuplicateSurface,
1509 IDirectDraw4Impl_EnumDisplayModes,
1510 IDirectDraw4Impl_EnumSurfaces,
1511 IDirectDraw4Impl_FlipToGDISurface,
1512 IDirectDraw4Impl_GetCaps,
1513 IDirectDraw4Impl_GetDisplayMode,
1514 IDirectDraw4Impl_GetFourCCCodes,
1515 IDirectDraw4Impl_GetGDISurface,
1516 IDirectDraw4Impl_GetMonitorFrequency,
1517 IDirectDraw4Impl_GetScanLine,
1518 IDirectDraw4Impl_GetVerticalBlankStatus,
1519 IDirectDraw4Impl_Initialize,
1520 IDirectDraw4Impl_RestoreDisplayMode,
1521 IDirectDraw4Impl_SetCooperativeLevel,
1522 IDirectDraw4Impl_SetDisplayMode,
1523 IDirectDraw4Impl_WaitForVerticalBlank,
1524 IDirectDraw4Impl_GetAvailableVidMem,
1525 IDirectDraw4Impl_GetSurfaceFromDC,
1526 IDirectDraw4Impl_RestoreAllSurfaces,
1527 IDirectDraw4Impl_TestCooperativeLevel,
1528 IDirectDraw4Impl_GetDeviceIdentifier