dbghelp: Dwarf & parse context.
[wine.git] / dlls / ddraw / ddraw_thunks.c
blob883411310dd92c444c752b059634d9e8d23a785a
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"
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "ddraw.h"
27 #include "ddraw_private.h"
28 #include "ddcomimpl.h"
30 static HRESULT WINAPI
31 IDirectDrawImpl_QueryInterface(LPDIRECTDRAW This, REFIID iid, LPVOID *ppObj)
33 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
34 IDirectDraw,
35 IDirectDraw7, This),
36 iid, ppObj);
39 static HRESULT WINAPI
40 IDirectDraw2Impl_QueryInterface(LPDIRECTDRAW2 This, REFIID iid, LPVOID *ppObj)
42 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
43 IDirectDraw2,
44 IDirectDraw7, This),
45 iid, ppObj);
49 static HRESULT WINAPI
50 IDirectDraw4Impl_QueryInterface(LPDIRECTDRAW4 This, REFIID iid, LPVOID *ppObj)
52 return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl,
53 IDirectDraw4,
54 IDirectDraw7, This),
55 iid, ppObj);
58 static ULONG WINAPI
59 IDirectDrawImpl_AddRef(LPDIRECTDRAW This)
61 return IDirectDraw7_AddRef(COM_INTERFACE_CAST(IDirectDrawImpl,
62 IDirectDraw, IDirectDraw7,
63 This));
66 static ULONG WINAPI
67 IDirectDraw2Impl_AddRef(LPDIRECTDRAW2 This)
69 return IDirectDraw7_AddRef(COM_INTERFACE_CAST(IDirectDrawImpl,
70 IDirectDraw2, IDirectDraw7,
71 This));
74 static ULONG WINAPI
75 IDirectDraw4Impl_AddRef(LPDIRECTDRAW4 This)
77 return IDirectDraw7_AddRef(COM_INTERFACE_CAST(IDirectDrawImpl,
78 IDirectDraw4, IDirectDraw7,
79 This));
82 static ULONG WINAPI
83 IDirectDrawImpl_Release(LPDIRECTDRAW This)
85 return IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
86 IDirectDraw, IDirectDraw7,
87 This));
90 static ULONG WINAPI
91 IDirectDraw2Impl_Release(LPDIRECTDRAW2 This)
93 return IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
94 IDirectDraw2, IDirectDraw7,
95 This));
98 static ULONG WINAPI
99 IDirectDraw4Impl_Release(LPDIRECTDRAW4 This)
101 return IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
102 IDirectDraw4, IDirectDraw7,
103 This));
106 static HRESULT WINAPI
107 IDirectDrawImpl_Compact(LPDIRECTDRAW This)
109 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
110 IDirectDraw, IDirectDraw7,
111 This));
114 static HRESULT WINAPI
115 IDirectDraw2Impl_Compact(LPDIRECTDRAW2 This)
117 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
118 IDirectDraw2, IDirectDraw7,
119 This));
122 static HRESULT WINAPI
123 IDirectDraw4Impl_Compact(LPDIRECTDRAW4 This)
125 return IDirectDraw7_Compact(COM_INTERFACE_CAST(IDirectDrawImpl,
126 IDirectDraw4, IDirectDraw7,
127 This));
130 static HRESULT WINAPI
131 IDirectDrawImpl_CreateClipper(LPDIRECTDRAW This, DWORD dwFlags,
132 LPDIRECTDRAWCLIPPER *ppClipper,
133 IUnknown *pUnkOuter)
135 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
136 IDirectDraw,
137 IDirectDraw7,
138 This),
139 dwFlags, ppClipper, pUnkOuter);
142 static HRESULT WINAPI
143 IDirectDraw2Impl_CreateClipper(LPDIRECTDRAW2 This, DWORD dwFlags,
144 LPDIRECTDRAWCLIPPER *ppClipper,
145 IUnknown *pUnkOuter)
147 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
148 IDirectDraw2,
149 IDirectDraw7,
150 This),
151 dwFlags, ppClipper, pUnkOuter);
154 static HRESULT WINAPI
155 IDirectDraw4Impl_CreateClipper(LPDIRECTDRAW4 This, DWORD dwFlags,
156 LPDIRECTDRAWCLIPPER *ppClipper,
157 IUnknown *pUnkOuter)
159 return IDirectDraw7_CreateClipper(COM_INTERFACE_CAST(IDirectDrawImpl,
160 IDirectDraw4,
161 IDirectDraw7,
162 This),
163 dwFlags, ppClipper, pUnkOuter);
166 static HRESULT WINAPI
167 IDirectDrawImpl_CreatePalette(LPDIRECTDRAW This, DWORD dwFlags,
168 LPPALETTEENTRY pEntries,
169 LPDIRECTDRAWPALETTE *ppPalette,
170 IUnknown *pUnkOuter)
172 return IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
173 IDirectDraw,
174 IDirectDraw7,
175 This),
176 dwFlags, pEntries, ppPalette, pUnkOuter);
179 static HRESULT WINAPI
180 IDirectDraw2Impl_CreatePalette(LPDIRECTDRAW2 This, DWORD dwFlags,
181 LPPALETTEENTRY pEntries,
182 LPDIRECTDRAWPALETTE *ppPalette,
183 IUnknown *pUnkOuter)
185 return IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
186 IDirectDraw2,
187 IDirectDraw7,
188 This),
189 dwFlags, pEntries, ppPalette, pUnkOuter);
192 static HRESULT WINAPI
193 IDirectDraw4Impl_CreatePalette(LPDIRECTDRAW4 This, DWORD dwFlags,
194 LPPALETTEENTRY pEntries,
195 LPDIRECTDRAWPALETTE *ppPalette,
196 IUnknown *pUnkOuter)
198 return IDirectDraw7_CreatePalette(COM_INTERFACE_CAST(IDirectDrawImpl,
199 IDirectDraw4,
200 IDirectDraw7,
201 This),
202 dwFlags, pEntries, ppPalette, pUnkOuter);
205 static HRESULT WINAPI
206 IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
207 LPDIRECTDRAWSURFACE *ppSurface,
208 IUnknown *pUnkOuter)
210 LPDIRECTDRAWSURFACE7 pSurface7;
211 IDirectDrawSurfaceImpl *impl;
212 HRESULT hr;
214 /* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok,
215 * since the data layout is the same */
216 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
217 IDirectDraw,
218 IDirectDraw7,
219 This),
220 (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
222 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
223 * IDirectDrawSurface vtable layout at the beginning */
224 *ppSurface = (LPDIRECTDRAWSURFACE) COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
225 IDirectDrawSurface7, IDirectDrawSurface3,
226 pSurface7);
228 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
229 if(impl)
231 impl->version = 1;
234 return hr;
237 static HRESULT WINAPI
238 IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc,
239 LPDIRECTDRAWSURFACE *ppSurface,
240 IUnknown *pUnkOuter)
242 LPDIRECTDRAWSURFACE7 pSurface7;
243 IDirectDrawSurfaceImpl *impl;
244 HRESULT hr;
246 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
247 IDirectDraw2,
248 IDirectDraw7,
249 This),
250 (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
252 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
253 * IDirectDrawSurface vtable layout at the beginning */
254 *ppSurface = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
255 IDirectDrawSurface7, IDirectDrawSurface3,
256 pSurface7);
258 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
259 if(impl)
261 impl->version = 2;
264 return hr;
267 static HRESULT WINAPI
268 IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc,
269 LPDIRECTDRAWSURFACE4 *ppSurface,
270 IUnknown *pUnkOuter)
272 HRESULT hr;
273 IDirectDrawSurfaceImpl *impl;
275 hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
276 IDirectDraw4,
277 IDirectDraw7,
278 This),
279 pSDesc,
280 (LPDIRECTDRAWSURFACE7 *)ppSurface,
281 pUnkOuter);
282 impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurface);
283 if(impl)
285 impl->version = 4;
287 return hr;
290 static HRESULT WINAPI
291 IDirectDrawImpl_DuplicateSurface(LPDIRECTDRAW This, LPDIRECTDRAWSURFACE pSrc,
292 LPDIRECTDRAWSURFACE *ppDst)
294 LPDIRECTDRAWSURFACE7 pDst7;
295 HRESULT hr;
297 hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
298 IDirectDraw,
299 IDirectDraw7, This),
300 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
301 IDirectDrawSurface3,
302 IDirectDrawSurface7,
303 pSrc),
304 &pDst7);
306 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
307 * IDirectDrawSurface vtable layout at the beginning */
308 *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
309 IDirectDrawSurface3, pDst7);
311 return hr;
314 static HRESULT WINAPI
315 IDirectDraw2Impl_DuplicateSurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE pSrc,
316 LPDIRECTDRAWSURFACE *ppDst)
318 LPDIRECTDRAWSURFACE7 pDst7;
319 HRESULT hr;
321 hr = IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
322 IDirectDraw2,
323 IDirectDraw7, This),
324 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
325 IDirectDrawSurface3,
326 IDirectDrawSurface7,
327 pSrc),
328 &pDst7);
330 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
331 * IDirectDrawSurface vtable layout at the beginning */
332 *ppDst = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
333 IDirectDrawSurface3, pDst7);
335 return hr;
338 static HRESULT WINAPI
339 IDirectDraw4Impl_DuplicateSurface(LPDIRECTDRAW4 This,
340 LPDIRECTDRAWSURFACE4 pSrc,
341 LPDIRECTDRAWSURFACE4 *ppDst)
343 return IDirectDraw7_DuplicateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
344 IDirectDraw4,
345 IDirectDraw7,
346 This),
347 (LPDIRECTDRAWSURFACE7)pSrc,
348 (LPDIRECTDRAWSURFACE7 *)ppDst);
351 struct displaymodescallback_context
353 LPDDENUMMODESCALLBACK func;
354 LPVOID context;
357 static HRESULT CALLBACK
358 EnumDisplayModesCallbackThunk(LPDDSURFACEDESC2 pDDSD2, LPVOID context)
360 DDSURFACEDESC DDSD;
361 struct displaymodescallback_context *cbcontext = context;
363 memcpy(&DDSD,pDDSD2,sizeof(DDSD));
364 DDSD.dwSize = sizeof(DDSD);
366 return cbcontext->func(&DDSD, cbcontext->context);
369 static HRESULT WINAPI
370 IDirectDrawImpl_EnumDisplayModes(LPDIRECTDRAW This, DWORD dwFlags,
371 LPDDSURFACEDESC pDDSD, LPVOID context,
372 LPDDENUMMODESCALLBACK cb)
374 struct displaymodescallback_context cbcontext;
376 cbcontext.func = cb;
377 cbcontext.context = context;
379 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
380 IDirectDraw,
381 IDirectDraw7,
382 This),
383 dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext,
384 EnumDisplayModesCallbackThunk);
387 static HRESULT WINAPI
388 IDirectDraw2Impl_EnumDisplayModes(LPDIRECTDRAW2 This, DWORD dwFlags,
389 LPDDSURFACEDESC pDDSD, LPVOID context,
390 LPDDENUMMODESCALLBACK cb)
392 struct displaymodescallback_context cbcontext;
394 cbcontext.func = cb;
395 cbcontext.context = context;
397 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
398 IDirectDraw2,
399 IDirectDraw7,
400 This),
401 dwFlags, (LPDDSURFACEDESC2)pDDSD, &cbcontext,
402 EnumDisplayModesCallbackThunk);
405 static HRESULT WINAPI
406 IDirectDraw4Impl_EnumDisplayModes(LPDIRECTDRAW4 This, DWORD dwFlags,
407 LPDDSURFACEDESC2 pDDSD, LPVOID context,
408 LPDDENUMMODESCALLBACK2 cb)
410 return IDirectDraw7_EnumDisplayModes(COM_INTERFACE_CAST(IDirectDrawImpl,
411 IDirectDraw4,
412 IDirectDraw7,
413 This),
414 dwFlags, pDDSD, context, cb);
417 struct surfacescallback_context
419 LPDDENUMSURFACESCALLBACK func;
420 LPVOID context;
423 static HRESULT CALLBACK
424 EnumSurfacesCallbackThunk(LPDIRECTDRAWSURFACE7 pSurf, LPDDSURFACEDESC2 pDDSD,
425 LPVOID context)
427 struct surfacescallback_context *cbcontext = context;
429 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
430 * IDirectDrawSurface vtable layout at the beginning */
431 return cbcontext->func((LPDIRECTDRAWSURFACE)
432 COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
433 IDirectDrawSurface7,
434 IDirectDrawSurface3, pSurf),
435 (LPDDSURFACEDESC)pDDSD, cbcontext->context);
438 static HRESULT WINAPI
439 IDirectDrawImpl_EnumSurfaces(LPDIRECTDRAW This, DWORD dwFlags,
440 LPDDSURFACEDESC pDDSD, LPVOID context,
441 LPDDENUMSURFACESCALLBACK cb)
443 struct surfacescallback_context cbcontext;
445 cbcontext.func = cb;
446 cbcontext.context = context;
448 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
449 IDirectDraw,
450 IDirectDraw7, This),
451 dwFlags, (LPDDSURFACEDESC2)pDDSD,
452 &cbcontext, EnumSurfacesCallbackThunk);
455 static HRESULT WINAPI
456 IDirectDraw2Impl_EnumSurfaces(LPDIRECTDRAW2 This, DWORD dwFlags,
457 LPDDSURFACEDESC pDDSD, LPVOID context,
458 LPDDENUMSURFACESCALLBACK cb)
460 struct surfacescallback_context cbcontext;
462 cbcontext.func = cb;
463 cbcontext.context = context;
465 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
466 IDirectDraw2,
467 IDirectDraw7, This),
468 dwFlags, (LPDDSURFACEDESC2)pDDSD,
469 &cbcontext, EnumSurfacesCallbackThunk);
472 static HRESULT WINAPI
473 IDirectDraw4Impl_EnumSurfaces(LPDIRECTDRAW4 This, DWORD dwFlags,
474 LPDDSURFACEDESC2 pDDSD, LPVOID context,
475 LPDDENUMSURFACESCALLBACK2 cb)
477 return IDirectDraw7_EnumSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
478 IDirectDraw4,
479 IDirectDraw7, This),
480 dwFlags, pDDSD, context,
481 (LPDDENUMSURFACESCALLBACK7)cb);
484 static HRESULT WINAPI
485 IDirectDrawImpl_FlipToGDISurface(LPDIRECTDRAW This)
487 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
488 IDirectDraw,
489 IDirectDraw7,
490 This));
493 static HRESULT WINAPI
494 IDirectDraw2Impl_FlipToGDISurface(LPDIRECTDRAW2 This)
496 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
497 IDirectDraw2,
498 IDirectDraw7,
499 This));
502 static HRESULT WINAPI
503 IDirectDraw4Impl_FlipToGDISurface(LPDIRECTDRAW4 This)
505 return IDirectDraw7_FlipToGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
506 IDirectDraw4,
507 IDirectDraw7,
508 This));
511 static HRESULT WINAPI
512 IDirectDrawImpl_GetCaps(LPDIRECTDRAW This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
514 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
515 IDirectDraw, IDirectDraw7,
516 This), pDDC1, pDDC2);
519 static HRESULT WINAPI
520 IDirectDraw2Impl_GetCaps(LPDIRECTDRAW2 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
522 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
523 IDirectDraw2, IDirectDraw7,
524 This), pDDC1, pDDC2);
527 static HRESULT WINAPI
528 IDirectDraw4Impl_GetCaps(LPDIRECTDRAW4 This, LPDDCAPS pDDC1, LPDDCAPS pDDC2)
530 return IDirectDraw7_GetCaps(COM_INTERFACE_CAST(IDirectDrawImpl,
531 IDirectDraw4, IDirectDraw7,
532 This), pDDC1, pDDC2);
535 static HRESULT WINAPI
536 IDirectDrawImpl_GetDisplayMode(LPDIRECTDRAW This, LPDDSURFACEDESC pDDSD)
538 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
539 IDirectDraw,
540 IDirectDraw7, This),
541 (LPDDSURFACEDESC2)pDDSD);
544 static HRESULT WINAPI
545 IDirectDraw2Impl_GetDisplayMode(LPDIRECTDRAW2 This, LPDDSURFACEDESC pDDSD)
547 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
548 IDirectDraw2,
549 IDirectDraw7, This),
550 (LPDDSURFACEDESC2)pDDSD);
553 static HRESULT WINAPI
554 IDirectDraw4Impl_GetDisplayMode(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pDDSD)
556 return IDirectDraw7_GetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
557 IDirectDraw4,
558 IDirectDraw7, This),
559 pDDSD);
562 static HRESULT WINAPI
563 IDirectDrawImpl_GetFourCCCodes(LPDIRECTDRAW This, LPDWORD lpNumCodes,
564 LPDWORD lpCodes)
566 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
567 IDirectDraw,
568 IDirectDraw7,
569 This),
570 lpNumCodes, lpCodes);
573 static HRESULT WINAPI
574 IDirectDraw2Impl_GetFourCCCodes(LPDIRECTDRAW2 This, LPDWORD lpNumCodes,
575 LPDWORD lpCodes)
577 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
578 IDirectDraw2,
579 IDirectDraw7,
580 This),
581 lpNumCodes, lpCodes);
584 static HRESULT WINAPI
585 IDirectDraw4Impl_GetFourCCCodes(LPDIRECTDRAW4 This, LPDWORD lpNumCodes,
586 LPDWORD lpCodes)
588 return IDirectDraw7_GetFourCCCodes(COM_INTERFACE_CAST(IDirectDrawImpl,
589 IDirectDraw4,
590 IDirectDraw7,
591 This),
592 lpNumCodes, lpCodes);
595 static HRESULT WINAPI
596 IDirectDrawImpl_GetGDISurface(LPDIRECTDRAW This, LPDIRECTDRAWSURFACE *ppSurf)
598 LPDIRECTDRAWSURFACE7 pSurf7;
599 HRESULT hr;
601 hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
602 IDirectDraw,
603 IDirectDraw7,
604 This), &pSurf7);
606 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
607 * IDirectDrawSurface vtable layout at the beginning */
608 *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
609 IDirectDrawSurface3, pSurf7);
611 return hr;
614 static HRESULT WINAPI
615 IDirectDraw2Impl_GetGDISurface(LPDIRECTDRAW2 This, LPDIRECTDRAWSURFACE *ppSurf)
617 LPDIRECTDRAWSURFACE7 pSurf7;
618 HRESULT hr;
620 hr = IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
621 IDirectDraw2,
622 IDirectDraw7,
623 This), &pSurf7);
625 /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
626 * IDirectDrawSurface vtable layout at the beginning */
627 *ppSurf = (LPDIRECTDRAWSURFACE)COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
628 IDirectDrawSurface3, pSurf7);
630 return hr;
633 static HRESULT WINAPI
634 IDirectDraw4Impl_GetGDISurface(LPDIRECTDRAW4 This,
635 LPDIRECTDRAWSURFACE4 *ppSurf)
637 return IDirectDraw7_GetGDISurface(COM_INTERFACE_CAST(IDirectDrawImpl,
638 IDirectDraw4,
639 IDirectDraw7,
640 This),
641 (LPDIRECTDRAWSURFACE7 *)ppSurf);
644 static HRESULT WINAPI
645 IDirectDrawImpl_GetMonitorFrequency(LPDIRECTDRAW This, LPDWORD pdwFreq)
647 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
648 IDirectDraw,
649 IDirectDraw7,
650 This),
651 pdwFreq);
654 static HRESULT WINAPI
655 IDirectDraw2Impl_GetMonitorFrequency(LPDIRECTDRAW2 This, LPDWORD pdwFreq)
657 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
658 IDirectDraw2,
659 IDirectDraw7,
660 This),
661 pdwFreq);
664 static HRESULT WINAPI
665 IDirectDraw4Impl_GetMonitorFrequency(LPDIRECTDRAW4 This, LPDWORD pdwFreq)
667 return IDirectDraw7_GetMonitorFrequency(COM_INTERFACE_CAST(IDirectDrawImpl,
668 IDirectDraw4,
669 IDirectDraw7,
670 This),
671 pdwFreq);
674 static HRESULT WINAPI
675 IDirectDrawImpl_GetScanLine(LPDIRECTDRAW This, LPDWORD pdwLine)
677 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
678 IDirectDraw,
679 IDirectDraw7,
680 This), pdwLine);
683 static HRESULT WINAPI
684 IDirectDraw2Impl_GetScanLine(LPDIRECTDRAW2 This, LPDWORD pdwLine)
686 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
687 IDirectDraw2,
688 IDirectDraw7,
689 This), pdwLine);
692 static HRESULT WINAPI
693 IDirectDraw4Impl_GetScanLine(LPDIRECTDRAW4 This, LPDWORD pdwLine)
695 return IDirectDraw7_GetScanLine(COM_INTERFACE_CAST(IDirectDrawImpl,
696 IDirectDraw4,
697 IDirectDraw7,
698 This), pdwLine);
701 static HRESULT WINAPI
702 IDirectDrawImpl_GetVerticalBlankStatus(LPDIRECTDRAW This, LPBOOL lpbIsInVB)
704 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
705 IDirectDraw,
706 IDirectDraw7,
707 This),
708 lpbIsInVB);
711 static HRESULT WINAPI
712 IDirectDraw2Impl_GetVerticalBlankStatus(LPDIRECTDRAW2 This, LPBOOL lpbIsInVB)
714 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
715 IDirectDraw2,
716 IDirectDraw7,
717 This),
718 lpbIsInVB);
721 static HRESULT WINAPI
722 IDirectDraw4Impl_GetVerticalBlankStatus(LPDIRECTDRAW4 This, LPBOOL lpbIsInVB)
724 return IDirectDraw7_GetVerticalBlankStatus(COM_INTERFACE_CAST(IDirectDrawImpl,
725 IDirectDraw4,
726 IDirectDraw7,
727 This),
728 lpbIsInVB);
731 static HRESULT WINAPI
732 IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID)
734 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface);
735 HRESULT ret_value;
737 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
739 return ret_value;
742 static HRESULT WINAPI
743 IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID)
745 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface);
746 HRESULT ret_value;
748 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
750 return ret_value;
753 static HRESULT WINAPI
754 IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID)
756 ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface);
757 HRESULT ret_value;
759 ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID);
761 return ret_value;
765 static HRESULT WINAPI
766 IDirectDrawImpl_RestoreDisplayMode(LPDIRECTDRAW This)
768 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
769 IDirectDraw,
770 IDirectDraw7,
771 This));
774 static HRESULT WINAPI
775 IDirectDraw2Impl_RestoreDisplayMode(LPDIRECTDRAW2 This)
777 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
778 IDirectDraw2,
779 IDirectDraw7,
780 This));
783 static HRESULT WINAPI
784 IDirectDraw4Impl_RestoreDisplayMode(LPDIRECTDRAW4 This)
786 return IDirectDraw7_RestoreDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
787 IDirectDraw4,
788 IDirectDraw7,
789 This));
792 static HRESULT WINAPI
793 IDirectDrawImpl_SetCooperativeLevel(LPDIRECTDRAW This, HWND hWnd,
794 DWORD dwFlags)
796 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
797 IDirectDraw,
798 IDirectDraw7,
799 This),
800 hWnd, dwFlags);
803 static HRESULT WINAPI
804 IDirectDraw2Impl_SetCooperativeLevel(LPDIRECTDRAW2 This, HWND hWnd,
805 DWORD dwFlags)
807 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
808 IDirectDraw2,
809 IDirectDraw7,
810 This),
811 hWnd, dwFlags);
814 static HRESULT WINAPI
815 IDirectDraw4Impl_SetCooperativeLevel(LPDIRECTDRAW4 This, HWND hWnd,
816 DWORD dwFlags)
818 return IDirectDraw7_SetCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
819 IDirectDraw4,
820 IDirectDraw7,
821 This),
822 hWnd, dwFlags);
825 static HRESULT WINAPI
826 IDirectDrawImpl_SetDisplayMode(LPDIRECTDRAW This, DWORD a, DWORD b, DWORD c)
828 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
829 IDirectDraw,
830 IDirectDraw7,
831 This),
832 a, b, c, 0, 0);
835 static HRESULT WINAPI
836 IDirectDraw2Impl_SetDisplayMode(LPDIRECTDRAW2 This, DWORD a, DWORD b, DWORD c,
837 DWORD d, DWORD e)
839 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
840 IDirectDraw2,
841 IDirectDraw7,
842 This),
843 a, b, c, d, e);
846 static HRESULT WINAPI
847 IDirectDraw4Impl_SetDisplayMode(LPDIRECTDRAW4 This, DWORD a, DWORD b, DWORD c,
848 DWORD d, DWORD e)
850 return IDirectDraw7_SetDisplayMode(COM_INTERFACE_CAST(IDirectDrawImpl,
851 IDirectDraw4,
852 IDirectDraw7,
853 This),
854 a, b, c, d, e);
857 static HRESULT WINAPI
858 IDirectDrawImpl_WaitForVerticalBlank(LPDIRECTDRAW This, DWORD dwFlags,
859 HANDLE hEvent)
861 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
862 IDirectDraw,
863 IDirectDraw7,
864 This),
865 dwFlags, hEvent);
868 static HRESULT WINAPI
869 IDirectDraw2Impl_WaitForVerticalBlank(LPDIRECTDRAW2 This, DWORD dwFlags,
870 HANDLE hEvent)
872 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
873 IDirectDraw2,
874 IDirectDraw7,
875 This),
876 dwFlags, hEvent);
879 static HRESULT WINAPI
880 IDirectDraw4Impl_WaitForVerticalBlank(LPDIRECTDRAW4 This, DWORD dwFlags,
881 HANDLE hEvent)
883 return IDirectDraw7_WaitForVerticalBlank(COM_INTERFACE_CAST(IDirectDrawImpl,
884 IDirectDraw4,
885 IDirectDraw7,
886 This),
887 dwFlags, hEvent);
890 static HRESULT WINAPI
891 IDirectDraw2Impl_GetAvailableVidMem(LPDIRECTDRAW2 This, LPDDSCAPS pCaps,
892 LPDWORD pdwTotal, LPDWORD pdwFree)
894 DDSCAPS2 Caps2;
895 DDRAW_Convert_DDSCAPS_1_To_2(pCaps, &Caps2);
897 return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl,
898 IDirectDraw2,
899 IDirectDraw7,
900 This),
901 &Caps2, pdwTotal, pdwFree);
904 static HRESULT WINAPI
905 IDirectDraw4Impl_GetAvailableVidMem(LPDIRECTDRAW4 This, LPDDSCAPS2 pCaps,
906 LPDWORD pdwTotal, LPDWORD pdwFree)
908 return IDirectDraw7_GetAvailableVidMem(COM_INTERFACE_CAST(IDirectDrawImpl,
909 IDirectDraw4,
910 IDirectDraw7,
911 This),
912 pCaps, pdwTotal, pdwFree);
915 static HRESULT WINAPI
916 IDirectDraw4Impl_GetSurfaceFromDC(LPDIRECTDRAW4 This, HDC hDC,
917 LPDIRECTDRAWSURFACE4 *pSurf)
919 return IDirectDraw7_GetSurfaceFromDC(COM_INTERFACE_CAST(IDirectDrawImpl,
920 IDirectDraw4,
921 IDirectDraw7,
922 This),
923 hDC, (LPDIRECTDRAWSURFACE7 *)pSurf);
926 static HRESULT WINAPI
927 IDirectDraw4Impl_RestoreAllSurfaces(LPDIRECTDRAW4 This)
929 return IDirectDraw7_RestoreAllSurfaces(COM_INTERFACE_CAST(IDirectDrawImpl,
930 IDirectDraw4,
931 IDirectDraw7,
932 This));
935 static HRESULT WINAPI
936 IDirectDraw4Impl_TestCooperativeLevel(LPDIRECTDRAW4 This)
938 return IDirectDraw7_TestCooperativeLevel(COM_INTERFACE_CAST(IDirectDrawImpl,
939 IDirectDraw4,
940 IDirectDraw7,
941 This));
944 static HRESULT WINAPI
945 IDirectDraw4Impl_GetDeviceIdentifier(LPDIRECTDRAW4 This,
946 LPDDDEVICEIDENTIFIER pDDDI, DWORD dwFlags)
948 DDDEVICEIDENTIFIER2 DDDI2;
949 HRESULT hr;
951 hr = IDirectDraw7_GetDeviceIdentifier(COM_INTERFACE_CAST(IDirectDrawImpl,
952 IDirectDraw4,
953 IDirectDraw7,
954 This),
955 &DDDI2, dwFlags);
957 DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(&DDDI2, pDDDI);
959 return hr;
962 const IDirectDrawVtbl IDirectDraw1_Vtbl =
964 IDirectDrawImpl_QueryInterface,
965 IDirectDrawImpl_AddRef,
966 IDirectDrawImpl_Release,
967 IDirectDrawImpl_Compact,
968 IDirectDrawImpl_CreateClipper,
969 IDirectDrawImpl_CreatePalette,
970 IDirectDrawImpl_CreateSurface,
971 IDirectDrawImpl_DuplicateSurface,
972 IDirectDrawImpl_EnumDisplayModes,
973 IDirectDrawImpl_EnumSurfaces,
974 IDirectDrawImpl_FlipToGDISurface,
975 IDirectDrawImpl_GetCaps,
976 IDirectDrawImpl_GetDisplayMode,
977 IDirectDrawImpl_GetFourCCCodes,
978 IDirectDrawImpl_GetGDISurface,
979 IDirectDrawImpl_GetMonitorFrequency,
980 IDirectDrawImpl_GetScanLine,
981 IDirectDrawImpl_GetVerticalBlankStatus,
982 IDirectDrawImpl_Initialize,
983 IDirectDrawImpl_RestoreDisplayMode,
984 IDirectDrawImpl_SetCooperativeLevel,
985 IDirectDrawImpl_SetDisplayMode,
986 IDirectDrawImpl_WaitForVerticalBlank,
989 const IDirectDraw2Vtbl IDirectDraw2_Vtbl =
991 IDirectDraw2Impl_QueryInterface,
992 IDirectDraw2Impl_AddRef,
993 IDirectDraw2Impl_Release,
994 IDirectDraw2Impl_Compact,
995 IDirectDraw2Impl_CreateClipper,
996 IDirectDraw2Impl_CreatePalette,
997 IDirectDraw2Impl_CreateSurface,
998 IDirectDraw2Impl_DuplicateSurface,
999 IDirectDraw2Impl_EnumDisplayModes,
1000 IDirectDraw2Impl_EnumSurfaces,
1001 IDirectDraw2Impl_FlipToGDISurface,
1002 IDirectDraw2Impl_GetCaps,
1003 IDirectDraw2Impl_GetDisplayMode,
1004 IDirectDraw2Impl_GetFourCCCodes,
1005 IDirectDraw2Impl_GetGDISurface,
1006 IDirectDraw2Impl_GetMonitorFrequency,
1007 IDirectDraw2Impl_GetScanLine,
1008 IDirectDraw2Impl_GetVerticalBlankStatus,
1009 IDirectDraw2Impl_Initialize,
1010 IDirectDraw2Impl_RestoreDisplayMode,
1011 IDirectDraw2Impl_SetCooperativeLevel,
1012 IDirectDraw2Impl_SetDisplayMode,
1013 IDirectDraw2Impl_WaitForVerticalBlank,
1014 IDirectDraw2Impl_GetAvailableVidMem
1017 const IDirectDraw4Vtbl IDirectDraw4_Vtbl =
1019 IDirectDraw4Impl_QueryInterface,
1020 IDirectDraw4Impl_AddRef,
1021 IDirectDraw4Impl_Release,
1022 IDirectDraw4Impl_Compact,
1023 IDirectDraw4Impl_CreateClipper,
1024 IDirectDraw4Impl_CreatePalette,
1025 IDirectDraw4Impl_CreateSurface,
1026 IDirectDraw4Impl_DuplicateSurface,
1027 IDirectDraw4Impl_EnumDisplayModes,
1028 IDirectDraw4Impl_EnumSurfaces,
1029 IDirectDraw4Impl_FlipToGDISurface,
1030 IDirectDraw4Impl_GetCaps,
1031 IDirectDraw4Impl_GetDisplayMode,
1032 IDirectDraw4Impl_GetFourCCCodes,
1033 IDirectDraw4Impl_GetGDISurface,
1034 IDirectDraw4Impl_GetMonitorFrequency,
1035 IDirectDraw4Impl_GetScanLine,
1036 IDirectDraw4Impl_GetVerticalBlankStatus,
1037 IDirectDraw4Impl_Initialize,
1038 IDirectDraw4Impl_RestoreDisplayMode,
1039 IDirectDraw4Impl_SetCooperativeLevel,
1040 IDirectDraw4Impl_SetDisplayMode,
1041 IDirectDraw4Impl_WaitForVerticalBlank,
1042 IDirectDraw4Impl_GetAvailableVidMem,
1043 IDirectDraw4Impl_GetSurfaceFromDC,
1044 IDirectDraw4Impl_RestoreAllSurfaces,
1045 IDirectDraw4Impl_TestCooperativeLevel,
1046 IDirectDraw4Impl_GetDeviceIdentifier