1 /* DirectDraw IDirectDraw interface (generic)
3 * Copyright 1997-2000 Marcus Meissner
4 * Copyright 1998-2000 Lionel Ulmer (most of Direct3D stuff)
5 * Copyright 2000-2001 TransGaming Technologies Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * This file contains all the interface functions that are shared between
24 * all interfaces. Or better, it is a "common stub" library for the
25 * IDirectDraw* objects
36 #include "wine/debug.h"
38 #include "ddraw_private.h"
39 #include "ddraw/main.h"
40 #include "dclipper/main.h"
41 #include "dpalette/main.h"
42 #include "dsurface/main.h"
43 #include "dsurface/dib.h"
44 #include "dsurface/fakezbuffer.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
48 extern ICOM_VTABLE(IDirectDraw) DDRAW_IDirectDraw_VTable;
49 extern ICOM_VTABLE(IDirectDraw2) DDRAW_IDirectDraw2_VTable;
50 extern ICOM_VTABLE(IDirectDraw4) DDRAW_IDirectDraw4_VTable;
52 static void DDRAW_UnsubclassWindow(IDirectDrawImpl* This);
54 static void Main_DirectDraw_DeleteSurfaces(IDirectDrawImpl* This);
55 static void Main_DirectDraw_DeleteClippers(IDirectDrawImpl* This);
56 static void Main_DirectDraw_DeletePalettes(IDirectDrawImpl* This);
57 static void LosePrimarySurface(IDirectDrawImpl* This);
59 static const char ddProp[] = "WINE_DDRAW_Property";
61 /* Not called from the vtable. */
62 HRESULT Main_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
64 /* NOTE: The creator must use HEAP_ZERO_MEMORY or equivalent. */
68 if (ex) This->local.dwLocalFlags |= DDRAWILCL_DIRECTDRAW7;
69 This->local.dwProcessId = GetCurrentProcessId();
71 This->final_release = Main_DirectDraw_final_release;
73 This->create_palette = Main_DirectDrawPalette_Create;
75 This->create_offscreen = Main_create_offscreen;
76 This->create_texture = Main_create_texture;
77 This->create_zbuffer = Main_create_zbuffer;
78 /* There are no generic versions of create_{primary,backbuffer}. */
80 ICOM_INIT_INTERFACE(This, IDirectDraw, DDRAW_IDirectDraw_VTable);
81 ICOM_INIT_INTERFACE(This, IDirectDraw2, DDRAW_IDirectDraw2_VTable);
82 ICOM_INIT_INTERFACE(This, IDirectDraw4, DDRAW_IDirectDraw4_VTable);
83 /* There is no generic implementation of IDD7 */
88 void Main_DirectDraw_final_release(IDirectDrawImpl* This)
90 if (IsWindow(This->window))
92 if (GetPropA(This->window, ddProp))
93 DDRAW_UnsubclassWindow(This);
95 FIXME("this shouldn't happen, right?\n");
98 Main_DirectDraw_DeleteSurfaces(This);
99 Main_DirectDraw_DeleteClippers(This);
100 Main_DirectDraw_DeletePalettes(This);
101 if (This->local.lpGbl && This->local.lpGbl->lpExclusiveOwner == &This->local)
103 This->local.lpGbl->lpExclusiveOwner = NULL;
104 if (This->set_exclusive_mode)
105 This->set_exclusive_mode(This, FALSE);
109 /* There is no Main_DirectDraw_Create. */
111 ULONG WINAPI Main_DirectDraw_AddRef(LPDIRECTDRAW7 iface) {
112 ICOM_THIS(IDirectDrawImpl,iface);
113 TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
118 ULONG WINAPI Main_DirectDraw_Release(LPDIRECTDRAW7 iface) {
120 ICOM_THIS(IDirectDrawImpl,iface);
121 TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
127 if (This->final_release != NULL)
128 This->final_release(This);
130 /* We free the private. This is an artifact of the fact that I don't
131 * have the destructors set up correctly. */
132 if (This->private != (This+1))
133 HeapFree(GetProcessHeap(), 0, This->private);
135 HeapFree(GetProcessHeap(), 0, This);
141 /* TODO: need to support IDirect3D. */
142 HRESULT WINAPI Main_DirectDraw_QueryInterface(
143 LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj
145 ICOM_THIS(IDirectDrawImpl,iface);
146 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(refiid), obj);
148 if ( IsEqualGUID( &IID_IUnknown, refiid )
149 || IsEqualGUID( &IID_IDirectDraw7, refiid ) )
151 *obj = ICOM_INTERFACE(This, IDirectDraw7);
153 else if ( IsEqualGUID( &IID_IDirectDraw, refiid ) )
155 *obj = ICOM_INTERFACE(This, IDirectDraw);
157 else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) )
159 *obj = ICOM_INTERFACE(This, IDirectDraw2);
161 else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
163 *obj = ICOM_INTERFACE(This, IDirectDraw4);
166 else if ( IsEqualGUID( &IID_IDirect3D3, refiid ) )
168 return create_direct3d3(obj, This);
170 else if ( IsEqualGUID( &IID_IDirect3D2, refiid ) )
172 return create_direct3d2(obj, This);
174 else if ( IsEqualGUID( &IID_IDirect3D, refiid ) )
176 return create_direct3d(obj, This);
181 FIXME("(%p)->(%s,%p): no interface\n",This,debugstr_guid(refiid),obj);
182 return E_NOINTERFACE;
185 IDirectDraw7_AddRef(iface);
189 /* MSDN: "not currently implemented". */
190 HRESULT WINAPI Main_DirectDraw_Compact(LPDIRECTDRAW7 iface)
192 TRACE("(%p)\n", iface);
197 HRESULT WINAPI Main_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface,
199 LPDIRECTDRAWCLIPPER *ppClipper,
202 ICOM_THIS(IDirectDrawImpl, iface);
205 TRACE("(%p)->(0x%lx, %p, %p)\n", iface, dwFlags, ppClipper, pUnkOuter);
207 hr = DirectDrawCreateClipper(dwFlags, ppClipper, pUnkOuter);
208 if (FAILED(hr)) return hr;
210 /* dwFlags is passed twice, apparently an API wart. */
211 hr = IDirectDrawClipper_Initialize(*ppClipper,
212 ICOM_INTERFACE(This, IDirectDraw),
216 IDirectDrawClipper_Release(*ppClipper);
224 Main_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
225 LPPALETTEENTRY palent,
226 LPDIRECTDRAWPALETTE* ppPalette,
229 ICOM_THIS(IDirectDrawImpl,iface);
230 LPDIRECTDRAWPALETTE pPalette;
233 TRACE("(%p)->(%08lx,%p,%p,%p)\n",This,dwFlags,palent,ppPalette,pUnknown);
235 if (ppPalette == NULL) return E_POINTER; /* unchecked */
236 if (pUnknown != NULL) return CLASS_E_NOAGGREGATION; /* unchecked */
238 hr = This->create_palette(This, dwFlags, &pPalette, pUnknown);
239 if (FAILED(hr)) return hr;
241 hr = IDirectDrawPalette_SetEntries(pPalette, 0, 0,
242 Main_DirectDrawPalette_Size(dwFlags),
246 IDirectDrawPalette_Release(pPalette);
251 *ppPalette = pPalette;
257 Main_create_offscreen(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD,
258 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter)
260 assert(pOuter == NULL);
262 return DIB_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
266 Main_create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD,
267 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter,
270 assert(pOuter == NULL);
272 return DIB_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
276 Main_create_zbuffer(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD,
277 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter)
279 assert(pOuter == NULL);
281 return FakeZBuffer_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
284 /* Does the texture surface described in pDDSD have any smaller mipmaps? */
285 static BOOL more_mipmaps(const DDSURFACEDESC2 *pDDSD)
287 return ((pDDSD->dwFlags & DDSD_MIPMAPCOUNT) && pDDSD->u2.dwMipMapCount > 1
288 && (pDDSD->dwWidth > 1 || pDDSD->dwHeight > 1));
291 /* Create a texture surface along with any of its mipmaps. */
293 create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2 *pDDSD,
294 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pUnkOuter)
297 DWORD mipmap_level = 0;
300 assert(pUnkOuter == NULL);
302 /* is this check right? (pixelformat can be copied from primary) */
303 if ((pDDSD->dwFlags&(DDSD_HEIGHT|DDSD_WIDTH)) != (DDSD_HEIGHT|DDSD_WIDTH))
304 return DDERR_INVALIDPARAMS;
306 ddsd.dwSize = sizeof(ddsd);
307 DD_STRUCT_COPY_BYSIZE((&ddsd),pDDSD);
309 if (!(ddsd.dwFlags & DDSD_PIXELFORMAT))
311 ddsd.u4.ddpfPixelFormat = This->pixelformat;
314 if (!(ddsd.dwFlags & DDSD_PITCH))
316 ddsd.u1.lPitch = DDRAW_width_bpp_to_pitch(ddsd.dwWidth,
320 ddsd.dwFlags |= DDSD_PITCH | DDSD_PIXELFORMAT;
322 hr = This->create_texture(This, &ddsd, ppSurf, pUnkOuter, mipmap_level);
323 if (FAILED(hr)) return hr;
325 /* Create attached mipmaps if required. */
326 if (more_mipmaps(&ddsd))
328 LPDIRECTDRAWSURFACE7 mipmap;
329 LPDIRECTDRAWSURFACE7 prev_mipmap;
330 DDSURFACEDESC2 mipmap_surface_desc;
332 prev_mipmap = *ppSurf;
333 IDirectDrawSurface7_AddRef(prev_mipmap);
334 mipmap_surface_desc = ddsd;
335 mipmap_surface_desc.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL;
337 while (more_mipmaps(&mipmap_surface_desc))
341 mipmap_surface_desc.u2.dwMipMapCount--;
343 if (mipmap_surface_desc.dwWidth > 1)
344 mipmap_surface_desc.dwWidth /= 2;
346 if (mipmap_surface_desc.dwHeight > 1)
347 mipmap_surface_desc.dwHeight /= 2;
349 mipmap_surface_desc.u1.lPitch
350 = DDRAW_width_bpp_to_pitch(mipmap_surface_desc.dwWidth,
353 hr = This->create_texture(This, &mipmap_surface_desc, &mipmap,
354 pUnkOuter, mipmap_level);
357 IDirectDrawSurface7_Release(prev_mipmap);
358 IDirectDrawSurface7_Release(*ppSurf);
362 IDirectDrawSurface7_AddAttachedSurface(prev_mipmap, mipmap);
363 IDirectDrawSurface7_Release(prev_mipmap);
364 prev_mipmap = mipmap;
367 IDirectDrawSurface7_Release(prev_mipmap);
373 /* Creates a primary surface and any indicated backbuffers. */
375 create_primary(IDirectDrawImpl* This, LPDDSURFACEDESC2 pDDSD,
376 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pUnkOuter)
381 assert(pUnkOuter == NULL);
383 if (This->primary_surface != NULL)
384 return DDERR_PRIMARYSURFACEALREADYEXISTS;
386 /* as documented (what about pitch?) */
387 if (pDDSD->dwFlags & (DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT))
388 return DDERR_INVALIDPARAMS;
390 ddsd.dwSize = sizeof(ddsd);
391 DD_STRUCT_COPY_BYSIZE((&ddsd),pDDSD);
392 ddsd.dwFlags |= DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | DDSD_PIXELFORMAT;
393 ddsd.dwHeight = This->height;
394 ddsd.dwWidth = This->width;
395 ddsd.u1.lPitch = This->pitch;
396 ddsd.u4.ddpfPixelFormat = This->pixelformat;
397 ddsd.ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY
398 | DDSCAPS_VISIBLE | DDSCAPS_FRONTBUFFER;
400 if ((ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) && ddsd.dwBackBufferCount > 0)
401 ddsd.ddsCaps.dwCaps |= DDSCAPS_FLIP;
403 hr = This->create_primary(This, &ddsd, ppSurf, pUnkOuter);
404 if (FAILED(hr)) return hr;
406 if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT)
408 IDirectDrawSurfaceImpl* primary;
409 LPDIRECTDRAWSURFACE7 pPrev;
412 ddsd.dwFlags &= ~DDSD_BACKBUFFERCOUNT;
413 ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE
414 | DDSCAPS_BACKBUFFER);
416 primary = ICOM_OBJECT(IDirectDrawSurfaceImpl,IDirectDrawSurface7,
419 IDirectDrawSurface7_AddRef(pPrev);
421 for (i=0; i < ddsd.dwBackBufferCount; i++)
423 LPDIRECTDRAWSURFACE7 pBack;
426 ddsd.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
428 ddsd.ddsCaps.dwCaps &= ~DDSCAPS_BACKBUFFER;
430 hr = This->create_backbuffer(This, &ddsd, &pBack, pUnkOuter,
435 IDirectDraw7_Release(pPrev);
436 IDirectDraw7_Release(*ppSurf);
440 IDirectDrawSurface7_AddAttachedSurface(pPrev, pBack);
441 IDirectDrawSurface7_Release(pPrev);
445 IDirectDrawSurface7_Release(pPrev);
448 This->primary_surface = (IDirectDrawSurfaceImpl *)*ppSurf;
454 create_offscreen(IDirectDrawImpl* This, LPDDSURFACEDESC2 pDDSD,
455 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pUnkOuter)
460 /* is this check right? (pixelformat can be copied from primary) */
461 if ((pDDSD->dwFlags&(DDSD_HEIGHT|DDSD_WIDTH)) != (DDSD_HEIGHT|DDSD_WIDTH))
462 return DDERR_INVALIDPARAMS;
464 ddsd.dwSize = sizeof(ddsd);
465 DD_STRUCT_COPY_BYSIZE((&ddsd),pDDSD);
467 if (!(ddsd.dwFlags & DDSD_PIXELFORMAT))
469 ddsd.u4.ddpfPixelFormat = This->pixelformat;
472 if (!(ddsd.dwFlags & DDSD_PITCH))
474 ddsd.u1.lPitch = DDRAW_width_bpp_to_pitch(ddsd.dwWidth,
478 ddsd.dwFlags |= DDSD_PITCH | DDSD_PIXELFORMAT;
480 hr = This->create_offscreen(This, &ddsd, ppSurf, pUnkOuter);
481 if (FAILED(hr)) return hr;
487 Main_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
488 LPDIRECTDRAWSURFACE7 *ppSurf,
492 ICOM_THIS(IDirectDrawImpl, iface);
494 TRACE("(%p)->(%p,%p,%p)\n",This,pDDSD,ppSurf,pUnkOuter);
495 TRACE("Requested Caps: 0x%lx\n", pDDSD->ddsCaps.dwCaps);
497 if (pUnkOuter != NULL) {
498 FIXME("outer != NULL?\n");
499 return CLASS_E_NOAGGREGATION; /* unchecked */
502 if (!(pDDSD->dwFlags & DDSD_CAPS)) {
503 /* DVIDEO.DLL does forget the DDSD_CAPS flag ... *sigh* */
504 pDDSD->dwFlags |= DDSD_CAPS;
507 if (ppSurf == NULL) {
508 FIXME("You want to get back a surface? Don't give NULL ptrs!\n");
509 return E_POINTER; /* unchecked */
512 if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
514 /* create primary surface & backbuffers */
515 hr = create_primary(This, pDDSD, ppSurf, pUnkOuter);
517 else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_BACKBUFFER)
519 /* create backbuffer surface */
520 hr = This->create_backbuffer(This, pDDSD, ppSurf, pUnkOuter, NULL);
522 else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_OFFSCREENPLAIN)
524 /* create offscreenplain surface */
525 hr = create_offscreen(This, pDDSD, ppSurf, pUnkOuter);
527 else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
529 /* create z-buffer */
530 hr = This->create_zbuffer(This, pDDSD, ppSurf, pUnkOuter);
532 else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
535 hr = create_texture(This, pDDSD, ppSurf, pUnkOuter);
539 /* Otherwise, assume offscreenplain surface */
540 FIXME("App didn't request a valid surface type - assuming offscreenplain\n");
541 hr = create_offscreen(This, pDDSD, ppSurf, pUnkOuter);
545 FIXME("failed surface creation with code 0x%08lx\n",hr);
553 Main_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7 src,
554 LPDIRECTDRAWSURFACE7* dst)
556 ICOM_THIS(IDirectDrawImpl,iface);
558 IDirectDrawSurfaceImpl *pSrc = ICOM_OBJECT(IDirectDrawSurfaceImpl,
559 IDirectDrawSurface7, src);
561 TRACE("(%p)->(%p,%p)\n",This,src,dst);
563 return pSrc->duplicate_surface(pSrc, dst);
566 /* EnumDisplayModes */
568 BOOL Main_DirectDraw_DDPIXELFORMAT_Match(const DDPIXELFORMAT *requested,
569 const DDPIXELFORMAT *provided)
571 /* Some flags must be present in both or neither for a match. */
572 static const DWORD must_match = DDPF_PALETTEINDEXED1 | DDPF_PALETTEINDEXED2
573 | DDPF_PALETTEINDEXED4 | DDPF_PALETTEINDEXED8 | DDPF_FOURCC
574 | DDPF_ZBUFFER | DDPF_STENCILBUFFER;
576 if ((requested->dwFlags & provided->dwFlags) != requested->dwFlags)
579 if ((requested->dwFlags & must_match) != (provided->dwFlags & must_match))
582 if (requested->dwFlags & DDPF_FOURCC)
583 if (requested->dwFourCC != provided->dwFourCC)
586 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_ZBUFFER|DDPF_ALPHA
587 |DDPF_LUMINANCE|DDPF_BUMPDUDV))
588 if (requested->u1.dwRGBBitCount != provided->u1.dwRGBBitCount)
591 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_STENCILBUFFER
592 |DDPF_LUMINANCE|DDPF_BUMPDUDV))
593 if (requested->u2.dwRBitMask != provided->u2.dwRBitMask)
596 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_ZBUFFER|DDPF_BUMPDUDV))
597 if (requested->u3.dwGBitMask != provided->u3.dwGBitMask)
600 /* I could be wrong about the bumpmapping. MSDN docs are vague. */
601 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_STENCILBUFFER
603 if (requested->u4.dwBBitMask != provided->u4.dwBBitMask)
606 if (requested->dwFlags & (DDPF_ALPHAPIXELS|DDPF_ZPIXELS))
607 if (requested->u5.dwRGBAlphaBitMask != provided->u5.dwRGBAlphaBitMask)
613 BOOL Main_DirectDraw_DDSD_Match(const DDSURFACEDESC2* requested,
614 const DDSURFACEDESC2* provided)
623 #define CMP(FLAG, FIELD) \
624 { DDSD_##FLAG, offsetof(DDSURFACEDESC2, FIELD), \
625 sizeof(((DDSURFACEDESC2 *)(NULL))->FIELD) }
627 static const struct compare_info compare[] = {
628 CMP(ALPHABITDEPTH, dwAlphaBitDepth),
629 CMP(BACKBUFFERCOUNT, dwBackBufferCount),
631 CMP(CKDESTBLT, ddckCKDestBlt),
632 CMP(CKDESTOVERLAY, u3.ddckCKDestOverlay),
633 CMP(CKSRCBLT, ddckCKSrcBlt),
634 CMP(CKSRCOVERLAY, ddckCKSrcOverlay),
635 CMP(HEIGHT, dwHeight),
636 CMP(LINEARSIZE, u1.dwLinearSize),
637 CMP(LPSURFACE, lpSurface),
638 CMP(MIPMAPCOUNT, u2.dwMipMapCount),
639 CMP(PITCH, u1.lPitch),
640 /* PIXELFORMAT: manual */
641 CMP(REFRESHRATE, u2.dwRefreshRate),
642 CMP(TEXTURESTAGE, dwTextureStage),
644 /* ZBUFFERBITDEPTH: "obsolete" */
651 if ((requested->dwFlags & provided->dwFlags) != requested->dwFlags)
654 for (i=0; i < sizeof(compare)/sizeof(compare[0]); i++)
656 if (requested->dwFlags & compare[i].flag
657 && memcmp((const char *)provided + compare[i].offset,
658 (const char *)requested + compare[i].offset,
659 compare[i].size) != 0)
663 if (requested->dwFlags & DDSD_PIXELFORMAT)
665 if (!Main_DirectDraw_DDPIXELFORMAT_Match(&requested->u4.ddpfPixelFormat,
666 &provided->u4.ddpfPixelFormat))
673 #define DDENUMSURFACES_SEARCHTYPE (DDENUMSURFACES_CANBECREATED|DDENUMSURFACES_DOESEXIST)
674 #define DDENUMSURFACES_MATCHTYPE (DDENUMSURFACES_ALL|DDENUMSURFACES_MATCH|DDENUMSURFACES_NOMATCH)
676 /* This should be extended so that it can be used by
677 * IDirectDrawSurface7::EnumAttachedSurfaces. */
679 Main_DirectDraw_EnumExistingSurfaces(IDirectDrawImpl *This, DWORD dwFlags,
680 LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
681 LPDDENUMSURFACESCALLBACK7 callback)
683 IDirectDrawSurfaceImpl *surf;
686 /* A NULL lpDDSD2 is permitted if we are enumerating all surfaces anyway */
687 if (lpDDSD2 == NULL && !(dwFlags & DDENUMSURFACES_ALL))
688 return DDERR_INVALIDPARAMS;
690 all = dwFlags & DDENUMSURFACES_ALL;
691 nomatch = dwFlags & DDENUMSURFACES_NOMATCH;
693 for (surf = This->surfaces; surf != NULL; surf = surf->next_ddraw)
696 || (nomatch != Main_DirectDraw_DDSD_Match(lpDDSD2,
697 &surf->surface_desc)))
699 LPDIRECTDRAWSURFACE7 surface = ICOM_INTERFACE(surf,
700 IDirectDrawSurface7);
702 /* BOGUS! Violates COM rules, but MSDN says so. */
703 IDirectDrawSurface7_AddRef(surface);
705 if (callback(surface, &surf->surface_desc, context)
714 /* I really don't understand how this is supposed to work.
715 * We only consider dwHeight, dwWidth and ddpfPixelFormat.dwFlags. */
717 Main_DirectDraw_EnumCreateableSurfaces(IDirectDrawImpl *This, DWORD dwFlags,
718 LPDDSURFACEDESC2 lpDDSD2,
720 LPDDENUMSURFACESCALLBACK7 callback)
722 FIXME("This isn't going to work.\n");
724 if ((dwFlags & DDENUMSURFACES_MATCHTYPE) != DDENUMSURFACES_MATCH)
725 return DDERR_INVALIDPARAMS;
727 /* TODO: implement this.
728 * Does this work before SCL is called?
729 * Does it only consider off-screen surfaces?
735 /* For unsigned x. 0 is not a power of 2. */
736 #define IS_POW_2(x) (((x) & ((x) - 1)) == 0)
739 Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
740 LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
741 LPDDENUMSURFACESCALLBACK7 callback)
743 ICOM_THIS(IDirectDrawImpl, iface);
744 TRACE("(%p)->(0x%lx, %p, %p, %p)\n", iface, dwFlags, lpDDSD2, context,
747 if (callback == NULL)
748 return DDERR_INVALIDPARAMS;
750 if (dwFlags & ~(DDENUMSURFACES_SEARCHTYPE|DDENUMSURFACES_MATCHTYPE))
751 return DDERR_INVALIDPARAMS;
753 if (!IS_POW_2(dwFlags & DDENUMSURFACES_SEARCHTYPE)
754 || !IS_POW_2(dwFlags & DDENUMSURFACES_MATCHTYPE))
755 return DDERR_INVALIDPARAMS;
757 if (dwFlags & DDENUMSURFACES_DOESEXIST)
759 return Main_DirectDraw_EnumExistingSurfaces(This, dwFlags, lpDDSD2,
764 return Main_DirectDraw_EnumCreateableSurfaces(This, dwFlags, lpDDSD2,
770 Main_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b)
772 ICOM_THIS(IDirectDrawImpl,iface);
773 FIXME("(%p)->() stub\n", This);
779 Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
781 ICOM_THIS(IDirectDrawImpl,iface);
782 TRACE("(%p)->()\n",This);
787 Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
790 ICOM_THIS(IDirectDrawImpl,iface);
791 TRACE("(%p,%p,%p), stub\n",This,pDriverCaps,pHELCaps);
792 if (pDriverCaps != NULL)
793 DD_STRUCT_COPY_BYSIZE(pDriverCaps,&This->caps);
794 if (pHELCaps != NULL)
795 DD_STRUCT_COPY_BYSIZE(pHELCaps,&This->caps);
800 /* GetDeviceIdentifier */
804 Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes,
807 ICOM_THIS(IDirectDrawImpl,iface);
811 FIXME("(%p,%p,%p), stub\n",This,pNumCodes,pCodes);
816 Main_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface,
817 LPDIRECTDRAWSURFACE7 *lplpGDIDDSSurface)
819 ICOM_THIS(IDirectDrawImpl,iface);
820 TRACE("(%p)->(%p)\n", This, lplpGDIDDSSurface);
821 TRACE("returning primary (%p)\n", This->primary_surface);
822 *lplpGDIDDSSurface = ICOM_INTERFACE(This->primary_surface, IDirectDrawSurface7);
823 if (*lplpGDIDDSSurface)
824 IDirectDrawSurface7_AddRef(*lplpGDIDDSSurface);
829 Main_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq)
831 ICOM_THIS(IDirectDrawImpl,iface);
832 FIXME("(%p)->(%p) returns 60 Hz always\n",This,freq);
833 *freq = 60*100; /* 60 Hz */
838 Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
840 ICOM_THIS(IDirectDrawImpl,iface);
841 FIXME("(%p)->(%p)\n", This, lpdwScanLine);
849 Main_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc,
850 LPDIRECTDRAWSURFACE7 *lpDDS)
852 ICOM_THIS(IDirectDrawImpl,iface);
853 FIXME("(%p)->(%08ld,%p)\n", This, (DWORD) hdc, lpDDS);
859 Main_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, LPBOOL status)
861 ICOM_THIS(IDirectDrawImpl,iface);
862 TRACE("(%p)->(%p)\n",This,status);
867 /* If we were not initialised then Uninit_Main_IDirectDraw7_Initialize would
868 * have been called instead. */
870 Main_DirectDraw_Initialize(LPDIRECTDRAW7 iface, LPGUID lpGuid)
872 TRACE("(%p)->(%s)\n", iface, debugstr_guid(lpGuid));
874 return DDERR_ALREADYINITIALIZED;
878 Main_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface)
880 ICOM_THIS(IDirectDrawImpl,iface);
881 IDirectDrawSurfaceImpl* surf;
883 TRACE("(%p)->()\n", This);
885 for (surf = This->surfaces; surf != NULL; surf = surf->next_ddraw)
886 IDirectDrawSurface7_Restore(ICOM_INTERFACE(surf, IDirectDrawSurface7));
891 static void DDRAW_SubclassWindow(IDirectDrawImpl* This)
893 /* Well we don't actually subclass the window yet. */
894 SetPropA(This->window, ddProp, (LONG)This);
897 static void DDRAW_UnsubclassWindow(IDirectDrawImpl* This)
899 RemovePropA(This->window, ddProp);
903 Main_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hwnd,
906 ICOM_THIS(IDirectDrawImpl,iface);
908 FIXME("(%p)->(%08lx,%08lx)\n",This,(DWORD)hwnd,cooplevel);
909 DDRAW_dump_cooperativelevel(cooplevel);
911 /* Makes realMYST test happy. */
912 if (This->cooperative_level == cooplevel
913 && This->window == hwnd)
916 /* XXX "It cannot be reset while the process has surfaces or palettes
917 * created." Otherwise the window can be changed???
919 * This appears to be wrong - comment it out for now.
921 return DDERR_HWNDALREADYSET;
924 if (!(cooplevel & (DDSCL_EXCLUSIVE|DDSCL_NORMAL)))
925 return DDERR_INVALIDPARAMS;
928 This->cooperative_level = cooplevel;
930 This->local.hWnd = hwnd;
931 This->local.dwLocalFlags |= DDRAWILCL_SETCOOPCALLED;
932 /* not entirely sure about these */
933 if (cooplevel & DDSCL_EXCLUSIVE) This->local.dwLocalFlags |= DDRAWILCL_HASEXCLUSIVEMODE;
934 if (cooplevel & DDSCL_FULLSCREEN) This->local.dwLocalFlags |= DDRAWILCL_ISFULLSCREEN;
935 if (cooplevel & DDSCL_ALLOWMODEX) This->local.dwLocalFlags |= DDRAWILCL_ALLOWMODEX;
936 if (cooplevel & DDSCL_MULTITHREADED) This->local.dwLocalFlags |= DDRAWILCL_MULTITHREADED;
937 if (cooplevel & DDSCL_FPUSETUP) This->local.dwLocalFlags |= DDRAWILCL_FPUSETUP;
938 if (cooplevel & DDSCL_FPUPRESERVE) This->local.dwLocalFlags |= DDRAWILCL_FPUPRESERVE;
940 if (This->local.lpGbl) {
941 /* assume that this app is the active app (in wine, there's
942 * probably only one app per global ddraw object anyway) */
943 if (cooplevel & DDSCL_EXCLUSIVE) This->local.lpGbl->lpExclusiveOwner = &This->local;
944 else if (This->local.lpGbl->lpExclusiveOwner == &This->local)
945 This->local.lpGbl->lpExclusiveOwner = NULL;
946 if (This->set_exclusive_mode)
947 This->set_exclusive_mode(This, (cooplevel & DDSCL_EXCLUSIVE) != 0);
950 ShowWindow(hwnd, SW_SHOW);
952 DDRAW_SubclassWindow(This);
954 /* TODO Does it also get resized to the current screen size? */
960 Main_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
961 DWORD dwHeight, LONG lPitch,
962 DWORD dwRefreshRate, DWORD dwFlags,
963 const DDPIXELFORMAT* pixelformat)
968 ICOM_THIS(IDirectDrawImpl,iface);
970 TRACE("(%p)->SetDisplayMode(%ld,%ld)\n",This,dwWidth,dwHeight);
972 if (!(This->cooperative_level & DDSCL_EXCLUSIVE))
973 return DDERR_NOEXCLUSIVEMODE;
975 if (!IsWindow(This->window))
976 return DDERR_GENERIC; /* unchecked */
978 LosePrimarySurface(This);
980 screenX = GetSystemMetrics(SM_CXSCREEN);
981 screenY = GetSystemMetrics(SM_CYSCREEN);
983 This->width = dwWidth;
984 This->height = dwHeight;
985 This->pitch = lPitch;
986 This->pixelformat = *pixelformat;
988 /* Position the window in the center of the screen - don't center for now */
989 /* MoveWindow(This->window, (screenX-dwWidth)/2, (screenY-dwHeight)/2,
990 dwWidth, dwHeight, TRUE);*/
991 MoveWindow(This->window, 0, 0, dwWidth, dwHeight, TRUE);
993 SetFocus(This->window);
999 Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
1001 ICOM_THIS(IDirectDrawImpl,iface);
1003 TRACE("(%p)\n",This);
1004 if (!(This->cooperative_level & DDSCL_EXCLUSIVE))
1005 return DDERR_NOEXCLUSIVEMODE;
1007 /* Lose the primary surface if the resolution changes. */
1008 if (This->orig_width != This->width || This->orig_height != This->height
1009 || This->orig_pitch != This->pitch
1010 || This->orig_pixelformat.dwFlags != This->pixelformat.dwFlags
1011 || !Main_DirectDraw_DDPIXELFORMAT_Match(&This->pixelformat,
1012 &This->orig_pixelformat))
1014 LosePrimarySurface(This);
1017 /* TODO Move the window back where it belongs. */
1023 Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
1026 ICOM_THIS(IDirectDrawImpl,iface);
1027 FIXME("(%p)->(flags=0x%08lx,handle=0x%08x)\n",This,dwFlags,h);
1032 Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD)
1034 ICOM_THIS(IDirectDrawImpl,iface);
1035 TRACE("(%p)->GetDisplayMode(%p)\n",This,pDDSD);
1037 pDDSD->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_PIXELFORMAT|DDSD_REFRESHRATE;
1038 pDDSD->dwHeight = This->height;
1039 pDDSD->dwWidth = This->width;
1040 pDDSD->u1.lPitch = This->pitch;
1041 pDDSD->u2.dwRefreshRate = 60;
1042 pDDSD->u4.ddpfPixelFormat = This->pixelformat;
1043 pDDSD->ddsCaps.dwCaps = 0;
1049 Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
1050 LPDWORD total, LPDWORD free)
1052 ICOM_THIS(IDirectDrawImpl,iface);
1053 TRACE("(%p)->(%p,%p,%p)\n", This,ddscaps,total,free);
1055 /* We have 16 MB videomemory */
1056 if (total) *total= 16*1024*1024;
1057 if (free) *free = 16*1024*1024;
1061 HRESULT WINAPI Main_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface) {
1062 ICOM_THIS(IDirectDrawImpl,iface);
1063 TRACE("(%p)->(): stub\n", This);
1069 Main_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pModes,
1070 DWORD dwNumModes, DWORD dwFlags)
1072 ICOM_THIS(IDirectDrawImpl,iface);
1073 FIXME("(%p)->() stub\n", This);
1078 /*** Owned object management. */
1080 void Main_DirectDraw_AddSurface(IDirectDrawImpl* This,
1081 IDirectDrawSurfaceImpl* surface)
1083 assert(surface->ddraw_owner == NULL || surface->ddraw_owner == This);
1085 surface->ddraw_owner = This;
1087 /* where should it go? */
1088 surface->next_ddraw = This->surfaces;
1089 surface->prev_ddraw = NULL;
1091 This->surfaces->prev_ddraw = surface;
1092 This->surfaces = surface;
1095 void Main_DirectDraw_RemoveSurface(IDirectDrawImpl* This,
1096 IDirectDrawSurfaceImpl* surface)
1098 assert(surface->ddraw_owner == This);
1100 if (This->surfaces == surface)
1101 This->surfaces = surface->next_ddraw;
1103 if (This->primary_surface == surface)
1104 This->primary_surface = NULL;
1106 if (surface->next_ddraw)
1107 surface->next_ddraw->prev_ddraw = surface->prev_ddraw;
1108 if (surface->prev_ddraw)
1109 surface->prev_ddraw->next_ddraw = surface->next_ddraw;
1112 static void Main_DirectDraw_DeleteSurfaces(IDirectDrawImpl* This)
1114 while (This->surfaces != NULL)
1115 Main_DirectDrawSurface_ForceDestroy(This->surfaces);
1118 void Main_DirectDraw_AddClipper(IDirectDrawImpl* This,
1119 IDirectDrawClipperImpl* clipper)
1121 assert(clipper->ddraw_owner == NULL || clipper->ddraw_owner == This);
1123 clipper->ddraw_owner = This;
1125 clipper->next_ddraw = This->clippers;
1126 clipper->prev_ddraw = NULL;
1128 This->clippers->prev_ddraw = clipper;
1129 This->clippers = clipper;
1132 void Main_DirectDraw_RemoveClipper(IDirectDrawImpl* This,
1133 IDirectDrawClipperImpl* clipper)
1135 assert(clipper->ddraw_owner == This);
1137 if (This->clippers == clipper)
1138 This->clippers = clipper->next_ddraw;
1140 if (clipper->next_ddraw)
1141 clipper->next_ddraw->prev_ddraw = clipper->prev_ddraw;
1142 if (clipper->prev_ddraw)
1143 clipper->prev_ddraw->next_ddraw = clipper->next_ddraw;
1146 static void Main_DirectDraw_DeleteClippers(IDirectDrawImpl* This)
1148 while (This->clippers != NULL)
1149 Main_DirectDrawClipper_ForceDestroy(This->clippers);
1152 void Main_DirectDraw_AddPalette(IDirectDrawImpl* This,
1153 IDirectDrawPaletteImpl* palette)
1155 assert(palette->ddraw_owner == NULL || palette->ddraw_owner == This);
1157 palette->ddraw_owner = This;
1159 /* where should it go? */
1160 palette->next_ddraw = This->palettes;
1161 palette->prev_ddraw = NULL;
1163 This->palettes->prev_ddraw = palette;
1164 This->palettes = palette;
1167 void Main_DirectDraw_RemovePalette(IDirectDrawImpl* This,
1168 IDirectDrawPaletteImpl* palette)
1170 assert(palette->ddraw_owner == This);
1172 if (This->palettes == palette)
1173 This->palettes = palette->next_ddraw;
1175 if (palette->next_ddraw)
1176 palette->next_ddraw->prev_ddraw = palette->prev_ddraw;
1177 if (palette->prev_ddraw)
1178 palette->prev_ddraw->next_ddraw = palette->next_ddraw;
1181 static void Main_DirectDraw_DeletePalettes(IDirectDrawImpl* This)
1183 while (This->palettes != NULL)
1184 Main_DirectDrawPalette_ForceDestroy(This->palettes);
1190 LoseSurface(IDirectDrawSurfaceImpl *surface)
1192 if (surface != NULL) surface->lose_surface(surface);
1196 LosePrimarySurface(IDirectDrawImpl *This)
1198 /* MSDN: "If another application changes the display mode, the primary
1199 * surface is lost, and the method returns DDERR_SURFACELOST until the
1200 * primary surface is recreated to match the new display mode."
1202 * We mark all the primary surfaces as lost as soon as the display
1203 * mode is changed (by any application). */
1205 LoseSurface(This->primary_surface);
1208 /******************************************************************************
1209 * Uninitialised DirectDraw functions
1211 * This vtable is used when a DirectDraw object is created with
1212 * CoCreateInstance. The only usable method is Initialize.
1215 void Uninit_DirectDraw_final_release(IDirectDrawImpl *This)
1217 Main_DirectDraw_final_release(This);
1220 static ICOM_VTABLE(IDirectDraw7) Uninit_DirectDraw_VTable;
1222 /* Not called from the vtable. */
1223 HRESULT Uninit_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
1227 hr = Main_DirectDraw_Construct(This, ex);
1228 if (FAILED(hr)) return hr;
1230 This->final_release = Uninit_DirectDraw_final_release;
1231 ICOM_INIT_INTERFACE(This, IDirectDraw7, Uninit_DirectDraw_VTable);
1236 HRESULT Uninit_DirectDraw_Create(const GUID* pGUID,
1237 LPDIRECTDRAW7* pIface,
1238 IUnknown* pUnkOuter, BOOL ex)
1241 IDirectDrawImpl* This;
1243 assert(pUnkOuter == NULL); /* XXX no: we must check this */
1245 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
1246 sizeof(IDirectDrawImpl));
1247 if (This == NULL) return E_OUTOFMEMORY;
1249 hr = Uninit_DirectDraw_Construct(This, ex);
1251 HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY, This);
1253 *pIface = ICOM_INTERFACE(This, IDirectDraw7);
1258 static HRESULT WINAPI
1259 Uninit_DirectDraw_Initialize(LPDIRECTDRAW7 iface, LPGUID pDeviceGuid)
1261 const ddraw_driver* driver;
1262 ICOM_THIS(IDirectDrawImpl, iface);
1264 TRACE("(%p)->(%p)\n", iface, pDeviceGuid);
1266 driver = DDRAW_FindDriver(pDeviceGuid);
1267 /* XXX This return value is not documented. (Not checked.) */
1268 if (driver == NULL) return DDERR_INVALIDDIRECTDRAWGUID;
1270 return driver->init(This, pDeviceGuid);
1273 static HRESULT WINAPI
1274 Uninit_DirectDraw_Compact(LPDIRECTDRAW7 iface)
1276 return DDERR_NOTINITIALIZED;
1279 static HRESULT WINAPI
1280 Uninit_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface, DWORD dwFlags,
1281 LPDIRECTDRAWCLIPPER *lplpDDClipper,
1282 IUnknown *pUnkOuter)
1285 return DDERR_NOTINITIALIZED;
1288 static HRESULT WINAPI
1289 Uninit_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
1290 LPPALETTEENTRY lpColorTable,
1291 LPDIRECTDRAWPALETTE *lplpDDPalette,
1292 IUnknown *pUnkOuter)
1294 return DDERR_NOTINITIALIZED;
1297 static HRESULT WINAPI
1298 Uninit_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface,
1299 LPDDSURFACEDESC2 lpDDSurfaceDesc,
1300 LPDIRECTDRAWSURFACE7 *lplpDDSurface,
1301 IUnknown *pUnkOuter)
1303 return DDERR_NOTINITIALIZED;
1306 static HRESULT WINAPI
1307 Uninit_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface,
1308 LPDIRECTDRAWSURFACE7 pSurf,
1309 LPDIRECTDRAWSURFACE7 *pDupSurf)
1312 return DDERR_NOTINITIALIZED;
1315 static HRESULT WINAPI
1316 Uninit_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
1317 LPDDSURFACEDESC2 lpDDSD,
1319 LPDDENUMMODESCALLBACK2 cb)
1321 return DDERR_NOTINITIALIZED;
1324 static HRESULT WINAPI
1325 Uninit_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
1326 LPDDSURFACEDESC2 pDDSD, LPVOID context,
1327 LPDDENUMSURFACESCALLBACK7 cb)
1329 return DDERR_NOTINITIALIZED;
1332 static HRESULT WINAPI
1333 Uninit_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
1335 return DDERR_NOTINITIALIZED;
1338 static HRESULT WINAPI
1339 Uninit_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
1342 return DDERR_NOTINITIALIZED;
1345 static HRESULT WINAPI
1346 Uninit_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface,
1347 LPDDSURFACEDESC2 pDDSD)
1349 return DDERR_NOTINITIALIZED;
1352 static HRESULT WINAPI
1353 Uninit_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes,
1356 return DDERR_NOTINITIALIZED;
1359 static HRESULT WINAPI
1360 Uninit_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface,
1361 LPDIRECTDRAWSURFACE7 *pGDISurf)
1363 return DDERR_NOTINITIALIZED;
1366 static HRESULT WINAPI
1367 Uninit_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface, LPDWORD pdwFreq)
1369 return DDERR_NOTINITIALIZED;
1372 static HRESULT WINAPI
1373 Uninit_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD pdwScanLine)
1375 return DDERR_NOTINITIALIZED;
1378 static HRESULT WINAPI
1379 Uninit_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, PBOOL pbIsInVB)
1381 return DDERR_NOTINITIALIZED;
1384 static HRESULT WINAPI
1385 Uninit_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
1387 return DDERR_NOTINITIALIZED;
1390 static HRESULT WINAPI
1391 Uninit_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hWnd,
1394 return DDERR_NOTINITIALIZED;
1397 static HRESULT WINAPI
1398 Uninit_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
1399 DWORD dwHeight, DWORD dwBPP,
1400 DWORD dwRefreshRate, DWORD dwFlags)
1402 return DDERR_NOTINITIALIZED;
1405 static HRESULT WINAPI
1406 Uninit_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
1409 return DDERR_NOTINITIALIZED;
1412 static HRESULT WINAPI
1413 Uninit_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 pDDCaps,
1414 LPDWORD pdwTotal, LPDWORD pdwFree)
1416 return DDERR_NOTINITIALIZED;
1419 static HRESULT WINAPI
1420 Uninit_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hDC,
1421 LPDIRECTDRAWSURFACE7 *pSurf)
1423 return DDERR_NOTINITIALIZED;
1426 static HRESULT WINAPI
1427 Uninit_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface)
1429 return DDERR_NOTINITIALIZED;
1432 static HRESULT WINAPI
1433 Uninit_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface)
1435 return DDERR_NOTINITIALIZED;
1438 static HRESULT WINAPI
1439 Uninit_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
1440 LPDDDEVICEIDENTIFIER2 pDDDI,
1443 return DDERR_NOTINITIALIZED;
1446 static HRESULT WINAPI
1447 Uninit_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pszModes,
1448 DWORD cModes, DWORD dwFlags)
1450 return DDERR_NOTINITIALIZED;
1453 static HRESULT WINAPI
1454 Uninit_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface, DWORD dwFlags,
1457 return DDERR_NOTINITIALIZED;
1460 static ICOM_VTABLE(IDirectDraw7) Uninit_DirectDraw_VTable =
1462 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1463 Main_DirectDraw_QueryInterface,
1464 Main_DirectDraw_AddRef,
1465 Main_DirectDraw_Release,
1466 Uninit_DirectDraw_Compact,
1467 Uninit_DirectDraw_CreateClipper,
1468 Uninit_DirectDraw_CreatePalette,
1469 Uninit_DirectDraw_CreateSurface,
1470 Uninit_DirectDraw_DuplicateSurface,
1471 Uninit_DirectDraw_EnumDisplayModes,
1472 Uninit_DirectDraw_EnumSurfaces,
1473 Uninit_DirectDraw_FlipToGDISurface,
1474 Uninit_DirectDraw_GetCaps,
1475 Uninit_DirectDraw_GetDisplayMode,
1476 Uninit_DirectDraw_GetFourCCCodes,
1477 Uninit_DirectDraw_GetGDISurface,
1478 Uninit_DirectDraw_GetMonitorFrequency,
1479 Uninit_DirectDraw_GetScanLine,
1480 Uninit_DirectDraw_GetVerticalBlankStatus,
1481 Uninit_DirectDraw_Initialize,
1482 Uninit_DirectDraw_RestoreDisplayMode,
1483 Uninit_DirectDraw_SetCooperativeLevel,
1484 Uninit_DirectDraw_SetDisplayMode,
1485 Uninit_DirectDraw_WaitForVerticalBlank,
1486 Uninit_DirectDraw_GetAvailableVidMem,
1487 Uninit_DirectDraw_GetSurfaceFromDC,
1488 Uninit_DirectDraw_RestoreAllSurfaces,
1489 Uninit_DirectDraw_TestCooperativeLevel,
1490 Uninit_DirectDraw_GetDeviceIdentifier,
1491 Uninit_DirectDraw_StartModeTest,
1492 Uninit_DirectDraw_EvaluateMode