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
20 #include "wine/port.h"
28 #define NONAMELESSUNION
35 #include "wine/exception.h"
41 #include "ddraw_private.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(ddraw_thunk);
45 WINE_DECLARE_DEBUG_CHANNEL(ddraw);
48 IDirectDrawImpl_QueryInterface(LPDIRECTDRAW This, REFIID iid, LPVOID *ppObj)
50 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
57 IDirectDraw2Impl_QueryInterface(LPDIRECTDRAW2 This, REFIID iid, LPVOID *ppObj)
59 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
67 IDirectDraw4Impl_QueryInterface(LPDIRECTDRAW4 This, REFIID iid, LPVOID *ppObj)
69 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
76 IDirectDrawImpl_AddRef(LPDIRECTDRAW iface)
78 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
79 ULONG ref = InterlockedIncrement(&This->ref1);
81 TRACE("(%p) : incrementing IDirectDraw refcount from %u.\n", This, ref -1);
83 if(ref == 1) InterlockedIncrement(&This->numIfaces);
89 IDirectDraw2Impl_AddRef(LPDIRECTDRAW2 iface)
91 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
92 ULONG ref = InterlockedIncrement(&This->ref2);
94 TRACE("(%p) : incrementing IDirectDraw2 refcount from %u.\n", This, ref -1);
96 if(ref == 1) InterlockedIncrement(&This->numIfaces);
102 IDirectDraw4Impl_AddRef(LPDIRECTDRAW4 iface)
104 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
105 ULONG ref = InterlockedIncrement(&This->ref4);
107 TRACE("(%p) : incrementing IDirectDraw4 refcount from %u.\n", This, ref -1);
109 if(ref == 1) InterlockedIncrement(&This->numIfaces);
115 IDirectDrawImpl_Release(LPDIRECTDRAW iface)
117 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
118 ULONG ref = InterlockedDecrement(&This->ref1);
120 TRACE_(ddraw)("(%p)->() decrementing IDirectDraw refcount from %u.\n", This, ref +1);
124 ULONG ifacecount = InterlockedDecrement(&This->numIfaces);
125 if(ifacecount == 0) IDirectDrawImpl_Destroy(This);
132 IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface)
134 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
135 ULONG ref = InterlockedDecrement(&This->ref2);
137 TRACE_(ddraw)("(%p)->() decrementing IDirectDraw2 refcount from %u.\n", This, ref +1);
141 ULONG ifacecount = InterlockedDecrement(&This->numIfaces);
142 if(ifacecount == 0) IDirectDrawImpl_Destroy(This);
149 IDirectDraw4Impl_Release(LPDIRECTDRAW4 iface)
151 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
152 ULONG ref = InterlockedDecrement(&This->ref4);
154 TRACE_(ddraw)("(%p)->() decrementing IDirectDraw4 refcount from %u.\n", This, ref +1);
158 ULONG ifacecount = InterlockedDecrement(&This->numIfaces);
159 if(ifacecount == 0) IDirectDrawImpl_Destroy(This);
165 static HRESULT WINAPI
166 IDirectDrawImpl_Compact(LPDIRECTDRAW This)
168 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
169 IDirectDraw, IDirectDraw7,
173 static HRESULT WINAPI
174 IDirectDraw2Impl_Compact(LPDIRECTDRAW2 This)
176 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
177 IDirectDraw2, IDirectDraw7,
181 static HRESULT WINAPI
182 IDirectDraw4Impl_Compact(LPDIRECTDRAW4 This)
184 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
185 IDirectDraw4, IDirectDraw7,
189 static HRESULT WINAPI
190 IDirectDrawImpl_CreateClipper(LPDIRECTDRAW This, DWORD dwFlags,
191 LPDIRECTDRAWCLIPPER *ppClipper,
194 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
198 dwFlags, ppClipper, pUnkOuter);
201 static HRESULT WINAPI
202 IDirectDraw2Impl_CreateClipper(LPDIRECTDRAW2 This, DWORD dwFlags,
203 LPDIRECTDRAWCLIPPER *ppClipper,
206 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
210 dwFlags, ppClipper, pUnkOuter);
213 static HRESULT WINAPI
214 IDirectDraw4Impl_CreateClipper(LPDIRECTDRAW4 This, DWORD dwFlags,
215 LPDIRECTDRAWCLIPPER *ppClipper,
218 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
222 dwFlags, ppClipper, pUnkOuter);
225 static HRESULT WINAPI
226 IDirectDrawImpl_CreatePalette(LPDIRECTDRAW This, DWORD dwFlags,
227 LPPALETTEENTRY pEntries,
228 LPDIRECTDRAWPALETTE *ppPalette,
232 hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
236 dwFlags, pEntries, ppPalette, pUnkOuter);
237 if(SUCCEEDED(hr) && *ppPalette)
239 IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette);
240 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
244 impl->ifaceToRelease = NULL;
250 static HRESULT WINAPI
251 IDirectDraw2Impl_CreatePalette(LPDIRECTDRAW2 This, DWORD dwFlags,
252 LPPALETTEENTRY pEntries,
253 LPDIRECTDRAWPALETTE *ppPalette,
257 hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
261 dwFlags, pEntries, ppPalette, pUnkOuter);
262 if(SUCCEEDED(hr) && *ppPalette)
264 IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette);
265 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
269 impl->ifaceToRelease = NULL;
274 static HRESULT WINAPI
275 IDirectDraw4Impl_CreatePalette(LPDIRECTDRAW4 This, DWORD dwFlags,
276 LPPALETTEENTRY pEntries,
277 LPDIRECTDRAWPALETTE *ppPalette,
281 hr = IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
285 dwFlags, pEntries, ppPalette, pUnkOuter);
286 if(SUCCEEDED(hr) && *ppPalette)
288 IDirectDrawPaletteImpl *impl = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette, *ppPalette);
289 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
293 IDirectDraw4_AddRef(This);
294 impl->ifaceToRelease = (IUnknown *) This;
299 static HRESULT WINAPI
300 IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
301 LPDIRECTDRAWSURFACE *ppSurface,
304 LPDIRECTDRAWSURFACE7 pSurface7;
305 IDirectDrawSurfaceImpl *impl;
308 /* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok,
309 * since the data layout is the same */
310 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
314 (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
316 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
317 * IDirectDrawSurface vtable layout at the beginning */
318 *ppSurface = (LPDIRECTDRAWSURFACE) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
319 IDirectDrawSurface7, IDirectDrawSurface3,
322 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
323 if(SUCCEEDED(hr) && impl)
326 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
330 IDirectDraw_AddRef(This);
331 impl->ifaceToRelease = (IUnknown *) This;
337 static HRESULT WINAPI
338 IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc,
339 LPDIRECTDRAWSURFACE *ppSurface,
342 LPDIRECTDRAWSURFACE7 pSurface7;
343 IDirectDrawSurfaceImpl *impl;
346 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
350 (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
352 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
353 * IDirectDrawSurface vtable layout at the beginning */
354 *ppSurface = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
355 IDirectDrawSurface7, IDirectDrawSurface3,
358 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
359 if(SUCCEEDED(hr) && impl)
362 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
366 IDirectDraw2_AddRef(This);
367 impl->ifaceToRelease = (IUnknown *) This;
373 static HRESULT WINAPI
374 IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc,
375 LPDIRECTDRAWSURFACE4 *ppSurface,
379 IDirectDrawSurfaceImpl *impl;
381 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
386 (LPDIRECTDRAWSURFACE7 *)ppSurface,
388 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurface);
389 if(SUCCEEDED(hr) && impl)
392 IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
396 IDirectDraw4_AddRef(This);
397 impl->ifaceToRelease = (IUnknown *) This;
402 static HRESULT WINAPI
403 IDirectDrawImpl_DuplicateSurface(LPDIRECTDRAW This, LPDIRECTDRAWSURFACE pSrc,
404 LPDIRECTDRAWSURFACE *ppDst)
406 LPDIRECTDRAWSURFACE7 pDst7;
409 hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
412 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
418 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
419 * IDirectDrawSurface vtable layout at the beginning */
420 *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
421 IDirectDrawSurface3, pDst7);
426 static HRESULT WINAPI
427 IDirectDraw2Impl_DuplicateSurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE pSrc,
428 LPDIRECTDRAWSURFACE *ppDst)
430 LPDIRECTDRAWSURFACE7 pDst7;
433 hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
436 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
442 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
443 * IDirectDrawSurface vtable layout at the beginning */
444 *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
445 IDirectDrawSurface3, pDst7);
450 static HRESULT WINAPI
451 IDirectDraw4Impl_DuplicateSurface(LPDIRECTDRAW4 This,
452 LPDIRECTDRAWSURFACE4 pSrc,
453 LPDIRECTDRAWSURFACE4 *ppDst)
455 return IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
459 (LPDIRECTDRAWSURFACE7)pSrc,
460 (LPDIRECTDRAWSURFACE7 *)ppDst);
463 struct displaymodescallback_context
465 LPDDENUMMODESCALLBACK func;
469 static HRESULT CALLBACK
470 EnumDisplayModesCallbackThunk(LPDDSURFACEDESC2 pDDSD2, LPVOID context)
473 struct displaymodescallback_context *cbcontext = context;
475 memcpy(&DDSD,pDDSD2,sizeof(DDSD));
476 DDSD.dwSize = sizeof(DDSD);
478 return cbcontext->func(&DDSD, cbcontext->context);
481 static HRESULT WINAPI
482 IDirectDrawImpl_EnumDisplayModes(LPDIRECTDRAW This, DWORD dwFlags,
483 LPDDSURFACEDESC pDDSD, LPVOID context,
484 LPDDENUMMODESCALLBACK cb)
486 struct displaymodescallback_context cbcontext;
489 cbcontext.context = context;
491 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
495 dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext,
496 EnumDisplayModesCallbackThunk);
499 static HRESULT WINAPI
500 IDirectDraw2Impl_EnumDisplayModes(LPDIRECTDRAW2 This, DWORD dwFlags,
501 LPDDSURFACEDESC pDDSD, LPVOID context,
502 LPDDENUMMODESCALLBACK cb)
504 struct displaymodescallback_context cbcontext;
507 cbcontext.context = context;
509 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
513 dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext,
514 EnumDisplayModesCallbackThunk);
517 static HRESULT WINAPI
518 IDirectDraw4Impl_EnumDisplayModes(LPDIRECTDRAW4 This, DWORD dwFlags,
519 LPDDSURFACEDESC2 pDDSD, LPVOID context,
520 LPDDENUMMODESCALLBACK2 cb)
522 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
526 dwFlags, pDDSD, context, cb);
529 struct surfacescallback_context
531 LPDDENUMSURFACESCALLBACK func;
535 static HRESULT CALLBACK
536 EnumSurfacesCallbackThunk(LPDIRECTDRAWSURFACE7 pSurf, LPDDSURFACEDESC2 pDDSD,
539 struct surfacescallback_context *cbcontext = context;
541 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
542 * IDirectDrawSurface vtable layout at the beginning */
543 return cbcontext->func((LPDIRECTDRAWSURFACE)
544 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
546 IDirectDrawSurface3, pSurf),
547 (LPDDSURFACEDESC)pDDSD, cbcontext->context);
550 static HRESULT WINAPI
551 IDirectDrawImpl_EnumSurfaces(LPDIRECTDRAW This, DWORD dwFlags,
552 LPDDSURFACEDESC pDDSD, LPVOID context,
553 LPDDENUMSURFACESCALLBACK cb)
555 struct surfacescallback_context cbcontext;
558 cbcontext.context = context;
560 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
563 dwFlags, (LPDDSURFACEDESC2)pDDSD,
564 &cbcontext, EnumSurfacesCallbackThunk);
567 static HRESULT WINAPI
568 IDirectDraw2Impl_EnumSurfaces(LPDIRECTDRAW2 This, DWORD dwFlags,
569 LPDDSURFACEDESC pDDSD, LPVOID context,
570 LPDDENUMSURFACESCALLBACK cb)
572 struct surfacescallback_context cbcontext;
575 cbcontext.context = context;
577 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
580 dwFlags, (LPDDSURFACEDESC2)pDDSD,
581 &cbcontext, EnumSurfacesCallbackThunk);
584 static HRESULT WINAPI
585 IDirectDraw4Impl_EnumSurfaces(LPDIRECTDRAW4 This, DWORD dwFlags,
586 LPDDSURFACEDESC2 pDDSD, LPVOID context,
587 LPDDENUMSURFACESCALLBACK2 cb)
589 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
592 dwFlags, pDDSD, context,
593 (LPDDENUMSURFACESCALLBACK7)cb);
596 static HRESULT WINAPI
597 IDirectDrawImpl_FlipToGDISurface(LPDIRECTDRAW This)
599 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
605 static HRESULT WINAPI
606 IDirectDraw2Impl_FlipToGDISurface(LPDIRECTDRAW2 This)
608 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
614 static HRESULT WINAPI
615 IDirectDraw4Impl_FlipToGDISurface(LPDIRECTDRAW4 This)
617 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
623 static HRESULT WINAPI
624 IDirectDrawImpl_GetCaps(LPDIRECTDRAW This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
626 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
627 IDirectDraw, IDirectDraw7,
628 This), pDDC1, pDDC2);
631 static HRESULT WINAPI
632 IDirectDraw2Impl_GetCaps(LPDIRECTDRAW2 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
634 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
635 IDirectDraw2, IDirectDraw7,
636 This), pDDC1, pDDC2);
639 static HRESULT WINAPI
640 IDirectDraw4Impl_GetCaps(LPDIRECTDRAW4 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
642 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
643 IDirectDraw4, IDirectDraw7,
644 This), pDDC1, pDDC2);
647 static HRESULT WINAPI
648 IDirectDrawImpl_GetDisplayMode(LPDIRECTDRAW This, LPDDSURFACEDESC pDDSD)
650 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
653 (LPDDSURFACEDESC2)pDDSD);
656 static HRESULT WINAPI
657 IDirectDraw2Impl_GetDisplayMode(LPDIRECTDRAW2 This, LPDDSURFACEDESC pDDSD)
659 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
662 (LPDDSURFACEDESC2)pDDSD);
665 static HRESULT WINAPI
666 IDirectDraw4Impl_GetDisplayMode(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pDDSD)
668 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
674 static HRESULT WINAPI
675 IDirectDrawImpl_GetFourCCCodes(LPDIRECTDRAW This, LPDWORD lpNumCodes,
678 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
682 lpNumCodes, lpCodes);
685 static HRESULT WINAPI
686 IDirectDraw2Impl_GetFourCCCodes(LPDIRECTDRAW2 This, LPDWORD lpNumCodes,
689 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
693 lpNumCodes, lpCodes);
696 static HRESULT WINAPI
697 IDirectDraw4Impl_GetFourCCCodes(LPDIRECTDRAW4 This, LPDWORD lpNumCodes,
700 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
704 lpNumCodes, lpCodes);
707 static HRESULT WINAPI
708 IDirectDrawImpl_GetGDISurface(LPDIRECTDRAW This, LPDIRECTDRAWSURFACE *ppSurf)
710 LPDIRECTDRAWSURFACE7 pSurf7;
713 hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
718 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
719 * IDirectDrawSurface vtable layout at the beginning */
720 *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
721 IDirectDrawSurface3, pSurf7);
726 static HRESULT WINAPI
727 IDirectDraw2Impl_GetGDISurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE *ppSurf)
729 LPDIRECTDRAWSURFACE7 pSurf7;
732 hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
737 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
738 * IDirectDrawSurface vtable layout at the beginning */
739 *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
740 IDirectDrawSurface3, pSurf7);
745 static HRESULT WINAPI
746 IDirectDraw4Impl_GetGDISurface(LPDIRECTDRAW4 This,
747 LPDIRECTDRAWSURFACE4 *ppSurf)
749 return IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
753 (LPDIRECTDRAWSURFACE7 *)ppSurf);
756 static HRESULT WINAPI
757 IDirectDrawImpl_GetMonitorFrequency(LPDIRECTDRAW This, LPDWORD pdwFreq)
759 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
766 static HRESULT WINAPI
767 IDirectDraw2Impl_GetMonitorFrequency(LPDIRECTDRAW2 This, LPDWORD pdwFreq)
769 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
776 static HRESULT WINAPI
777 IDirectDraw4Impl_GetMonitorFrequency(LPDIRECTDRAW4 This, LPDWORD pdwFreq)
779 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
786 static HRESULT WINAPI
787 IDirectDrawImpl_GetScanLine(LPDIRECTDRAW This, LPDWORD pdwLine)
789 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
795 static HRESULT WINAPI
796 IDirectDraw2Impl_GetScanLine(LPDIRECTDRAW2 This, LPDWORD pdwLine)
798 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
804 static HRESULT WINAPI
805 IDirectDraw4Impl_GetScanLine(LPDIRECTDRAW4 This, LPDWORD pdwLine)
807 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
813 static HRESULT WINAPI
814 IDirectDrawImpl_GetVerticalBlankStatus(LPDIRECTDRAW This, LPBOOL lpbIsInVB)
816 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
823 static HRESULT WINAPI
824 IDirectDraw2Impl_GetVerticalBlankStatus(LPDIRECTDRAW2 This, LPBOOL lpbIsInVB)
826 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
833 static HRESULT WINAPI
834 IDirectDraw4Impl_GetVerticalBlankStatus(LPDIRECTDRAW4 This, LPBOOL lpbIsInVB)
836 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
843 static HRESULT WINAPI
844 IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID)
846 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
849 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
854 static HRESULT WINAPI
855 IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID)
857 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
860 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
865 static HRESULT WINAPI
866 IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID)
868 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
871 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
877 static HRESULT WINAPI
878 IDirectDrawImpl_RestoreDisplayMode(LPDIRECTDRAW This)
880 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
886 static HRESULT WINAPI
887 IDirectDraw2Impl_RestoreDisplayMode(LPDIRECTDRAW2 This)
889 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
895 static HRESULT WINAPI
896 IDirectDraw4Impl_RestoreDisplayMode(LPDIRECTDRAW4 This)
898 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
904 static HRESULT WINAPI
905 IDirectDrawImpl_SetCooperativeLevel(LPDIRECTDRAW This, HWND hWnd,
908 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
915 static HRESULT WINAPI
916 IDirectDraw2Impl_SetCooperativeLevel(LPDIRECTDRAW2 This, HWND hWnd,
919 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
926 static HRESULT WINAPI
927 IDirectDraw4Impl_SetCooperativeLevel(LPDIRECTDRAW4 This, HWND hWnd,
930 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
937 static HRESULT WINAPI
938 IDirectDrawImpl_SetDisplayMode(LPDIRECTDRAW This, DWORD a, DWORD b, DWORD c)
940 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
947 static HRESULT WINAPI
948 IDirectDraw2Impl_SetDisplayMode(LPDIRECTDRAW2 This, DWORD a, DWORD b, DWORD c,
951 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
958 static HRESULT WINAPI
959 IDirectDraw4Impl_SetDisplayMode(LPDIRECTDRAW4 This, DWORD a, DWORD b, DWORD c,
962 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
969 static HRESULT WINAPI
970 IDirectDrawImpl_WaitForVerticalBlank(LPDIRECTDRAW This, DWORD dwFlags,
973 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
980 static HRESULT WINAPI
981 IDirectDraw2Impl_WaitForVerticalBlank(LPDIRECTDRAW2 This, DWORD dwFlags,
984 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
991 static HRESULT WINAPI
992 IDirectDraw4Impl_WaitForVerticalBlank(LPDIRECTDRAW4 This, DWORD dwFlags,
995 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
1002 static HRESULT WINAPI
1003 IDirectDraw2Impl_GetAvailableVidMem(LPDIRECTDRAW2 This, LPDDSCAPS pCaps,
1004 LPDWORD pdwTotal, LPDWORD pdwFree)
1007 DDRAW_Convert_DDSCAPS_1_To_2(pCaps, &Caps2);
1009 return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl,
1013 &Caps2, pdwTotal, pdwFree);
1016 static HRESULT WINAPI
1017 IDirectDraw4Impl_GetAvailableVidMem(LPDIRECTDRAW4 This, LPDDSCAPS2 pCaps,
1018 LPDWORD pdwTotal, LPDWORD pdwFree)
1020 return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl,
1024 pCaps, pdwTotal, pdwFree);
1027 static HRESULT WINAPI
1028 IDirectDraw4Impl_GetSurfaceFromDC(LPDIRECTDRAW4 This, HDC hDC,
1029 LPDIRECTDRAWSURFACE4 *pSurf)
1031 return IDirectDraw7_GetSurfaceFromDC(COM_INTERFACE_CAST(IDirectDrawImpl,
1035 hDC, (LPDIRECTDRAWSURFACE7 *)pSurf);
1038 static HRESULT WINAPI
1039 IDirectDraw4Impl_RestoreAllSurfaces(LPDIRECTDRAW4 This)
1041 return IDirectDraw7_RestoreAllSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
1047 static HRESULT WINAPI
1048 IDirectDraw4Impl_TestCooperativeLevel(LPDIRECTDRAW4 This)
1050 return IDirectDraw7_TestCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
1056 static HRESULT WINAPI
1057 IDirectDraw4Impl_GetDeviceIdentifier(LPDIRECTDRAW4 This,
1058 LPDDDEVICEIDENTIFIER pDDDI, DWORD dwFlags)
1060 DDDEVICEIDENTIFIER2 DDDI2;
1063 hr = IDirectDraw7_GetDeviceIdentifier(COM_INTERFACE_CAST(IDirectDrawImpl,
1069 DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(&DDDI2, pDDDI);
1074 const IDirectDrawVtbl IDirectDraw1_Vtbl =
1076 IDirectDrawImpl_QueryInterface,
1077 IDirectDrawImpl_AddRef,
1078 IDirectDrawImpl_Release,
1079 IDirectDrawImpl_Compact,
1080 IDirectDrawImpl_CreateClipper,
1081 IDirectDrawImpl_CreatePalette,
1082 IDirectDrawImpl_CreateSurface,
1083 IDirectDrawImpl_DuplicateSurface,
1084 IDirectDrawImpl_EnumDisplayModes,
1085 IDirectDrawImpl_EnumSurfaces,
1086 IDirectDrawImpl_FlipToGDISurface,
1087 IDirectDrawImpl_GetCaps,
1088 IDirectDrawImpl_GetDisplayMode,
1089 IDirectDrawImpl_GetFourCCCodes,
1090 IDirectDrawImpl_GetGDISurface,
1091 IDirectDrawImpl_GetMonitorFrequency,
1092 IDirectDrawImpl_GetScanLine,
1093 IDirectDrawImpl_GetVerticalBlankStatus,
1094 IDirectDrawImpl_Initialize,
1095 IDirectDrawImpl_RestoreDisplayMode,
1096 IDirectDrawImpl_SetCooperativeLevel,
1097 IDirectDrawImpl_SetDisplayMode,
1098 IDirectDrawImpl_WaitForVerticalBlank,
1101 const IDirectDraw2Vtbl IDirectDraw2_Vtbl =
1103 IDirectDraw2Impl_QueryInterface,
1104 IDirectDraw2Impl_AddRef,
1105 IDirectDraw2Impl_Release,
1106 IDirectDraw2Impl_Compact,
1107 IDirectDraw2Impl_CreateClipper,
1108 IDirectDraw2Impl_CreatePalette,
1109 IDirectDraw2Impl_CreateSurface,
1110 IDirectDraw2Impl_DuplicateSurface,
1111 IDirectDraw2Impl_EnumDisplayModes,
1112 IDirectDraw2Impl_EnumSurfaces,
1113 IDirectDraw2Impl_FlipToGDISurface,
1114 IDirectDraw2Impl_GetCaps,
1115 IDirectDraw2Impl_GetDisplayMode,
1116 IDirectDraw2Impl_GetFourCCCodes,
1117 IDirectDraw2Impl_GetGDISurface,
1118 IDirectDraw2Impl_GetMonitorFrequency,
1119 IDirectDraw2Impl_GetScanLine,
1120 IDirectDraw2Impl_GetVerticalBlankStatus,
1121 IDirectDraw2Impl_Initialize,
1122 IDirectDraw2Impl_RestoreDisplayMode,
1123 IDirectDraw2Impl_SetCooperativeLevel,
1124 IDirectDraw2Impl_SetDisplayMode,
1125 IDirectDraw2Impl_WaitForVerticalBlank,
1126 IDirectDraw2Impl_GetAvailableVidMem
1129 const IDirectDraw4Vtbl IDirectDraw4_Vtbl =
1131 IDirectDraw4Impl_QueryInterface,
1132 IDirectDraw4Impl_AddRef,
1133 IDirectDraw4Impl_Release,
1134 IDirectDraw4Impl_Compact,
1135 IDirectDraw4Impl_CreateClipper,
1136 IDirectDraw4Impl_CreatePalette,
1137 IDirectDraw4Impl_CreateSurface,
1138 IDirectDraw4Impl_DuplicateSurface,
1139 IDirectDraw4Impl_EnumDisplayModes,
1140 IDirectDraw4Impl_EnumSurfaces,
1141 IDirectDraw4Impl_FlipToGDISurface,
1142 IDirectDraw4Impl_GetCaps,
1143 IDirectDraw4Impl_GetDisplayMode,
1144 IDirectDraw4Impl_GetFourCCCodes,
1145 IDirectDraw4Impl_GetGDISurface,
1146 IDirectDraw4Impl_GetMonitorFrequency,
1147 IDirectDraw4Impl_GetScanLine,
1148 IDirectDraw4Impl_GetVerticalBlankStatus,
1149 IDirectDraw4Impl_Initialize,
1150 IDirectDraw4Impl_RestoreDisplayMode,
1151 IDirectDraw4Impl_SetCooperativeLevel,
1152 IDirectDraw4Impl_SetDisplayMode,
1153 IDirectDraw4Impl_WaitForVerticalBlank,
1154 IDirectDraw4Impl_GetAvailableVidMem,
1155 IDirectDraw4Impl_GetSurfaceFromDC,
1156 IDirectDraw4Impl_RestoreAllSurfaces,
1157 IDirectDraw4Impl_TestCooperativeLevel,
1158 IDirectDraw4Impl_GetDeviceIdentifier