Added Spanish translation.
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef __WINE_DDRAWI_H
23 #define __WINE_DDRAWI_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include <ddraw.h>
30 #include <dciddi.h> /* the DD HAL is layered onto DCI escapes */
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_SETPALETTEDATA {
596     LPDDRAWI_DIRECTDRAW_GBL     lpDD;
597     LPDDRAWI_DDRAWSURFACE_LCL   lpDDSurface;
598     LPDDRAWI_DDRAWPALETTE_GBL   lpDDPalette;
599     HRESULT                     ddRVal;
600     LPDDHALSURFCB_SETPALETTE    SetPalette;
601     BOOL                        Attach;
602 } DDHAL_SETPALETTEDATA;
603
604 /* palettes */
605 typedef struct _DDHAL_DESTROYPALETTEDATA {
606     LPDDRAWI_DIRECTDRAW_GBL     lpDD;
607     LPDDRAWI_DDRAWPALETTE_GBL   lpDDPalette;
608     HRESULT                     ddRVal;
609     LPDDHALPALCB_DESTROYPALETTE DestroyPalette;
610 } DDHAL_DESTROYPALETTEDATA;
611
612 typedef struct _DDHAL_SETENTRIESDATA {
613     LPDDRAWI_DIRECTDRAW_GBL     lpDD;
614     LPDDRAWI_DDRAWPALETTE_GBL   lpDDPalette;
615     DWORD                       dwBase;
616     DWORD                       dwNumEntries;
617     LPPALETTEENTRY              lpEntries;
618     HRESULT                     ddRVal;
619     LPDDHALPALCB_SETENTRIES     SetEntries;
620 } DDHAL_SETENTRIESDATA;
621
622 typedef struct _DDHAL_GETDRIVERINFODATA {
623     DWORD       dwSize;
624     DWORD       dwFlags;
625     GUID        guidInfo;
626     DWORD       dwExpectedSize;
627     LPVOID      lpvData;
628     DWORD       dwActualSize;
629     HRESULT     ddRVal;
630     ULONG_PTR   dwContext;
631 } DDHAL_GETDRIVERINFODATA;
632
633 /*****************************************************************************
634  * high-level ddraw implementation structures
635  */
636 typedef struct _IUNKNOWN_LIST {
637     struct _IUNKNOWN_LIST *     lpLink;
638     LPGUID                      lpGuid;
639     IUnknown *                  lpIUnknown;
640 } IUNKNOWN_LIST,*LPIUNKNOWN_LIST;
641
642 typedef struct _PROCESS_LIST {
643     struct _PROCESS_LIST *      lpLink;
644     DWORD                       dwProcessId;
645     DWORD                       dwRefCnt;
646     DWORD                       dwAlphaDepth;
647     DWORD                       dwZDepth;
648 } PROCESS_LIST,*LPPROCESS_LIST;
649
650 typedef struct _ATTACHLIST {
651     DWORD                       dwFlags;
652     struct _ATTACHLIST *        lpLink;
653     LPDDRAWI_DDRAWSURFACE_LCL   lpAttached;
654     LPDDRAWI_DDRAWSURFACE_INT   lpIAttached;
655 } ATTACHLIST,*LPATTACHLIST;
656
657 #define DDAL_IMPLICIT   0x00000001
658
659 typedef struct _ACCESSRECTLIST {
660     struct _ACCESSRECTLIST *    lpLink;
661     RECT                        rDest;
662     LPDDRAWI_DIRECTDRAW_LCL     lpOwner;
663     LPVOID                      lpSurfaceData;
664     DWORD                       dwFlags;
665     LPHEAPALIASINFO             lpHeapAliasInfo;
666 } ACCESSRECTLIST,*LPACCESSRECTLIST;
667
668 #define ACCESSRECT_VRAMSTYLE            0x00000001
669 #define ACCESSRECT_NOTHOLDINGWIN16LOCK  0x00000002
670 #define ACCESSRECT_BROKEN               0x00000004
671
672 typedef struct _DBLNODE {
673     struct _DBLNODE *           next;
674     struct _DBLNODE *           prev;
675     LPDDRAWI_DDRAWSURFACE_LCL   object;
676     LPDDRAWI_DDRAWSURFACE_INT   object_int;
677 } DBLNODE,*LPDBLNODE;
678
679 typedef struct _DDRAWI_DIRECTDRAW_INT {
680     LPVOID                      lpVtbl;
681     LPDDRAWI_DIRECTDRAW_LCL     lpLcl;
682     LPDDRAWI_DIRECTDRAW_INT     lpLink;
683     DWORD                       dwIntRefCnt;
684 } DDRAWI_DIRECTDRAW_INT;
685
686 typedef struct _DDRAWI_DIRECTDRAW_LCL {
687     DWORD                       lpDDMore;
688     LPDDRAWI_DIRECTDRAW_GBL     lpGbl;
689     DWORD                       dwUnused0;
690     DWORD                       dwLocalFlags;
691     DWORD                       dwLocalRefCnt;
692     DWORD                       dwProcessId;
693     IUnknown *                  pUnkOuter;
694     DWORD                       dwObsolete1;
695     ULONG_PTR                   hWnd;
696     ULONG_PTR                   hDC;
697     DWORD                       dwErrorMode;
698     LPDDRAWI_DDRAWSURFACE_INT   lpPrimary;
699     LPDDRAWI_DDRAWSURFACE_INT   lpCB;
700     DWORD                       dwPreferredMode;
701     /* DirectX 2 */
702     HINSTANCE                   hD3DInstance;
703     IUnknown *                  pD3DIUnknown;
704     LPDDHAL_CALLBACKS           lpDDCB;
705     ULONG_PTR                   hDDVxd;
706     /* DirectX 5.0 */
707     DWORD                       dwAppHackFlags;
708     /* DirectX 5.0A */
709     ULONG_PTR                   hFocusWnd;
710     DWORD                       dwHotTracking;
711     DWORD                       dwIMEState;
712     /* DirectX 6.0 */
713     ULONG_PTR                   hWndPopup;
714     ULONG_PTR                   hDD;
715     ULONG_PTR                   hGammaCalibrator;
716     LPDDGAMMACALIBRATORPROC     lpGammaCalibrator;
717 } DDRAWI_DIRECTDRAW_LCL;
718
719 #define DDRAWILCL_HASEXCLUSIVEMODE      0x00000001
720 #define DDRAWILCL_ISFULLSCREEN          0x00000002
721 #define DDRAWILCL_SETCOOPCALLED         0x00000004
722 #define DDRAWILCL_ACTIVEYES             0x00000008
723 #define DDRAWILCL_ACTIVENO              0x00000010
724 #define DDRAWILCL_HOOKEDHWND            0x00000020
725 #define DDRAWILCL_ALLOWMODEX            0x00000040
726 #define DDRAWILCL_V1SCLBEHAVIOUR        0x00000080
727 #define DDRAWILCL_MODEHASBEENCHANGED    0x00000100
728 #define DDRAWILCL_CREATEDWINDOW         0x00000200
729 #define DDRAWILCL_DIRTYDC               0x00000400
730 #define DDRAWILCL_DISABLEINACTIVATE     0x00000800
731 #define DDRAWILCL_CURSORCLIPPED         0x00001000
732 #define DDRAWILCL_EXPLICITMONITOR       0x00002000
733 #define DDRAWILCL_MULTITHREADED         0x00004000
734 #define DDRAWILCL_FPUSETUP              0x00008000
735 #define DDRAWILCL_POWEREDDOWN           0x00010000
736 #define DDRAWILCL_DIRECTDRAW7           0x00020000
737 #define DDRAWILCL_ATTEMPTEDD3DCONTEXT   0x00040000
738 #define DDRAWILCL_FPUPRESERVE           0x00080000
739
740 typedef struct _DDRAWI_DIRECTDRAW_GBL {
741     DWORD                       dwRefCnt;
742     DWORD                       dwFlags;
743     FLATPTR                     fpPrimaryOrig;
744     DDCORECAPS                  ddCaps;
745     DWORD                       dwInternal1;
746     DWORD                       dwUnused1[9];
747     LPDDHAL_CALLBACKS           lpDDCBtmp;
748     LPDDRAWI_DDRAWSURFACE_INT   dsList;
749     LPDDRAWI_DDRAWPALETTE_INT   palList;
750     LPDDRAWI_DDRAWCLIPPER_INT   clipperList;
751     LPDDRAWI_DIRECTDRAW_GBL     lp16DD;
752     DWORD                       dwMaxOverlays;
753     DWORD                       dwCurrOverlays;
754     DWORD                       dwMonitorFrequency;
755     DDCORECAPS                  ddHELCaps;
756     DWORD                       dwUnused2[50];
757     DDCOLORKEY                  ddckCKDestOverlay;
758     DDCOLORKEY                  ddckCKSrcOverlay;
759     VIDMEMINFO                  vmiData;
760     LPVOID                      lpDriverHandle;
761     LPDDRAWI_DIRECTDRAW_LCL     lpExclusiveOwner;
762     DWORD                       dwModeIndex;
763     DWORD                       dwModeIndexOrig;
764     DWORD                       dwNumFourCC;
765     LPDWORD                     lpdwFourCC;
766     DWORD                       dwNumModes;
767     LPDDHALMODEINFO             lpModeInfo;
768     PROCESS_LIST                plProcessList;
769     DWORD                       dwSurfaceLockCount;
770     DWORD                       dwAliasedLockCnt;
771     ULONG_PTR                   dwReserved3;
772     ULONG_PTR                   hDD;
773     char                        cObsolete[12];
774     DWORD                       dwReserved1;
775     DWORD                       dwReserved2;
776     DBLNODE                     dbnOverlayRoot;
777     volatile LPWORD             lpwPDeviceFlags;
778     DWORD                       dwPDevice;
779     DWORD                       dwWin16LockCnt;
780     DWORD                       dwUnused3;
781     DWORD                       hInstance;
782     DWORD                       dwEvent16;
783     DWORD                       dwSaveNumModes;
784     /* DirectX 2 */
785     ULONG_PTR                   lpD3DGlobalDriverData;
786     ULONG_PTR                   lpD3DHALCallbacks;
787     DDCORECAPS                  ddBothCaps;
788     /* DirectX 5.0 */
789     LPDDVIDEOPORTCAPS           lpDDVideoPortCaps;
790     LPDDRAWI_DDVIDEOPORT_INT    dvpList;
791     ULONG_PTR                   lpD3DHALCallbacks2;
792     RECT                        rectDevice;
793     DWORD                       cMonitors;
794     LPVOID                      gpbmiSrc;
795     LPVOID                      gpbmiDest;
796     LPHEAPALIASINFO             phaiHeapAliases;
797     ULONG_PTR                   hKernelHandle;
798     ULONG_PTR                   pfnNotifyProc;
799     LPDDKERNELCAPS              lpDDKernelCaps;
800     LPDDNONLOCALVIDMEMCAPS      lpddNLVCaps;
801     LPDDNONLOCALVIDMEMCAPS      lpddNLVHELCaps;
802     LPDDNONLOCALVIDMEMCAPS      lpddNLVBothCaps;
803     ULONG_PTR                   lpD3DExtendedCaps;
804     /* DirectX 5.0A */
805     DWORD                       dwDOSBoxEvent;
806     RECT                        rectDesktop;
807     char                        cDriverName[MAX_DRIVER_NAME];
808     /* DirectX 6.0 */
809     ULONG_PTR                   lpD3DHALCallbacks3;
810     DWORD                       dwNumZPixelFormats;
811     LPDDPIXELFORMAT             lpZPixelFormats;
812     LPDDRAWI_DDMOTIONCOMP_INT   mcList;
813     DWORD                       hDDVxd;
814     DDSCAPSEX                   ddsCapsMore;
815 } DDRAWI_DIRECTDRAW_GBL;
816
817 #define DDRAWI_VIRTUALDESKTOP   0x00000008
818 #define DDRAWI_MODEX            0x00000010
819 #define DDRAWI_DISPLAYDRV       0x00000020
820 #define DDRAWI_FULLSCREEN       0x00000040
821 #define DDRAWI_MODECHANGED      0x00000080
822 #define DDRAWI_NOHARDWARE       0x00000100
823 #define DDRAWI_PALETTEINIT      0x00000200
824 #define DDRAWI_NOEMULATION      0x00000400
825 /* more... */
826
827 /* surfaces */
828 typedef struct _DDRAWI_DDRAWSURFACE_INT {
829     LPVOID                      lpVtbl;
830     LPDDRAWI_DDRAWSURFACE_LCL   lpLcl;
831     LPDDRAWI_DDRAWSURFACE_INT   lpLink;
832     DWORD                       dwIntRefCnt;
833 } DDRAWI_DDRAWSURFACE_INT;
834
835 typedef struct _DDRAWI_DDRAWSURFACE_GBL {
836     DWORD                       dwRefCnt;
837     DWORD                       dwGlobalFlags;
838     union {
839         LPACCESSRECTLIST        lpRectList;
840         DWORD                   dwBlockSizeY;
841     } DUMMYUNIONNAME1;
842     union {
843         LPVMEMHEAP              lpVidMemHeap;
844         DWORD                   dwBlockSizeX;
845     } DUMMYUNIONNAME2;
846     union {
847         LPDDRAWI_DIRECTDRAW_GBL lpDD;
848         LPVOID                  lpDDHandle;
849     } DUMMYUNIONNAME3;
850     FLATPTR                     fpVidMem;
851     union {
852         LONG                    lPitch;
853         DWORD                   dwLinearSize;
854     } DUMMYUNIONNAME4;
855     WORD                        wHeight;
856     WORD                        wWidth;
857     DWORD                       dwUsageCount;
858     ULONG_PTR                   dwReserved1; /* for display driver use */
859     /* optional (defaults to primary surface pixelformat) */
860     DDPIXELFORMAT               ddpfSurface;
861 } DDRAWI_DDRAWSURFACE_GBL;
862
863 #define DDRAWISURFGBL_MEMFREE                   0x00000001
864 #define DDRAWISURFGBL_SYSMEMREQUESTED           0x00000002
865 #define DDRAWISURFGBL_ISGDISURFACE              0x00000004
866 #define DDRAWISURFGBL_SOFTWAREAUTOFLIP          0x00000008
867 #define DDRAWISURFGBL_LOCKNOTHOLDINGWIN16LOCK   0x00000010
868 #define DDRAWISURFGBL_LOCKVRAMSTYLE             0x00000020
869 #define DDRAWISURFGBL_LOCKBROKEN                0x00000040
870 #define DDRAWISURFGBL_IMPLICITHANDLE            0x00000080
871 #define DDRAWISURFGBL_ISCLIENTMEM               0x00000100
872 #define DDRAWISURFGBL_HARDWAREOPSOURCE          0x00000200
873 #define DDRAWISURFGBL_HARDWAREOPDEST            0x00000400
874 #define DDRAWISURFGBL_HARDWAREOPSTARTED         0x00000600
875 #define DDRAWISURFGBL_VPORTINTERLEAVED          0x00000800
876 #define DDRAWISURFGBL_VPORTDATA                 0x00001000
877 #define DDRAWISURFGBL_LATEALLOCATELINEAR        0x00002000
878 #define DDRAWISURFGBL_SYSMEMEXECUTEBUFFER       0x00004000
879 #define DDRAWISURFGBL_FASTLOCKHELD              0x00008000
880 #define DDRAWISURFGBL_READONLYLOCKHELD          0x00010000
881
882 typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE {
883     DWORD                       dwSize;
884     union {
885         DWORD                   dwPhysicalPageTable;
886         FLATPTR                 fpPhysicalVidMem;
887     } DUMMYUNIONNAME1;
888     LPDWORD                     pPageTable;
889     DWORD                       cPages;
890     ULONG_PTR                   dwSavedDCContext;
891     FLATPTR                     fpAliasedVidMem;
892     ULONG_PTR                   dwDriverReserved;
893     ULONG_PTR                   dwHELReserved;
894     DWORD                       cPageUnlocks;
895     ULONG_PTR                   hKernelSurface;
896     DWORD                       dwKernelRefCnt;
897     LPDDCOLORCONTROL            lpColorInfo;
898     FLATPTR                     fpNTAlias;
899     DWORD                       dwContentsStamp;
900     LPVOID                      lpvUnswappedDriverReserved;
901     LPVOID                      lpDDRAWReserved2;
902     DWORD                       dwDDRAWReserved1;
903     DWORD                       dwDDRAWReserved2;
904     FLATPTR                     fpAliasOfVidMem;
905 } DDRAWI_DDRAWSURFACE_GBL_MORE;
906
907 /* the MS version of this macro was somewhat obfuscated and unreadable
908  * (possibly because of mediocre MS coders)... so I simplified it...
909  * (and so I commit no copyright violations either, hah) */
910 #define GET_LPDDRAWSURFACE_GBL_MORE(psurf_gbl) \
911     (*(((LPDDRAWI_DDRAWSURFACE_GBL_MORE *)(psurf_gbl)) - 1))
912
913 typedef struct _DDRAWI_DDRAWSURFACE_MORE {
914     DWORD                       dwSize;
915     IUNKNOWN_LIST *             lpIUnknowns;
916     LPDDRAWI_DIRECTDRAW_LCL     lpDD_lcl;
917     DWORD                       dwPageLockCount;
918     DWORD                       dwBytesAllocated;
919     LPDDRAWI_DIRECTDRAW_INT     lpDD_int;
920     DWORD                       dwMipMapCount;
921     LPDDRAWI_DDRAWCLIPPER_INT   lpDDIClipper;
922     /* DirectX 5.0 */
923     LPHEAPALIASINFO             lpHeapAliasInfo;
924     DWORD                       dwOverlayFlags;
925     VOID                        *rgjunc;
926     LPDDRAWI_DDVIDEOPORT_LCL    lpVideoPort;
927     LPDDOVERLAYFX               lpddOverlayFX;
928     DDSCAPSEX                   ddsCapsEx;
929     DWORD                       dwTextureStage;
930     LPVOID                      lpDDRAWReserved;
931     LPVOID                      lpDDRAWReserved2;
932     LPVOID                      lpDDrawReserved3;
933     DWORD                       dwDDrawReserved4;
934     LPVOID                      lpDDrawReserved5;
935     LPDWORD                     lpGammaRamp;
936     LPDWORD                     lpOriginalGammaRamp;
937     LPVOID                      lpDDrawReserved6;
938     DWORD                       dwSurfaceHandle;
939     DWORD                       qwDDrawReserved8[2];
940     LPVOID                      lpDDrawReserved9;
941     DWORD                       cSurfaces;
942     LPDDSURFACEDESC2            pCreatedDDSurfaceDesc2;
943     LPDDRAWI_DDRAWSURFACE_LCL   *slist;
944     DWORD                       dwFVF;
945     LPVOID                      lpVB;
946 } DDRAWI_DDRAWSURFACE_MORE;
947
948 typedef struct _DDRAWI_DDRAWSURFACE_LCL {
949     LPDDRAWI_DDRAWSURFACE_MORE  lpSurfMore;
950     LPDDRAWI_DDRAWSURFACE_GBL   lpGbl;
951     ULONG_PTR                   hDDSurface;
952     LPATTACHLIST                lpAttachList;
953     LPATTACHLIST                lpAttachListFrom;
954     DWORD                       dwLocalRefCnt;
955     DWORD                       dwProcessId;
956     DWORD                       dwFlags;
957     DDSCAPS                     ddsCaps;
958     LPDDRAWI_DDRAWPALETTE_INT   lpDDPalette;
959     LPDDRAWI_DDRAWCLIPPER_LCL   lpDDClipper;
960     DWORD                       dwModeCreatedIn;
961     DWORD                       dwBackBufferCount;
962     DDCOLORKEY                  ddckCKDestBlt;
963     DDCOLORKEY                  ddckCKSrcBlt;
964     ULONG_PTR                   hDC;
965     ULONG_PTR                   dwReserved1; /* for display driver use */
966     /* overlays only */
967     DDCOLORKEY                  ddckCKSrcOverlay;
968     DDCOLORKEY                  ddckCKDestOverlay;
969     LPDDRAWI_DDRAWSURFACE_INT   lpSurfaceOverlaying;
970     DBLNODE                     dbnOverlayNode;
971     RECT                        rcOverlaySrc;
972     RECT                        rcOverlayDest;
973     DWORD                       dwClrXparent;
974     DWORD                       dwAlpha;
975     LONG                        lOverlayX;
976     LONG                        lOverlayY;
977 } DDRAWI_DDRAWSURFACE_LCL;
978
979 #define DDRAWISURF_ATTACHED             0x00000001
980 #define DDRAWISURF_IMPLICITCREATE       0x00000002
981 #define DDRAWISURF_ISFREE               0x00000004
982 #define DDRAWISURF_ATTACHED_FROM        0x00000008
983 #define DDRAWISURF_IMPLICITROOT         0x00000010
984 #define DDRAWISURF_PARTOFPRIMARYCHAIN   0x00000020
985 #define DDRAWISURF_DATAISALIASED        0x00000040
986 #define DDRAWISURF_HASDC                0x00000080
987 #define DDRAWISURF_HASCKEYDESTOVERLAY   0x00000100
988 #define DDRAWISURF_HASCKEYDESTBLT       0x00000200
989 #define DDRAWISURF_HASCKEYSRCOVERLAY    0x00000400
990 #define DDRAWISURF_HASCKEYSRCBLT        0x00000800
991 #define DDRAWISURF_LOCKEXCLUDEDCURSOR   0x00001000
992 #define DDRAWISURF_HASPIXELFORMAT       0x00002000
993 #define DDRAWISURF_HASOVERLAYDATA       0x00004000
994 #define DDRAWISURF_SETGAMMA             0x00008000
995 /* more... */
996 #define DDRAWISURF_INVALID              0x10000000
997
998 /* palettes */
999 typedef struct _DDRAWI_DDRAWPALETTE_INT {
1000     LPVOID                      lpVtbl;
1001     LPDDRAWI_DDRAWPALETTE_LCL   lpLcl;
1002     LPDDRAWI_DDRAWPALETTE_INT   lpLink;
1003     DWORD                       dwIntRefCnt;
1004 } DDRAWI_DDRAWPALETTE_INT;
1005
1006 typedef struct _DDRAWI_DDRAWPALETTE_GBL {
1007     DWORD                       dwRefCnt;
1008     DWORD                       dwFlags;
1009     LPDDRAWI_DIRECTDRAW_LCL     lpDD_lcl;
1010     DWORD                       dwProcessId;
1011     LPPALETTEENTRY              lpColorTable;
1012     union {
1013         ULONG_PTR               dwReserved1; /* for display driver use */
1014         HPALETTE                hHELGDIPalette;
1015     } DUMMYUNIONNAME1;
1016     /* DirectX 5.0 */
1017     DWORD                       dwDriverReserved;
1018     DWORD                       dwContentsStamp;
1019     /* DirectX 6.0 */
1020     DWORD                       dwSaveStamp;
1021     /* DirectX 7.0 */
1022     DWORD                       dwHandle;
1023 } DDRAWI_DDRAWPALETTE_GBL;
1024
1025 #define DDRAWIPAL_256           0x00000001
1026 #define DDRAWIPAL_16            0x00000002
1027 #define DDRAWIPAL_GDI           0x00000004
1028 #define DDRAWIPAL_STORED_8      0x00000008
1029 #define DDRAWIPAL_STORED_16     0x00000010
1030 #define DDRAWIPAL_STORED_24     0x00000020
1031 #define DDRAWIPAL_EXCLUSIVE     0x00000040
1032 #define DDRAWIPAL_INHEL         0x00000080
1033 #define DDRAWIPAL_DIRTY         0x00000100
1034 #define DDRAWIPAL_ALLOW256      0x00000200
1035 #define DDRAWIPAL_4             0x00000400
1036 #define DDRAWIPAL_2             0x00000800
1037 #define DDRAWIPAL_STORED_8INDEX 0x00001000
1038 #define DDRAWIPAL_ALPHA         0x00002000
1039
1040 typedef struct _DDRAWI_DDRAWPALETTE_LCL {
1041     DWORD                       lpPalMore;
1042     LPDDRAWI_DDRAWPALETTE_GBL   lpGbl;
1043     ULONG_PTR                   dwUnused0;
1044     DWORD                       dwLocalRefCnt;
1045     IUnknown *                  pUnkOuter;
1046     LPDDRAWI_DIRECTDRAW_LCL     lpDD_lcl;
1047     ULONG_PTR                   dwReserved1;
1048     /* DirectX 6.0 */
1049     ULONG_PTR                   dwDDRAWReserved1;
1050     ULONG_PTR                   dwDDRAWReserved2;
1051     ULONG_PTR                   dwDDRAWReserved3;
1052 } DDRAWI_DDRAWPALETTE_LCL;
1053
1054 #ifdef __cplusplus
1055 } /* extern "C" */
1056 #endif
1057
1058 #endif /* __WINE_DDRAWI_H */