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