Home | History | Annotate | Download | only in include
      1 /*
      2  * DirectDraw driver interface
      3  * (DirectX 7 version)
      4  *
      5  * Copyright (C) 2001 Ove Kaaven
      6  *
      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.
     11  *
     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.
     16  *
     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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
     20  */
     21 
     22 #ifndef __DDRAWI_INCLUDED__
     23 #define __DDRAWI_INCLUDED__
     24 
     25 #include <_mingw_dxhelper.h>
     26 #include <ddraw.h>
     27 #include <dciddi.h> /* the DD HAL is layered onto DCI escapes */
     28 
     29 #ifdef __cplusplus
     30 extern "C" {
     31 #endif
     32 
     33 typedef struct _DDVIDEOPORTCAPS *LPDDVIDEOPORTCAPS; /* should be in dvp.h */
     34 typedef struct _DDKERNELCAPS *LPDDKERNELCAPS; /* should be in ddkernel.h */
     35 typedef struct _VMEMHEAP *LPVMEMHEAP; /* should be in dmemmgr.h */
     36 
     37 #define DDAPI WINAPI
     38 
     39 /* the DirectDraw versions */
     40 #define DD_VERSION		0x0200 /* compatibility version */
     41 #define DD_RUNTIME_VERSION	0x0700 /* actual version */
     42 
     43 /* the HAL version returned from QUERYESCSUPPORT - DCICOMMAND */
     44 #define DD_HAL_VERSION	0x0100
     45 
     46 /* more DCICOMMAND escapes */
     47 #define DDCREATEDRIVEROBJECT	10
     48 #define DDGET32BITDRIVERNAME	11
     49 #define DDNEWCALLBACKFNS	12
     50 #define DDVERSIONINFO		13
     51 
     52 #define MAX_DRIVER_NAME		CCHDEVICENAME
     53 
     54 /*****************************************************************************
     55  * Initialization stuff
     56  */
     57 typedef struct {
     58     char szName[260];
     59     char szEntryPoint[64];
     60     DWORD dwContext;
     61 } DD32BITDRIVERDATA,*LPDD32BITDRIVERDATA;
     62 
     63 typedef struct {
     64     DWORD dwHALVersion;
     65     ULONG_PTR dwReserved1;
     66     ULONG_PTR dwReserved2;
     67 } DDVERSIONDATA,*LPDDVERSIONDATA;
     68 
     69 typedef DWORD (PASCAL *LPDD32BITDRIVERINIT)(DWORD dwContext);
     70 
     71 /* pointer to video memory */
     72 typedef ULONG_PTR FLATPTR;
     73 
     74 /* predeclare some structures */
     75 typedef struct _DDHALINFO *LPDDHALINFO;
     76 typedef struct _DDRAWI_DIRECTDRAW_INT *LPDDRAWI_DIRECTDRAW_INT;
     77 typedef struct _DDRAWI_DIRECTDRAW_LCL *LPDDRAWI_DIRECTDRAW_LCL;
     78 typedef struct _DDRAWI_DIRECTDRAW_GBL *LPDDRAWI_DIRECTDRAW_GBL;
     79 typedef struct _DDRAWI_DDRAWSURFACE_INT *LPDDRAWI_DDRAWSURFACE_INT;
     80 typedef struct _DDRAWI_DDRAWSURFACE_LCL *LPDDRAWI_DDRAWSURFACE_LCL;
     81 typedef struct _DDRAWI_DDRAWSURFACE_GBL *LPDDRAWI_DDRAWSURFACE_GBL;
     82 typedef struct _DDRAWI_DDRAWSURFACE_MORE *LPDDRAWI_DDRAWSURFACE_MORE;
     83 typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE *LPDDRAWI_DDRAWSURFACE_GBL_MORE;
     84 typedef struct _DDRAWI_DDRAWPALETTE_INT *LPDDRAWI_DDRAWPALETTE_INT;
     85 typedef struct _DDRAWI_DDRAWPALETTE_LCL *LPDDRAWI_DDRAWPALETTE_LCL;
     86 typedef struct _DDRAWI_DDRAWPALETTE_GBL *LPDDRAWI_DDRAWPALETTE_GBL;
     87 typedef struct _DDRAWI_DDRAWCLIPPER_INT *LPDDRAWI_DDRAWCLIPPER_INT;
     88 typedef struct _DDRAWI_DDRAWCLIPPER_LCL *LPDDRAWI_DDRAWCLIPPER_LCL;
     89 typedef struct _DDRAWI_DDRAWCLIPPER_GBL *LPDDRAWI_DDRAWCLIPPER_GBL;
     90 typedef struct _DDRAWI_DDVIDEOPORT_INT *LPDDRAWI_DDVIDEOPORT_INT;
     91 typedef struct _DDRAWI_DDVIDEOPORT_LCL *LPDDRAWI_DDVIDEOPORT_LCL;
     92 typedef struct _DDRAWI_DDMOTIONCOMP_INT *LPDDRAWI_DDMOTIONCOMP_INT;
     93 typedef struct _DDRAWI_DDMOTIONCOMP_LCL *LPDDRAWI_DDMOTIONCOMP_LCL;
     94 
     95 /* structure GUIDs for GetDriverInfo */
     96 DEFINE_GUID( GUID_MiscellaneousCallbacks,	0xEFD60CC0,0x49E7,0x11D0,0x88,0x9D,0x00,0xAA,0x00,0xBB,0xB7,0x6A );
     97 /* ...videport stuff here... */
     98 DEFINE_GUID( GUID_D3DCallbacks2,		0x0BA584E1,0x70B6,0x11D0,0x88,0x9D,0x00,0xAA,0x00,0xBB,0xB7,0x6A );
     99 DEFINE_GUID( GUID_D3DCallbacks3,		0xDDF41230,0xEC0A,0x11D0,0xA9,0xB6,0x00,0xAA,0x00,0xC0,0x99,0x3E );
    100 DEFINE_GUID( GUID_NonLocalVidMemCaps,		0x86C4FA80,0x8D84,0x11D0,0x94,0xE8,0x00,0xC0,0x4F,0xC3,0x41,0x37 );
    101 /* ...kernel stuff here... */
    102 DEFINE_GUID( GUID_D3DExtendedCaps,		0x7DE41F80,0x9D93,0x11D0,0x89,0xAB,0x00,0xA0,0xC9,0x05,0x41,0x29 );
    103 DEFINE_GUID( GUID_ZPixelFormats,		0x93869880,0x36CF,0x11D1,0x9B,0x1B,0x00,0xAA,0x00,0xBB,0xB8,0xAE );
    104 DEFINE_GUID( GUID_DDMoreSurfaceCaps,		0x3B8A0466,0xF269,0x11D1,0x88,0x0B,0x00,0xC0,0x4F,0xD9,0x30,0xC5 );
    105 DEFINE_GUID( GUID_DDStereoMode,			0xF828169C,0xA8E8,0x11D2,0xA1,0xF2,0x00,0xA0,0xC9,0x83,0xEA,0xF6 );
    106 /* ...more stuff here... */
    107 DEFINE_GUID(GUID_D3DParseUnknownCommandCallback,0x2E04FFA0,0x98E4,0x11D1,0x8C,0xE1,0x00,0xA0,0xC9,0x06,0x29,0xA8 );
    108 /* ...motioncomp stuff here... */
    109 DEFINE_GUID( GUID_Miscellaneous2Callbacks,	0x406B2F00,0x3E5A,0x11D1,0xB6,0x40,0x00,0xAA,0x00,0xA1,0xF9,0x6A );
    110 
    111 /*****************************************************************************
    112  * driver->ddraw callbacks
    113  */
    114 typedef BOOL    (DDAPI *LPDDHAL_SETINFO)(LPDDHALINFO lpDDHalInfo, BOOL reset);
    115 typedef FLATPTR (DDAPI *LPDDHAL_VIDMEMALLOC)(LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, DWORD dwWidth, DWORD dwHeight);
    116 typedef void    (DDAPI *LPDDHAL_VIDMEMFREE)(LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, FLATPTR fpMem);
    117 
    118 typedef struct {
    119     DWORD		dwSize;
    120     LPDDHAL_SETINFO	lpSetInfo;
    121     LPDDHAL_VIDMEMALLOC	lpVidMemAlloc;
    122     LPDDHAL_VIDMEMFREE	lpVidMemFree;
    123 } DDHALDDRAWFNS,*LPDDHALDDRAWFNS;
    124 
    125 /*****************************************************************************
    126  * mode info structure
    127  */
    128 typedef struct _DDHALMODEINFO {
    129     DWORD	dwWidth;
    130     DWORD	dwHeight;
    131     LONG	lPitch;
    132     DWORD	dwBPP;
    133     WORD	wFlags;
    134     WORD	wRefreshRate;
    135     DWORD	dwRBitMask;
    136     DWORD	dwGBitMask;
    137     DWORD	dwBBitMask;
    138     DWORD	dwAlphaBitMask;
    139 } DDHALMODEINFO,*LPDDHALMODEINFO;
    140 
    141 #define DDMODEINFO_PALETTIZED	0x0001
    142 #define DDMODEINFO_MODEX	0x0002
    143 #define DDMODEINFO_UNSUPPORTED	0x0004
    144 #define DDMODEINFO_STANDARDVGA	0x0008
    145 #define DDMODEINFO_MAXREFRESH	0x0010
    146 #define DDMODEINFO_STEREO	0x0020
    147 
    148 /*****************************************************************************
    149  * video memory info structure
    150  */
    151 typedef struct _VIDMEM {
    152     DWORD	dwFlags;
    153     FLATPTR	fpStart;
    154     union {
    155 	FLATPTR		fpEnd;
    156 	DWORD		dwWidth;
    157     } DUMMYUNIONNAME1;
    158     DDSCAPS	ddsCaps;
    159     DDSCAPS	ddsCapsAlt;
    160     union {
    161 	LPVMEMHEAP	lpHeap;
    162 	DWORD		dwHeight;
    163     } DUMMYUNIONNAME2;
    164 } VIDMEM,*LPVIDMEM;
    165 
    166 #define VIDMEM_ISLINEAR		0x00000001
    167 #define VIDMEM_ISRECTANGULAR	0x00000002
    168 #define VIDMEM_ISHEAP		0x00000004
    169 #define VIDMEM_ISNONLOCAL	0x00000008
    170 #define VIDMEM_ISWC		0x00000010
    171 #define VIDMEM_HEAPDISABLED	0x00000020
    172 
    173 typedef struct _VIDMEMINFO {
    174     FLATPTR		fpPrimary;
    175     DWORD		dwFlags;
    176     DWORD		dwDisplayWidth;
    177     DWORD		dwDisplayHeight;
    178     LONG		lDisplayPitch;
    179     DDPIXELFORMAT	ddpfDisplay;
    180     DWORD		dwOffscreenAlign;
    181     DWORD		dwOverlayAlign;
    182     DWORD		dwTextureAlign;
    183     DWORD		dwZBufferAlign;
    184     DWORD		dwAlphaAlign;
    185     DWORD		dwNumHeaps;
    186     LPVIDMEM		pvmList;
    187 } VIDMEMINFO,*LPVIDMEMINFO;
    188 
    189 typedef struct _HEAPALIAS {
    190     FLATPTR	fpVidMem;
    191     LPVOID	lpAlias;
    192     DWORD	dwAliasSize;
    193 } HEAPALIAS,*LPHEAPALIAS;
    194 
    195 typedef struct _HEAPALIASINFO {
    196     DWORD	dwRefCnt;
    197     DWORD	dwFlags;
    198     DWORD	dwNumHeaps;
    199     LPHEAPALIAS	lpAliases;
    200 } HEAPALIASINFO,*LPHEAPALIASINFO;
    201 
    202 #define HEAPALIASINFO_MAPPEDREAL	0x00000001
    203 #define HEAPALIASINFO_MAPPEDDUMMY	0x00000002
    204 
    205 /*****************************************************************************
    206  * capabilities structures
    207  */
    208 typedef struct _DDCORECAPS {
    209     DWORD	dwSize;
    210     DWORD	dwCaps;
    211     DWORD	dwCaps2;
    212     DWORD	dwCKeyCaps;
    213     DWORD	dwFXCaps;
    214     DWORD	dwFXAlphaCaps;
    215     DWORD	dwPalCaps;
    216     DWORD	dwSVCaps;
    217     DWORD	dwAlphaBltConstBitDepths;
    218     DWORD	dwAlphaBltPixelBitDepths;
    219     DWORD	dwAlphaBltSurfaceBitDepths;
    220     DWORD	dwAlphaOverlayConstBitDepths;
    221     DWORD	dwAlphaOverlayPixelBitDepths;
    222     DWORD	dwAlphaOverlaySurfaceBitDepths;
    223     DWORD	dwZBufferBitDepths;
    224     DWORD	dwVidMemTotal;
    225     DWORD	dwVidMemFree;
    226     DWORD	dwMaxVisibleOverlays;
    227     DWORD	dwCurrVisibleOverlays;
    228     DWORD	dwNumFourCCCodes;
    229     DWORD	dwAlignBoundarySrc;
    230     DWORD	dwAlignSizeSrc;
    231     DWORD	dwAlignBoundaryDest;
    232     DWORD	dwAlignSizeDest;
    233     DWORD	dwAlignStrideAlign;
    234     DWORD	dwRops[DD_ROP_SPACE];
    235     DDSCAPS	ddsCaps;
    236     DWORD	dwMinOverlayStretch;
    237     DWORD	dwMaxOverlayStretch;
    238     DWORD	dwMinLiveVideoStretch;
    239     DWORD	dwMaxLiveVideoStretch;
    240     DWORD	dwMinHwCodecStretch;
    241     DWORD	dwMaxHwCodecStretch;
    242     DWORD	dwReserved1;
    243     DWORD	dwReserved2;
    244     DWORD	dwReserved3;
    245     DWORD	dwSVBCaps;
    246     DWORD	dwSVBCKeyCaps;
    247     DWORD	dwSVBFXCaps;
    248     DWORD	dwSVBRops[DD_ROP_SPACE];
    249     DWORD	dwVSBCaps;
    250     DWORD	dwVSBCKeyCaps;
    251     DWORD	dwVSBFXCaps;
    252     DWORD	dwVSBRops[DD_ROP_SPACE];
    253     DWORD	dwSSBCaps;
    254     DWORD	dwSSBCKeyCaps;
    255     DWORD	dwSSBFXCaps;
    256     DWORD	dwSSBRops[DD_ROP_SPACE];
    257     DWORD	dwMaxVideoPorts;
    258     DWORD	dwCurrVideoPorts;
    259     DWORD	dwSVBCaps2;
    260 } DDCORECAPS,*LPDDCORECAPS;
    261 
    262 typedef struct _DDNONLOCALVIDMEMCAPS {
    263     DWORD	dwSize;
    264     DWORD	dwNLVBCaps;
    265     DWORD	dwNLVBCaps2;
    266     DWORD	dwNLVBCKeyCaps;
    267     DWORD	dwNLVBFXCaps;
    268     DWORD	dwNLVBRops[DD_ROP_SPACE];
    269 } DDNONLOCALVIDMEMCAPS,*LPDDNONLOCALVIDMEMCAPS;
    270 
    271 #define DDSCAPS_EXECUTEBUFFER	DDSCAPS_RESERVED2
    272 #define DDSCAPS2_VERTEXBUFFER	DDSCAPS2_RESERVED1
    273 #define DDSCAPS2_COMMANDBUFFER	DDSCAPS2_RESERVED2
    274 
    275 /*****************************************************************************
    276  * ddraw->driver callbacks
    277  */
    278 #define DDHAL_DRIVER_NOTHANDLED	0
    279 #define DDHAL_DRIVER_HANDLED	1
    280 #define DDHAL_DRIVER_NOCKEYHW	2
    281 
    282 typedef struct _DDHAL_DESTROYDRIVERDATA		*LPDDHAL_DESTROYDRIVERDATA;
    283 typedef struct _DDHAL_CREATESURFACEDATA		*LPDDHAL_CREATESURFACEDATA;
    284 typedef struct _DDHAL_DRVSETCOLORKEYDATA	*LPDDHAL_DRVSETCOLORKEYDATA;
    285 typedef struct _DDHAL_SETMODEDATA		*LPDDHAL_SETMODEDATA;
    286 typedef struct _DDHAL_WAITFORVERTICALBLANKDATA	*LPDDHAL_WAITFORVERTICALBLANKDATA;
    287 typedef struct _DDHAL_CANCREATESURFACEDATA	*LPDDHAL_CANCREATESURFACEDATA;
    288 typedef struct _DDHAL_CREATEPALETTEDATA		*LPDDHAL_CREATEPALETTEDATA;
    289 typedef struct _DDHAL_GETSCANLINEDATA		*LPDDHAL_GETSCANLINEDATA;
    290 typedef struct _DDHAL_SETEXCLUSIVEMODEDATA	*LPDDHAL_SETEXCLUSIVEMODEDATA;
    291 typedef struct _DDHAL_FLIPTOGDISURFACEDATA	*LPDDHAL_FLIPTOGDISURFACEDATA;
    292 
    293 typedef DWORD (PASCAL *LPDDHAL_DESTROYDRIVER)	    (LPDDHAL_DESTROYDRIVERDATA);
    294 typedef DWORD (PASCAL *LPDDHAL_CREATESURFACE)	    (LPDDHAL_CREATESURFACEDATA);
    295 typedef DWORD (PASCAL *LPDDHAL_SETCOLORKEY)	    (LPDDHAL_DRVSETCOLORKEYDATA);
    296 typedef DWORD (PASCAL *LPDDHAL_SETMODE)		    (LPDDHAL_SETMODEDATA);
    297 typedef DWORD (PASCAL *LPDDHAL_WAITFORVERTICALBLANK)(LPDDHAL_WAITFORVERTICALBLANKDATA);
    298 typedef DWORD (PASCAL *LPDDHAL_CANCREATESURFACE)    (LPDDHAL_CANCREATESURFACEDATA );
    299 typedef DWORD (PASCAL *LPDDHAL_CREATEPALETTE)	    (LPDDHAL_CREATEPALETTEDATA);
    300 typedef DWORD (PASCAL *LPDDHAL_GETSCANLINE)	    (LPDDHAL_GETSCANLINEDATA);
    301 typedef DWORD (PASCAL *LPDDHAL_SETEXCLUSIVEMODE)    (LPDDHAL_SETEXCLUSIVEMODEDATA);
    302 typedef DWORD (PASCAL *LPDDHAL_FLIPTOGDISURFACE)    (LPDDHAL_FLIPTOGDISURFACEDATA);
    303 
    304 typedef struct _DDHAL_DDCALLBACKS {
    305     DWORD				dwSize;
    306     DWORD				dwFlags;
    307     LPDDHAL_DESTROYDRIVER		DestroyDriver;
    308     LPDDHAL_CREATESURFACE		CreateSurface;
    309     LPDDHAL_SETCOLORKEY			SetColorKey;
    310     LPDDHAL_SETMODE			SetMode;
    311     LPDDHAL_WAITFORVERTICALBLANK	WaitForVerticalBlank;
    312     LPDDHAL_CANCREATESURFACE		CanCreateSurface;
    313     LPDDHAL_CREATEPALETTE		CreatePalette;
    314     LPDDHAL_GETSCANLINE			GetScanLine;
    315     /* DirectX 2 */
    316     LPDDHAL_SETEXCLUSIVEMODE		SetExclusiveMode;
    317     LPDDHAL_FLIPTOGDISURFACE		FlipToGDISurface;
    318 } DDHAL_DDCALLBACKS,*LPDDHAL_DDCALLBACKS;
    319 
    320 typedef struct _DDHAL_DESTROYSURFACEDATA	*LPDDHAL_DESTROYSURFACEDATA;
    321 typedef struct _DDHAL_FLIPDATA			*LPDDHAL_FLIPDATA;
    322 typedef struct _DDHAL_SETCLIPLISTDATA		*LPDDHAL_SETCLIPLISTDATA;
    323 typedef struct _DDHAL_LOCKDATA			*LPDDHAL_LOCKDATA;
    324 typedef struct _DDHAL_UNLOCKDATA		*LPDDHAL_UNLOCKDATA;
    325 typedef struct _DDHAL_BLTDATA			*LPDDHAL_BLTDATA;
    326 typedef struct _DDHAL_SETCOLORKEYDATA		*LPDDHAL_SETCOLORKEYDATA;
    327 typedef struct _DDHAL_ADDATTACHEDSURFACEDATA	*LPDDHAL_ADDATTACHEDSURFACEDATA;
    328 typedef struct _DDHAL_GETBLTSTATUSDATA		*LPDDHAL_GETBLTSTATUSDATA;
    329 typedef struct _DDHAL_GETFLIPSTATUSDATA		*LPDDHAL_GETFLIPSTATUSDATA;
    330 typedef struct _DDHAL_UPDATEOVERLAYDATA		*LPDDHAL_UPDATEOVERLAYDATA;
    331 typedef struct _DDHAL_SETOVERLAYPOSITIONDATA	*LPDDHAL_SETOVERLAYPOSITIONDATA;
    332 typedef struct _DDHAL_SETPALETTEDATA		*LPDDHAL_SETPALETTEDATA;
    333 
    334 typedef DWORD (PASCAL *LPDDHALSURFCB_DESTROYSURFACE)	(LPDDHAL_DESTROYSURFACEDATA);
    335 typedef DWORD (PASCAL *LPDDHALSURFCB_FLIP)		(LPDDHAL_FLIPDATA);
    336 typedef DWORD (PASCAL *LPDDHALSURFCB_SETCLIPLIST)	(LPDDHAL_SETCLIPLISTDATA);
    337 typedef DWORD (PASCAL *LPDDHALSURFCB_LOCK)		(LPDDHAL_LOCKDATA);
    338 typedef DWORD (PASCAL *LPDDHALSURFCB_UNLOCK)		(LPDDHAL_UNLOCKDATA);
    339 typedef DWORD (PASCAL *LPDDHALSURFCB_BLT)		(LPDDHAL_BLTDATA);
    340 typedef DWORD (PASCAL *LPDDHALSURFCB_SETCOLORKEY)	(LPDDHAL_SETCOLORKEYDATA);
    341 typedef DWORD (PASCAL *LPDDHALSURFCB_ADDATTACHEDSURFACE)(LPDDHAL_ADDATTACHEDSURFACEDATA);
    342 typedef DWORD (PASCAL *LPDDHALSURFCB_GETBLTSTATUS)	(LPDDHAL_GETBLTSTATUSDATA);
    343 typedef DWORD (PASCAL *LPDDHALSURFCB_GETFLIPSTATUS)	(LPDDHAL_GETFLIPSTATUSDATA);
    344 typedef DWORD (PASCAL *LPDDHALSURFCB_UPDATEOVERLAY)	(LPDDHAL_UPDATEOVERLAYDATA);
    345 typedef DWORD (PASCAL *LPDDHALSURFCB_SETOVERLAYPOSITION)(LPDDHAL_SETOVERLAYPOSITIONDATA);
    346 typedef DWORD (PASCAL *LPDDHALSURFCB_SETPALETTE)	(LPDDHAL_SETPALETTEDATA);
    347 
    348 typedef struct _DDHAL_DDSURFACECALLBACKS {
    349     DWORD				dwSize;
    350     DWORD				dwFlags;
    351     LPDDHALSURFCB_DESTROYSURFACE	DestroySurface;
    352     LPDDHALSURFCB_FLIP			Flip;
    353     LPDDHALSURFCB_SETCLIPLIST		SetClipList;
    354     LPDDHALSURFCB_LOCK			Lock;
    355     LPDDHALSURFCB_UNLOCK		Unlock;
    356     LPDDHALSURFCB_BLT			Blt;
    357     LPDDHALSURFCB_SETCOLORKEY		SetColorKey;
    358     LPDDHALSURFCB_ADDATTACHEDSURFACE	AddAttachedSurface;
    359     LPDDHALSURFCB_GETBLTSTATUS		GetBltStatus;
    360     LPDDHALSURFCB_GETFLIPSTATUS		GetFlipStatus;
    361     LPDDHALSURFCB_UPDATEOVERLAY		UpdateOverlay;
    362     LPDDHALSURFCB_SETOVERLAYPOSITION	SetOverlayPosition;
    363     LPVOID				reserved4;
    364     LPDDHALSURFCB_SETPALETTE		SetPalette;
    365 } DDHAL_DDSURFACECALLBACKS,*LPDDHAL_DDSURFACECALLBACKS;
    366 
    367 typedef struct _DDHAL_DESTROYPALETTEDATA	*LPDDHAL_DESTROYPALETTEDATA;
    368 typedef struct _DDHAL_SETENTRIESDATA		*LPDDHAL_SETENTRIESDATA;
    369 
    370 typedef DWORD (PASCAL *LPDDHALPALCB_DESTROYPALETTE)(LPDDHAL_DESTROYPALETTEDATA);
    371 typedef DWORD (PASCAL *LPDDHALPALCB_SETENTRIES)    (LPDDHAL_SETENTRIESDATA);
    372 
    373 typedef struct _DDHAL_DDPALETTECALLBACKS {
    374     DWORD				dwSize;
    375     DWORD				dwFlags;
    376     LPDDHALPALCB_DESTROYPALETTE		DestroyPalette;
    377     LPDDHALPALCB_SETENTRIES		SetEntries;
    378 } DDHAL_DDPALETTECALLBACKS,*LPDDHAL_DDPALETTECALLBACKS;
    379 
    380 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_CANCREATEEXEBUF)(LPDDHAL_CANCREATESURFACEDATA);
    381 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_CREATEEXEBUF)   (LPDDHAL_CREATESURFACEDATA);
    382 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_DESTROYEXEBUF)  (LPDDHAL_DESTROYSURFACEDATA);
    383 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_LOCKEXEBUF)     (LPDDHAL_LOCKDATA);
    384 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_UNLOCKEXEBUF)   (LPDDHAL_UNLOCKDATA);
    385 
    386 typedef struct _DDHAL_DDEXEBUFCALLBACKS {
    387     DWORD				dwSize;
    388     DWORD				dwFlags;
    389     LPDDHALEXEBUFCB_CANCREATEEXEBUF	CanCreateExecuteBuffer;
    390     LPDDHALEXEBUFCB_CREATEEXEBUF	CreateExecuteBuffer;
    391     LPDDHALEXEBUFCB_DESTROYEXEBUF	DestroyExecuteBuffer;
    392     LPDDHALEXEBUFCB_LOCKEXEBUF		LockExecuteBuffer;
    393     LPDDHALEXEBUFCB_UNLOCKEXEBUF	UnlockExecuteBuffer;
    394 } DDHAL_DDEXEBUFCALLBACKS,*LPDDHAL_DDEXEBUFCALLBACKS;
    395 
    396 typedef struct _DDHAL_GETAVAILDRIVERMEMORYDATA	*LPDDHAL_GETAVAILDRIVERMEMORYDATA;
    397 typedef struct _DDHAL_UPDATENONLOCALHEAPDATA	*LPDDHAL_UPDATENONLOCALHEAPDATA;
    398 typedef struct _DDHAL_GETHEAPALIGNMENTDATA	*LPDDHAL_GETHEAPALIGNMENTDATA;
    399 
    400 typedef DWORD (PASCAL *LPDDHAL_GETAVAILDRIVERMEMORY)(LPDDHAL_GETAVAILDRIVERMEMORYDATA);
    401 typedef DWORD (PASCAL *LPDDHAL_UPDATENONLOCALHEAP)  (LPDDHAL_UPDATENONLOCALHEAPDATA);
    402 typedef DWORD (PASCAL *LPDDHAL_GETHEAPALIGNMENT)    (LPDDHAL_GETHEAPALIGNMENTDATA);
    403 
    404 typedef struct _DDHAL_DDMISCELLANEOUSCALLBACKS {
    405     DWORD				dwSize;
    406     DWORD				dwFlags;
    407     LPDDHAL_GETAVAILDRIVERMEMORY	GetAvailDriverMemory;
    408     LPDDHAL_UPDATENONLOCALHEAP		UpdateNonLocalHeap;
    409     LPDDHAL_GETHEAPALIGNMENT		GetHeapAlignment;
    410     LPDDHALSURFCB_GETBLTSTATUS		GetSysmemBltStatus;
    411 } DDHAL_DDMISCELLANEOUSCALLBACKS,*LPDDHAL_DDMISCELLANEOUSCALLBACKS;
    412 
    413 typedef struct _DDHAL_CREATESURFACEEXDATA	*LPDDHAL_CREATESURFACEEXDATA;
    414 typedef struct _DDHAL_GETDRIVERSTATEDATA	*LPDDHAL_GETDRIVERSTATEDATA;
    415 typedef struct _DDHAL_DESTROYDDLOCALDATA	*LPDDHAL_DESTROYDDLOCALDATA;
    416 
    417 typedef DWORD (PASCAL *LPDDHAL_CREATESURFACEEX)(LPDDHAL_CREATESURFACEEXDATA);
    418 typedef DWORD (PASCAL *LPDDHAL_GETDRIVERSTATE) (LPDDHAL_GETDRIVERSTATEDATA);
    419 typedef DWORD (PASCAL *LPDDHAL_DESTROYDDLOCAL) (LPDDHAL_DESTROYDDLOCALDATA);
    420 
    421 typedef struct _DDHAL_DDMISCELLANEOUS2CALLBACKS {
    422     DWORD				dwSize;
    423     DWORD				dwFlags;
    424     LPVOID				Reserved;
    425     LPDDHAL_CREATESURFACEEX		CreateSurfaceEx;
    426     LPDDHAL_GETDRIVERSTATE		GetDriverState;
    427     LPDDHAL_DESTROYDDLOCAL		DestroyDDLocal;
    428 } DDHAL_DDMISCELLANEOUS2CALLBACKS,*LPDDHAL_DDMISCELLANEOUS2CALLBACKS;
    429 
    430 typedef HRESULT (WINAPI *LPDDGAMMACALIBRATORPROC)(LPDDGAMMARAMP, LPBYTE);
    431 
    432 /*****************************************************************************
    433  * driver info structure
    434  *
    435  * The HAL is queried for additional callbacks via the GetDriverInfo callback.
    436  */
    437 typedef struct _DDHAL_GETDRIVERINFODATA *LPDDHAL_GETDRIVERINFODATA;
    438 typedef DWORD (PASCAL *LPDDHAL_GETDRIVERINFO)(LPDDHAL_GETDRIVERINFODATA);
    439 
    440 typedef struct _DDHALINFO {
    441     DWORD			dwSize;
    442     LPDDHAL_DDCALLBACKS		lpDDCallbacks;
    443     LPDDHAL_DDSURFACECALLBACKS	lpDDSurfaceCallbacks;
    444     LPDDHAL_DDPALETTECALLBACKS	lpDDPaletteCallbacks;
    445     VIDMEMINFO			vmiData;
    446     DDCORECAPS			ddCaps;
    447     DWORD			dwMonitorFrequency;
    448     LPDDHAL_GETDRIVERINFO	GetDriverInfo;
    449     DWORD			dwModeIndex;
    450     LPDWORD			lpdwFourCC;
    451     DWORD			dwNumModes;
    452     LPDDHALMODEINFO		lpModeInfo;
    453     DWORD			dwFlags;
    454     LPVOID			lpPDevice;
    455     DWORD			hInstance;
    456     /* DirectX 2 */
    457     ULONG_PTR			lpD3DGlobalDriverData;
    458     ULONG_PTR			lpD3DHALCallbacks;
    459     LPDDHAL_DDEXEBUFCALLBACKS	lpDDExeBufCallbacks;
    460 } DDHALINFO;
    461 
    462 #define DDHALINFO_ISPRIMARYDISPLAY	0x00000001
    463 #define DDHALINFO_MODEXILLEGAL		0x00000002
    464 #define DDHALINFO_GETDRIVERINFOSET	0x00000004
    465 
    466 /* where the high-level ddraw implementation stores the callbacks */
    467 typedef struct _DDHAL_CALLBACKS {
    468     DDHAL_DDCALLBACKS		cbDDCallbacks;
    469     DDHAL_DDSURFACECALLBACKS	cbDDSurfaceCallbacks;
    470     DDHAL_DDPALETTECALLBACKS	cbDDPaletteCallbacks;
    471     DDHAL_DDCALLBACKS		HALDD;
    472     DDHAL_DDSURFACECALLBACKS	HALDDSurface;
    473     DDHAL_DDPALETTECALLBACKS	HALDDPalette;
    474     DDHAL_DDCALLBACKS		HELDD;
    475     DDHAL_DDSURFACECALLBACKS	HELDDSurface;
    476     DDHAL_DDPALETTECALLBACKS	HELDDPalette;
    477     DDHAL_DDEXEBUFCALLBACKS	cbDDExeBufCallbacks;
    478     DDHAL_DDEXEBUFCALLBACKS	HALDDExeBuf;
    479     DDHAL_DDEXEBUFCALLBACKS	HELDDExeBuf;
    480     /* there's more... videoport, colorcontrol, misc, and motion compensation callbacks... */
    481 } DDHAL_CALLBACKS,*LPDDHAL_CALLBACKS;
    482 
    483 /*****************************************************************************
    484  * parameter structures
    485  */
    486 typedef struct _DDHAL_DESTROYDRIVERDATA {
    487     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    488     HRESULT			ddRVal;
    489     LPDDHAL_DESTROYDRIVER	DestroyDriver;
    490 } DDHAL_DESTROYDRIVERDATA;
    491 
    492 typedef struct _DDHAL_SETMODEDATA {
    493     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    494     DWORD			dwModeIndex;
    495     HRESULT			ddRVal;
    496     LPDDHAL_SETMODE		SetMode;
    497     BOOL			inexcl;
    498     BOOL			useRefreshRate;
    499 } DDHAL_SETMODEDATA;
    500 
    501 typedef struct _DDHAL_CREATESURFACEDATA {
    502     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    503     LPDDSURFACEDESC		lpDDSurfaceDesc;
    504     LPDDRAWI_DDRAWSURFACE_LCL *	lplpSList;
    505     DWORD			dwSCnt;
    506     HRESULT			ddRVal;
    507     LPDDHAL_CREATESURFACE	CreateSurface;
    508 } DDHAL_CREATESURFACEDATA;
    509 
    510 typedef struct _DDHAL_CANCREATESURFACEDATA {
    511     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    512     LPDDSURFACEDESC		lpDDSurfaceDesc;
    513     DWORD			bIsDifferentPixelFormat;
    514     HRESULT			ddRVal;
    515     LPDDHAL_CANCREATESURFACE	CanCreateSurface;
    516 } DDHAL_CANCREATESURFACEDATA;
    517 
    518 typedef struct _DDHAL_CREATEPALETTEDATA {
    519     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    520     LPDDRAWI_DDRAWPALETTE_GBL	lpDDPalette;
    521     LPPALETTEENTRY		lpColorTable;
    522     HRESULT			ddRVal;
    523     LPDDHAL_CREATEPALETTE	CreatePalette;
    524     BOOL			is_excl;
    525 } DDHAL_CREATEPALETTEDATA;
    526 
    527 typedef struct _DDHAL_SETEXCLUSIVEMODEDATA {
    528     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    529     DWORD			dwEnterExcl;
    530     DWORD			dwReserved;
    531     HRESULT			ddRVal;
    532     LPDDHAL_SETEXCLUSIVEMODE	SetExclusiveMode;
    533 } DDHAL_SETEXCLUSIVEMODEDATA;
    534 
    535 /* surfaces */
    536 typedef struct _DDHAL_DESTROYSURFACEDATA {
    537     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    538     LPDDRAWI_DDRAWSURFACE_LCL	lpDDSurface;
    539     HRESULT			ddRVal;
    540     LPDDHALSURFCB_DESTROYSURFACE DestroySurface;
    541 } DDHAL_DESTROYSURFACEDATA;
    542 
    543 typedef struct _DDHAL_FLIPDATA {
    544     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    545     LPDDRAWI_DDRAWSURFACE_LCL	lpSurfCurr;
    546     LPDDRAWI_DDRAWSURFACE_LCL	lpSurfTarg;
    547     DWORD			dwFlags;
    548     HRESULT			ddRVal;
    549     LPDDHALSURFCB_FLIP		Flip;
    550     LPDDRAWI_DDRAWSURFACE_LCL	lpSurfCurrLeft;
    551     LPDDRAWI_DDRAWSURFACE_LCL	lpSurfTargLeft;
    552 } DDHAL_FLIPDATA;
    553 
    554 typedef struct _DDHAL_LOCKDATA {
    555     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    556     LPDDRAWI_DDRAWSURFACE_LCL	lpDDSurface;
    557     DWORD			bHasRect;
    558     RECTL			rArea;
    559     LPVOID			lpSurfData;
    560     HRESULT			ddRVal;
    561     LPDDHALSURFCB_LOCK		Lock;
    562     DWORD			dwFlags;
    563 } DDHAL_LOCKDATA;
    564 
    565 typedef struct _DDHAL_UNLOCKDATA {
    566     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    567     LPDDRAWI_DDRAWSURFACE_LCL	lpDDSurface;
    568     HRESULT			ddRVal;
    569     LPDDHALSURFCB_UNLOCK	Unlock;
    570 } DDHAL_UNLOCKDATA;
    571 
    572 typedef struct _DDHAL_BLTDATA {
    573     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    574     LPDDRAWI_DDRAWSURFACE_LCL	lpDDDestSurface;
    575     RECTL			rDest;
    576     LPDDRAWI_DDRAWSURFACE_LCL	lpDDSrcSurface;
    577     RECTL			rSrc;
    578     DWORD			dwFlags;
    579     DWORD			dwROPFlags;
    580     DDBLTFX			bltFX;
    581     HRESULT			ddRVal;
    582     LPDDHALSURFCB_BLT		Blt;
    583     BOOL			IsClipped;
    584     RECTL			rOrigDest;
    585     RECTL			rOrigSrc;
    586     DWORD			dwRectCnt;
    587     LPRECT			prDestRects;
    588 } DDHAL_BLTDATA;
    589 
    590 typedef struct _DDHAL_UPDATEOVERLAYDATA {
    591  LPDDRAWI_DIRECTDRAW_GBL lpDD;
    592  LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;
    593  RECTL rDest;
    594  LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface;
    595  RECTL rSrc;
    596  DWORD dwFlags;
    597  DDOVERLAYFX overlayFX;
    598  HRESULT ddRVal;
    599  LPDDHALSURFCB_UPDATEOVERLAY UpdateOverlay;
    600 } DDHAL_UPDATEOVERLAYDATA;
    601 
    602 typedef struct _DDHAL_SETPALETTEDATA {
    603     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    604     LPDDRAWI_DDRAWSURFACE_LCL	lpDDSurface;
    605     LPDDRAWI_DDRAWPALETTE_GBL	lpDDPalette;
    606     HRESULT			ddRVal;
    607     LPDDHALSURFCB_SETPALETTE	SetPalette;
    608     BOOL			Attach;
    609 } DDHAL_SETPALETTEDATA;
    610 
    611 /* palettes */
    612 typedef struct _DDHAL_DESTROYPALETTEDATA {
    613     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    614     LPDDRAWI_DDRAWPALETTE_GBL	lpDDPalette;
    615     HRESULT			ddRVal;
    616     LPDDHALPALCB_DESTROYPALETTE	DestroyPalette;
    617 } DDHAL_DESTROYPALETTEDATA;
    618 
    619 typedef struct _DDHAL_SETENTRIESDATA {
    620     LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    621     LPDDRAWI_DDRAWPALETTE_GBL	lpDDPalette;
    622     DWORD			dwBase;
    623     DWORD			dwNumEntries;
    624     LPPALETTEENTRY		lpEntries;
    625     HRESULT			ddRVal;
    626     LPDDHALPALCB_SETENTRIES	SetEntries;
    627 } DDHAL_SETENTRIESDATA;
    628 
    629 typedef struct _DDHAL_GETDRIVERINFODATA {
    630     DWORD	dwSize;
    631     DWORD	dwFlags;
    632     GUID	guidInfo;
    633     DWORD	dwExpectedSize;
    634     LPVOID	lpvData;
    635     DWORD	dwActualSize;
    636     HRESULT	ddRVal;
    637     ULONG_PTR	dwContext;
    638 } DDHAL_GETDRIVERINFODATA;
    639 
    640 /*****************************************************************************
    641  * high-level ddraw implementation structures
    642  */
    643 typedef struct _IUNKNOWN_LIST {
    644     struct _IUNKNOWN_LIST *	lpLink;
    645     LPGUID			lpGuid;
    646     IUnknown *			lpIUnknown;
    647 } IUNKNOWN_LIST,*LPIUNKNOWN_LIST;
    648 
    649 typedef struct _PROCESS_LIST {
    650     struct _PROCESS_LIST *	lpLink;
    651     DWORD			dwProcessId;
    652     DWORD			dwRefCnt;
    653     DWORD			dwAlphaDepth;
    654     DWORD			dwZDepth;
    655 } PROCESS_LIST,*LPPROCESS_LIST;
    656 
    657 typedef struct _ATTACHLIST {
    658     DWORD			dwFlags;
    659     struct _ATTACHLIST *	lpLink;
    660     LPDDRAWI_DDRAWSURFACE_LCL	lpAttached;
    661     LPDDRAWI_DDRAWSURFACE_INT	lpIAttached;
    662 } ATTACHLIST,*LPATTACHLIST;
    663 
    664 #define DDAL_IMPLICIT	0x00000001
    665 
    666 typedef struct _ACCESSRECTLIST {
    667     struct _ACCESSRECTLIST *	lpLink;
    668     RECT			rDest;
    669     LPDDRAWI_DIRECTDRAW_LCL	lpOwner;
    670     LPVOID			lpSurfaceData;
    671     DWORD			dwFlags;
    672     LPHEAPALIASINFO		lpHeapAliasInfo;
    673 } ACCESSRECTLIST,*LPACCESSRECTLIST;
    674 
    675 #define ACCESSRECT_VRAMSTYLE		0x00000001
    676 #define ACCESSRECT_NOTHOLDINGWIN16LOCK	0x00000002
    677 #define ACCESSRECT_BROKEN		0x00000004
    678 
    679 typedef struct _DBLNODE {
    680     struct _DBLNODE *		next;
    681     struct _DBLNODE *		prev;
    682     LPDDRAWI_DDRAWSURFACE_LCL	object;
    683     LPDDRAWI_DDRAWSURFACE_INT	object_int;
    684 } DBLNODE,*LPDBLNODE;
    685 
    686 typedef struct _DDRAWI_DIRECTDRAW_INT {
    687     LPVOID			lpVtbl;
    688     LPDDRAWI_DIRECTDRAW_LCL	lpLcl;
    689     LPDDRAWI_DIRECTDRAW_INT	lpLink;
    690     DWORD			dwIntRefCnt;
    691 } DDRAWI_DIRECTDRAW_INT;
    692 
    693 typedef struct _DDRAWI_DIRECTDRAW_LCL {
    694     DWORD			lpDDMore;
    695     LPDDRAWI_DIRECTDRAW_GBL	lpGbl;
    696     DWORD			dwUnused0;
    697     DWORD			dwLocalFlags;
    698     DWORD			dwLocalRefCnt;
    699     DWORD			dwProcessId;
    700     IUnknown *			pUnkOuter;
    701     DWORD			dwObsolete1;
    702     ULONG_PTR			hWnd;
    703     ULONG_PTR			hDC;
    704     DWORD			dwErrorMode;
    705     LPDDRAWI_DDRAWSURFACE_INT	lpPrimary;
    706     LPDDRAWI_DDRAWSURFACE_INT	lpCB;
    707     DWORD			dwPreferredMode;
    708     /* DirectX 2 */
    709     HINSTANCE			hD3DInstance;
    710     IUnknown *			pD3DIUnknown;
    711     LPDDHAL_CALLBACKS		lpDDCB;
    712     ULONG_PTR			hDDVxd;
    713     /* DirectX 5.0 */
    714     DWORD			dwAppHackFlags;
    715     /* DirectX 5.0A */
    716     ULONG_PTR			hFocusWnd;
    717     DWORD			dwHotTracking;
    718     DWORD			dwIMEState;
    719     /* DirectX 6.0 */
    720     ULONG_PTR			hWndPopup;
    721     ULONG_PTR			hDD;
    722     ULONG_PTR			hGammaCalibrator;
    723     LPDDGAMMACALIBRATORPROC	lpGammaCalibrator;
    724 } DDRAWI_DIRECTDRAW_LCL;
    725 
    726 #define DDRAWILCL_HASEXCLUSIVEMODE	0x00000001
    727 #define DDRAWILCL_ISFULLSCREEN		0x00000002
    728 #define DDRAWILCL_SETCOOPCALLED		0x00000004
    729 #define DDRAWILCL_ACTIVEYES		0x00000008
    730 #define DDRAWILCL_ACTIVENO		0x00000010
    731 #define DDRAWILCL_HOOKEDHWND		0x00000020
    732 #define DDRAWILCL_ALLOWMODEX		0x00000040
    733 #define DDRAWILCL_V1SCLBEHAVIOUR	0x00000080
    734 #define DDRAWILCL_MODEHASBEENCHANGED	0x00000100
    735 #define DDRAWILCL_CREATEDWINDOW		0x00000200
    736 #define DDRAWILCL_DIRTYDC		0x00000400
    737 #define DDRAWILCL_DISABLEINACTIVATE	0x00000800
    738 #define DDRAWILCL_CURSORCLIPPED		0x00001000
    739 #define DDRAWILCL_EXPLICITMONITOR	0x00002000
    740 #define DDRAWILCL_MULTITHREADED		0x00004000
    741 #define DDRAWILCL_FPUSETUP		0x00008000
    742 #define DDRAWILCL_POWEREDDOWN		0x00010000
    743 #define DDRAWILCL_DIRECTDRAW7		0x00020000
    744 #define DDRAWILCL_ATTEMPTEDD3DCONTEXT	0x00040000
    745 #define DDRAWILCL_FPUPRESERVE		0x00080000
    746 
    747 typedef struct _DDRAWI_DIRECTDRAW_GBL {
    748     DWORD			dwRefCnt;
    749     DWORD			dwFlags;
    750     FLATPTR			fpPrimaryOrig;
    751     DDCORECAPS			ddCaps;
    752     DWORD			dwInternal1;
    753     DWORD			dwUnused1[9];
    754     LPDDHAL_CALLBACKS		lpDDCBtmp;
    755     LPDDRAWI_DDRAWSURFACE_INT	dsList;
    756     LPDDRAWI_DDRAWPALETTE_INT	palList;
    757     LPDDRAWI_DDRAWCLIPPER_INT	clipperList;
    758     LPDDRAWI_DIRECTDRAW_GBL	lp16DD;
    759     DWORD			dwMaxOverlays;
    760     DWORD			dwCurrOverlays;
    761     DWORD			dwMonitorFrequency;
    762     DDCORECAPS			ddHELCaps;
    763     DWORD			dwUnused2[50];
    764     DDCOLORKEY			ddckCKDestOverlay;
    765     DDCOLORKEY			ddckCKSrcOverlay;
    766     VIDMEMINFO			vmiData;
    767     LPVOID			lpDriverHandle;
    768     LPDDRAWI_DIRECTDRAW_LCL	lpExclusiveOwner;
    769     DWORD			dwModeIndex;
    770     DWORD			dwModeIndexOrig;
    771     DWORD			dwNumFourCC;
    772     LPDWORD			lpdwFourCC;
    773     DWORD			dwNumModes;
    774     LPDDHALMODEINFO		lpModeInfo;
    775     PROCESS_LIST		plProcessList;
    776     DWORD			dwSurfaceLockCount;
    777     DWORD			dwAliasedLockCnt;
    778     ULONG_PTR			dwReserved3;
    779     ULONG_PTR			hDD;
    780     char			cObsolete[12];
    781     DWORD			dwReserved1;
    782     DWORD			dwReserved2;
    783     DBLNODE			dbnOverlayRoot;
    784     volatile LPWORD		lpwPDeviceFlags;
    785     DWORD			dwPDevice;
    786     DWORD			dwWin16LockCnt;
    787     DWORD			dwUnused3;
    788     DWORD			hInstance;
    789     DWORD			dwEvent16;
    790     DWORD			dwSaveNumModes;
    791     /* DirectX 2 */
    792     ULONG_PTR			lpD3DGlobalDriverData;
    793     ULONG_PTR			lpD3DHALCallbacks;
    794     DDCORECAPS			ddBothCaps;
    795     /* DirectX 5.0 */
    796     LPDDVIDEOPORTCAPS		lpDDVideoPortCaps;
    797     LPDDRAWI_DDVIDEOPORT_INT	dvpList;
    798     ULONG_PTR			lpD3DHALCallbacks2;
    799     RECT			rectDevice;
    800     DWORD			cMonitors;
    801     LPVOID			gpbmiSrc;
    802     LPVOID			gpbmiDest;
    803     LPHEAPALIASINFO		phaiHeapAliases;
    804     ULONG_PTR			hKernelHandle;
    805     ULONG_PTR			pfnNotifyProc;
    806     LPDDKERNELCAPS		lpDDKernelCaps;
    807     LPDDNONLOCALVIDMEMCAPS	lpddNLVCaps;
    808     LPDDNONLOCALVIDMEMCAPS	lpddNLVHELCaps;
    809     LPDDNONLOCALVIDMEMCAPS	lpddNLVBothCaps;
    810     ULONG_PTR			lpD3DExtendedCaps;
    811     /* DirectX 5.0A */
    812     DWORD			dwDOSBoxEvent;
    813     RECT			rectDesktop;
    814     char			cDriverName[MAX_DRIVER_NAME];
    815     /* DirectX 6.0 */
    816     ULONG_PTR			lpD3DHALCallbacks3;
    817     DWORD			dwNumZPixelFormats;
    818     LPDDPIXELFORMAT		lpZPixelFormats;
    819     LPDDRAWI_DDMOTIONCOMP_INT	mcList;
    820     DWORD			hDDVxd;
    821     DDSCAPSEX			ddsCapsMore;
    822 } DDRAWI_DIRECTDRAW_GBL;
    823 
    824 #define DDRAWI_VIRTUALDESKTOP	0x00000008
    825 #define DDRAWI_MODEX		0x00000010
    826 #define DDRAWI_DISPLAYDRV	0x00000020
    827 #define DDRAWI_FULLSCREEN	0x00000040
    828 #define DDRAWI_MODECHANGED	0x00000080
    829 #define DDRAWI_NOHARDWARE	0x00000100
    830 #define DDRAWI_PALETTEINIT	0x00000200
    831 #define DDRAWI_NOEMULATION	0x00000400
    832 /* more... */
    833 
    834 /* surfaces */
    835 typedef struct _DDRAWI_DDRAWSURFACE_INT {
    836     LPVOID			lpVtbl;
    837     LPDDRAWI_DDRAWSURFACE_LCL	lpLcl;
    838     LPDDRAWI_DDRAWSURFACE_INT	lpLink;
    839     DWORD			dwIntRefCnt;
    840 } DDRAWI_DDRAWSURFACE_INT;
    841 
    842 typedef struct _DDRAWI_DDRAWSURFACE_GBL {
    843     DWORD			dwRefCnt;
    844     DWORD			dwGlobalFlags;
    845     union {
    846 	LPACCESSRECTLIST	lpRectList;
    847 	DWORD			dwBlockSizeY;
    848     } DUMMYUNIONNAME1;
    849     union {
    850 	LPVMEMHEAP		lpVidMemHeap;
    851 	DWORD			dwBlockSizeX;
    852     } DUMMYUNIONNAME2;
    853     union {
    854 	LPDDRAWI_DIRECTDRAW_GBL	lpDD;
    855 	LPVOID			lpDDHandle;
    856     } DUMMYUNIONNAME3;
    857     FLATPTR			fpVidMem;
    858     union {
    859 	LONG			lPitch;
    860 	DWORD			dwLinearSize;
    861     } DUMMYUNIONNAME4;
    862     WORD			wHeight;
    863     WORD			wWidth;
    864     DWORD			dwUsageCount;
    865     ULONG_PTR			dwReserved1; /* for display driver use */
    866     /* optional (defaults to primary surface pixelformat) */
    867     DDPIXELFORMAT		ddpfSurface;
    868 } DDRAWI_DDRAWSURFACE_GBL;
    869 
    870 #define DDRAWISURFGBL_MEMFREE			0x00000001
    871 #define DDRAWISURFGBL_SYSMEMREQUESTED		0x00000002
    872 #define DDRAWISURFGBL_ISGDISURFACE		0x00000004
    873 #define DDRAWISURFGBL_SOFTWAREAUTOFLIP		0x00000008
    874 #define DDRAWISURFGBL_LOCKNOTHOLDINGWIN16LOCK	0x00000010
    875 #define DDRAWISURFGBL_LOCKVRAMSTYLE		0x00000020
    876 #define DDRAWISURFGBL_LOCKBROKEN		0x00000040
    877 #define DDRAWISURFGBL_IMPLICITHANDLE		0x00000080
    878 #define DDRAWISURFGBL_ISCLIENTMEM		0x00000100
    879 #define DDRAWISURFGBL_HARDWAREOPSOURCE		0x00000200
    880 #define DDRAWISURFGBL_HARDWAREOPDEST		0x00000400
    881 #define DDRAWISURFGBL_HARDWAREOPSTARTED		0x00000600
    882 #define DDRAWISURFGBL_VPORTINTERLEAVED		0x00000800
    883 #define DDRAWISURFGBL_VPORTDATA			0x00001000
    884 #define DDRAWISURFGBL_LATEALLOCATELINEAR	0x00002000
    885 #define DDRAWISURFGBL_SYSMEMEXECUTEBUFFER	0x00004000
    886 #define DDRAWISURFGBL_FASTLOCKHELD		0x00008000
    887 #define DDRAWISURFGBL_READONLYLOCKHELD		0x00010000
    888 
    889 typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE {
    890     DWORD			dwSize;
    891     union {
    892 	DWORD			dwPhysicalPageTable;
    893 	FLATPTR			fpPhysicalVidMem;
    894     } DUMMYUNIONNAME1;
    895     LPDWORD			pPageTable;
    896     DWORD			cPages;
    897     ULONG_PTR			dwSavedDCContext;
    898     FLATPTR			fpAliasedVidMem;
    899     ULONG_PTR			dwDriverReserved;
    900     ULONG_PTR			dwHELReserved;
    901     DWORD			cPageUnlocks;
    902     ULONG_PTR			hKernelSurface;
    903     DWORD			dwKernelRefCnt;
    904     LPDDCOLORCONTROL		lpColorInfo;
    905     FLATPTR			fpNTAlias;
    906     DWORD			dwContentsStamp;
    907     LPVOID			lpvUnswappedDriverReserved;
    908     LPVOID			lpDDRAWReserved2;
    909     DWORD			dwDDRAWReserved1;
    910     DWORD			dwDDRAWReserved2;
    911     FLATPTR			fpAliasOfVidMem;
    912 } DDRAWI_DDRAWSURFACE_GBL_MORE;
    913 
    914 /* the MS version of this macro was somewhat obfuscated and unreadable
    915  * (possibly because of mediocre MS coders)... so I simplified it...
    916  * (and so I commit no copyright violations either, hah) */
    917 #define GET_LPDDRAWSURFACE_GBL_MORE(psurf_gbl) \
    918     (*(((LPDDRAWI_DDRAWSURFACE_GBL_MORE *)(psurf_gbl)) - 1))
    919 
    920 typedef struct _DDRAWI_DDRAWSURFACE_MORE {
    921     DWORD			dwSize;
    922     IUNKNOWN_LIST *		lpIUnknowns;
    923     LPDDRAWI_DIRECTDRAW_LCL	lpDD_lcl;
    924     DWORD			dwPageLockCount;
    925     DWORD			dwBytesAllocated;
    926     LPDDRAWI_DIRECTDRAW_INT	lpDD_int;
    927     DWORD			dwMipMapCount;
    928     LPDDRAWI_DDRAWCLIPPER_INT	lpDDIClipper;
    929     /* DirectX 5.0 */
    930     LPHEAPALIASINFO		lpHeapAliasInfo;
    931     DWORD			dwOverlayFlags;
    932     VOID			*rgjunc;
    933     LPDDRAWI_DDVIDEOPORT_LCL	lpVideoPort;
    934     LPDDOVERLAYFX		lpddOverlayFX;
    935     DDSCAPSEX			ddsCapsEx;
    936     DWORD			dwTextureStage;
    937     LPVOID			lpDDRAWReserved;
    938     LPVOID			lpDDRAWReserved2;
    939     LPVOID			lpDDrawReserved3;
    940     DWORD			dwDDrawReserved4;
    941     LPVOID			lpDDrawReserved5;
    942     LPDWORD			lpGammaRamp;
    943     LPDWORD			lpOriginalGammaRamp;
    944     LPVOID			lpDDrawReserved6;
    945     DWORD			dwSurfaceHandle;
    946     DWORD			qwDDrawReserved8[2];
    947     LPVOID			lpDDrawReserved9;
    948     DWORD			cSurfaces;
    949     LPDDSURFACEDESC2		pCreatedDDSurfaceDesc2;
    950     LPDDRAWI_DDRAWSURFACE_LCL	*slist;
    951     DWORD			dwFVF;
    952     LPVOID			lpVB;
    953 } DDRAWI_DDRAWSURFACE_MORE;
    954 
    955 typedef struct _DDRAWI_DDRAWSURFACE_LCL {
    956     LPDDRAWI_DDRAWSURFACE_MORE	lpSurfMore;
    957     LPDDRAWI_DDRAWSURFACE_GBL	lpGbl;
    958     ULONG_PTR			hDDSurface;
    959     LPATTACHLIST		lpAttachList;
    960     LPATTACHLIST		lpAttachListFrom;
    961     DWORD			dwLocalRefCnt;
    962     DWORD			dwProcessId;
    963     DWORD			dwFlags;
    964     DDSCAPS			ddsCaps;
    965     LPDDRAWI_DDRAWPALETTE_INT	lpDDPalette;
    966     LPDDRAWI_DDRAWCLIPPER_LCL	lpDDClipper;
    967     DWORD			dwModeCreatedIn;
    968     DWORD			dwBackBufferCount;
    969     DDCOLORKEY			ddckCKDestBlt;
    970     DDCOLORKEY			ddckCKSrcBlt;
    971     ULONG_PTR			hDC;
    972     ULONG_PTR			dwReserved1; /* for display driver use */
    973     /* overlays only */
    974     DDCOLORKEY			ddckCKSrcOverlay;
    975     DDCOLORKEY			ddckCKDestOverlay;
    976     LPDDRAWI_DDRAWSURFACE_INT	lpSurfaceOverlaying;
    977     DBLNODE			dbnOverlayNode;
    978     RECT			rcOverlaySrc;
    979     RECT			rcOverlayDest;
    980     DWORD			dwClrXparent;
    981     DWORD			dwAlpha;
    982     LONG			lOverlayX;
    983     LONG			lOverlayY;
    984 } DDRAWI_DDRAWSURFACE_LCL;
    985 
    986 #define DDRAWISURF_ATTACHED		0x00000001
    987 #define DDRAWISURF_IMPLICITCREATE	0x00000002
    988 #define DDRAWISURF_ISFREE		0x00000004
    989 #define DDRAWISURF_ATTACHED_FROM	0x00000008
    990 #define DDRAWISURF_IMPLICITROOT		0x00000010
    991 #define DDRAWISURF_PARTOFPRIMARYCHAIN	0x00000020
    992 #define DDRAWISURF_DATAISALIASED	0x00000040
    993 #define DDRAWISURF_HASDC		0x00000080
    994 #define DDRAWISURF_HASCKEYDESTOVERLAY	0x00000100
    995 #define DDRAWISURF_HASCKEYDESTBLT	0x00000200
    996 #define DDRAWISURF_HASCKEYSRCOVERLAY	0x00000400
    997 #define DDRAWISURF_HASCKEYSRCBLT	0x00000800
    998 #define DDRAWISURF_LOCKEXCLUDEDCURSOR	0x00001000
    999 #define DDRAWISURF_HASPIXELFORMAT	0x00002000
   1000 #define DDRAWISURF_HASOVERLAYDATA	0x00004000
   1001 #define DDRAWISURF_SETGAMMA		0x00008000
   1002 /* more... */
   1003 #define DDRAWISURF_INVALID		0x10000000
   1004 
   1005 /* palettes */
   1006 typedef struct _DDRAWI_DDRAWPALETTE_INT {
   1007     LPVOID			lpVtbl;
   1008     LPDDRAWI_DDRAWPALETTE_LCL	lpLcl;
   1009     LPDDRAWI_DDRAWPALETTE_INT	lpLink;
   1010     DWORD			dwIntRefCnt;
   1011 } DDRAWI_DDRAWPALETTE_INT;
   1012 
   1013 typedef struct _DDRAWI_DDRAWPALETTE_GBL {
   1014     DWORD			dwRefCnt;
   1015     DWORD			dwFlags;
   1016     LPDDRAWI_DIRECTDRAW_LCL	lpDD_lcl;
   1017     DWORD			dwProcessId;
   1018     LPPALETTEENTRY		lpColorTable;
   1019     union {
   1020 	ULONG_PTR		dwReserved1; /* for display driver use */
   1021 	HPALETTE		hHELGDIPalette;
   1022     } DUMMYUNIONNAME1;
   1023     /* DirectX 5.0 */
   1024     DWORD			dwDriverReserved;
   1025     DWORD			dwContentsStamp;
   1026     /* DirectX 6.0 */
   1027     DWORD			dwSaveStamp;
   1028     /* DirectX 7.0 */
   1029     DWORD			dwHandle;
   1030 } DDRAWI_DDRAWPALETTE_GBL;
   1031 
   1032 #define DDRAWIPAL_256		0x00000001
   1033 #define DDRAWIPAL_16		0x00000002
   1034 #define DDRAWIPAL_GDI		0x00000004
   1035 #define DDRAWIPAL_STORED_8	0x00000008
   1036 #define DDRAWIPAL_STORED_16	0x00000010
   1037 #define DDRAWIPAL_STORED_24	0x00000020
   1038 #define DDRAWIPAL_EXCLUSIVE	0x00000040
   1039 #define DDRAWIPAL_INHEL		0x00000080
   1040 #define DDRAWIPAL_DIRTY		0x00000100
   1041 #define DDRAWIPAL_ALLOW256	0x00000200
   1042 #define DDRAWIPAL_4		0x00000400
   1043 #define DDRAWIPAL_2		0x00000800
   1044 #define DDRAWIPAL_STORED_8INDEX	0x00001000
   1045 #define DDRAWIPAL_ALPHA		0x00002000
   1046 
   1047 typedef struct _DDRAWI_DDRAWPALETTE_LCL {
   1048     DWORD			lpPalMore;
   1049     LPDDRAWI_DDRAWPALETTE_GBL	lpGbl;
   1050     ULONG_PTR			dwUnused0;
   1051     DWORD			dwLocalRefCnt;
   1052     IUnknown *			pUnkOuter;
   1053     LPDDRAWI_DIRECTDRAW_LCL	lpDD_lcl;
   1054     ULONG_PTR			dwReserved1;
   1055     /* DirectX 6.0 */
   1056     ULONG_PTR			dwDDRAWReserved1;
   1057     ULONG_PTR			dwDDRAWReserved2;
   1058     ULONG_PTR			dwDDRAWReserved3;
   1059 } DDRAWI_DDRAWPALETTE_LCL;
   1060 
   1061 #ifdef __cplusplus
   1062 } /* extern "C" */
   1063 #endif
   1064 
   1065 #endif /* __DDRAWI_INCLUDED__ */
   1066