xref: /reactos/sdk/include/psdk/ddrawi.h (revision c2c66aff)
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 Street, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #ifndef __DDRAWI_INCLUDED__
23 #define __DDRAWI_INCLUDED__
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define OBJECT_ISROOT           0x80000000
30 
31 #include <ddraw.h>
32 #include <dvp.h>
33 #include <ddkernel.h>
34 #include <dmemmgr.h>
35 
36 #define DDAPI WINAPI
37 
38 #define VALID_ALIGNMENT(align) \
39     (!((align==0)||(align%2)!= 0 ))
40 
41 /* the DirectDraw versions */
42 #define DD_VERSION         0x0200 /* compatibility version */
43 #define DD_RUNTIME_VERSION 0x0902 /* actual version */
44 
45 /* the HAL version returned from QUERYESCSUPPORT - DCICOMMAND */
46 #define DD_HAL_VERSION     0x0100
47 
48 /* more DCICOMMAND escapes */
49 #ifndef DCICOMMAND
50 #define DCICOMMAND 3075
51 #endif
52 
53 #define DDCREATEDRIVEROBJECT 10
54 #define DDGET32BITDRIVERNAME 11
55 #define DDNEWCALLBACKFNS     12
56 #define DDVERSIONINFO        13
57 
58 #define DDUNSUPPORTEDMODE  ((DWORD) -1)
59 
60 #include "dciddi.h"
61 
62 #ifndef CCHDEVICENAME
63 #define CCHDEVICENAME 32
64 #endif
65 #define MAX_DRIVER_NAME CCHDEVICENAME
66 
67 #define DDHAL_DRIVER_DLLNAME    "DDRAW16.DLL"
68 #define DDHAL_APP_DLLNAME       "DDRAW.DLL"
69 
70 /* GUID */
71 #ifdef _WIN32
72 DEFINE_GUID(GUID_MiscellaneousCallbacks, 0xefd60cc0, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
73 DEFINE_GUID(GUID_VideoPortCallbacks,     0xefd60cc1, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
74 DEFINE_GUID(GUID_ColorControlCallbacks,  0xefd60cc2, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
75 DEFINE_GUID(GUID_VideoPortCaps,          0xefd60cc3, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
76 DEFINE_GUID(GUID_D3DCallbacks2,          0x0ba584e1, 0x70b6, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a);
77 DEFINE_GUID(GUID_D3DCallbacks3,          0xddf41230, 0xec0a, 0x11d0, 0xa9, 0xb6, 0x00, 0xaa, 0x00, 0xc0, 0x99, 0x3e);
78 DEFINE_GUID(GUID_NonLocalVidMemCaps,     0x86c4fa80, 0x8d84, 0x11d0, 0x94, 0xe8, 0x00, 0xc0, 0x4f, 0xc3, 0x41, 0x37);
79 DEFINE_GUID(GUID_KernelCallbacks,        0x80863800, 0x6B06, 0x11D0, 0x9B, 0x06, 0x0, 0xA0, 0xC9, 0x03, 0xA3, 0xB8);
80 DEFINE_GUID(GUID_KernelCaps,             0xFFAA7540, 0x7AA8, 0x11D0, 0x9B, 0x06, 0x00, 0xA0, 0xC9, 0x03, 0xA3, 0xB8);
81 DEFINE_GUID(GUID_D3DExtendedCaps,        0x7de41f80, 0x9d93, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29);
82 DEFINE_GUID(GUID_ZPixelFormats,          0x93869880, 0x36cf, 0x11d1, 0x9b, 0x1b, 0x0, 0xaa, 0x0, 0xbb, 0xb8, 0xae);
83 DEFINE_GUID(GUID_DDMoreSurfaceCaps,      0x3b8a0466, 0xf269, 0x11d1, 0x88, 0x0b, 0x0, 0xc0, 0x4f, 0xd9, 0x30, 0xc5);
84 DEFINE_GUID(GUID_DDStereoMode,           0xf828169c, 0xa8e8, 0x11d2, 0xa1, 0xf2, 0x0, 0xa0, 0xc9, 0x83, 0xea, 0xf6);
85 DEFINE_GUID(GUID_OptSurfaceKmodeInfo,    0xe05c8472, 0x51d4, 0x11d1, 0x8c, 0xce, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
86 DEFINE_GUID(GUID_OptSurfaceUmodeInfo,    0x9d792804, 0x5fa8, 0x11d1, 0x8c, 0xd0, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
87 DEFINE_GUID(GUID_UserModeDriverInfo,     0xf0b0e8e2, 0x5f97, 0x11d1, 0x8c, 0xd0, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
88 DEFINE_GUID(GUID_UserModeDriverPassword, 0x97f861b6, 0x60a1, 0x11d1, 0x8c, 0xd0, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
89 DEFINE_GUID(GUID_D3DParseUnknownCommandCallback, 0x2e04ffa0, 0x98e4, 0x11d1, 0x8c, 0xe1, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
90 DEFINE_GUID(GUID_MotionCompCallbacks,    0xb1122b40, 0x5dA5, 0x11d1, 0x8f, 0xcF, 0x00, 0xc0, 0x4f, 0xc2, 0x9b, 0x4e);
91 DEFINE_GUID(GUID_Miscellaneous2Callbacks, 0x406B2F00, 0x3E5A, 0x11D1, 0xB6, 0x40, 0x00, 0xAA, 0x00, 0xA1, 0xF9, 0x6A);
92 #endif
93 
94 #ifndef _WIN32
95 #undef  E_NOTIMPL
96 #undef  E_OUTOFMEMORY
97 #undef  E_INVALIDARG
98 #undef  E_FAIL
99 #define E_NOTIMPL      0x80004001L
100 #define E_OUTOFMEMORY  0x8007000EL
101 #define E_INVALIDARG   0x80070057L
102 #define E_FAIL         0x80004005L
103 #endif
104 
105 /*****************************************************************************
106  * Initialization stuff
107  */
108 typedef struct {
109   char szName[260];
110   char szEntryPoint[64];
111   DWORD dwContext;
112 } DD32BITDRIVERDATA,*LPDD32BITDRIVERDATA;
113 
114 typedef struct {
115   DWORD dwHALVersion;
116   ULONG_PTR dwReserved1;
117   ULONG_PTR dwReserved2;
118 } DDVERSIONDATA,*LPDDVERSIONDATA;
119 
120 typedef DWORD (PASCAL *LPDD32BITDRIVERINIT)(DWORD dwContext);
121 
122 /* predeclare some structures */
123 typedef struct _DDHALINFO *LPDDHALINFO;
124 typedef struct _DDRAWI_DIRECTDRAW_INT *LPDDRAWI_DIRECTDRAW_INT;
125 
126 #ifndef DDRAWI_DIRECTDRAW_DEFINED
127 typedef struct _DDRAWI_DIRECTDRAW_LCL *LPDDRAWI_DIRECTDRAW_LCL;
128 typedef struct _DDRAWI_DIRECTDRAW_GBL *LPDDRAWI_DIRECTDRAW_GBL;
129 #define DDRAWI_DIRECTDRAW_DEFINED
130 #endif
131 
132 typedef struct _DDRAWI_DDRAWSURFACE_INT *LPDDRAWI_DDRAWSURFACE_INT;
133 
134 #ifndef DDRAWI_DDRAWSURFACE_DEFINED
135 typedef struct _DDRAWI_DDRAWSURFACE_LCL *LPDDRAWI_DDRAWSURFACE_LCL;
136 #define DDRAWI_DDRAWSURFACE_DEFINED
137 #endif
138 
139 typedef struct _DDRAWI_DDRAWSURFACE_GBL *LPDDRAWI_DDRAWSURFACE_GBL;
140 typedef struct _DDRAWI_DDRAWSURFACE_MORE *LPDDRAWI_DDRAWSURFACE_MORE;
141 typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE *LPDDRAWI_DDRAWSURFACE_GBL_MORE;
142 typedef struct _DDRAWI_DDRAWPALETTE_INT *LPDDRAWI_DDRAWPALETTE_INT;
143 typedef struct _DDRAWI_DDRAWPALETTE_LCL *LPDDRAWI_DDRAWPALETTE_LCL;
144 typedef struct _DDRAWI_DDRAWPALETTE_GBL *LPDDRAWI_DDRAWPALETTE_GBL;
145 typedef struct _DDRAWI_DDRAWCLIPPER_INT *LPDDRAWI_DDRAWCLIPPER_INT;
146 typedef struct _DDRAWI_DDRAWCLIPPER_LCL *LPDDRAWI_DDRAWCLIPPER_LCL;
147 typedef struct _DDRAWI_DDRAWCLIPPER_GBL *LPDDRAWI_DDRAWCLIPPER_GBL;
148 typedef struct _DDRAWI_DDVIDEOPORT_INT *LPDDRAWI_DDVIDEOPORT_INT;
149 typedef struct _DDRAWI_DDVIDEOPORT_LCL *LPDDRAWI_DDVIDEOPORT_LCL;
150 typedef struct _DDRAWI_DDMOTIONCOMP_INT *LPDDRAWI_DDMOTIONCOMP_INT;
151 typedef struct _DDRAWI_DDMOTIONCOMP_LCL *LPDDRAWI_DDMOTIONCOMP_LCL;
152 
153 /*****************************************************************************
154  * driver->ddraw callbacks
155  */
156 typedef BOOL    (DDAPI *LPDDHAL_SETINFO)(LPDDHALINFO lpDDHalInfo, BOOL reset);
157 typedef FLATPTR (DDAPI *LPDDHAL_VIDMEMALLOC)(LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, DWORD dwWidth, DWORD dwHeight);
158 typedef void    (DDAPI *LPDDHAL_VIDMEMFREE)(LPDDRAWI_DIRECTDRAW_GBL lpDD, int heap, FLATPTR fpMem);
159 
160 typedef struct {
161   DWORD dwSize;
162   LPDDHAL_SETINFO lpSetInfo;
163   LPDDHAL_VIDMEMALLOC lpVidMemAlloc;
164   LPDDHAL_VIDMEMFREE lpVidMemFree;
165 } DDHALDDRAWFNS, *LPDDHALDDRAWFNS;
166 
167 /*****************************************************************************
168  * mode info structure
169  */
170 typedef struct _DDHALMODEINFO {
171   DWORD dwWidth;
172   DWORD dwHeight;
173   LONG lPitch;
174   DWORD dwBPP;
175   WORD wFlags;
176   WORD wRefreshRate;
177   DWORD dwRBitMask;
178   DWORD dwGBitMask;
179   DWORD dwBBitMask;
180   DWORD dwAlphaBitMask;
181 } DDHALMODEINFO, *LPDDHALMODEINFO;
182 
183 #define DDMODEINFO_PALETTIZED  0x0001
184 #define DDMODEINFO_MODEX       0x0002
185 #define DDMODEINFO_UNSUPPORTED 0x0004
186 #define DDMODEINFO_STANDARDVGA 0x0008
187 #define DDMODEINFO_MAXREFRESH  0x0010
188 #define DDMODEINFO_STEREO      0x0020
189 
190 /*****************************************************************************
191  * video memory info structure
192  */
193 typedef struct _VIDMEM {
194     DWORD dwFlags;
195     FLATPTR fpStart;
196     __GNU_EXTENSION union {
197  FLATPTR fpEnd;
198  DWORD dwWidth;
199     };
200     DDSCAPS ddsCaps;
201     DDSCAPS ddsCapsAlt;
202     __GNU_EXTENSION union {
203  LPVMEMHEAP lpHeap;
204  DWORD dwHeight;
205     };
206 } VIDMEM;
207 
208 #define VIDMEM_ISLINEAR                       0x00000001l
209 #define VIDMEM_ISRECTANGULAR                  0x00000002l
210 #define VIDMEM_ISHEAP                         0x00000004l
211 #define VIDMEM_ISNONLOCAL                     0x00000008l
212 #define VIDMEM_ISWC                           0x00000010l
213 #define VIDMEM_HEAPDISABLED                   0x00000020l
214 
215 typedef struct _VIDMEMINFO {
216     FLATPTR fpPrimary;
217     DWORD dwFlags;
218     DWORD dwDisplayWidth;
219     DWORD dwDisplayHeight;
220     LONG lDisplayPitch;
221     DDPIXELFORMAT ddpfDisplay;
222     DWORD dwOffscreenAlign;
223     DWORD dwOverlayAlign;
224     DWORD dwTextureAlign;
225     DWORD dwZBufferAlign;
226     DWORD dwAlphaAlign;
227     DWORD dwNumHeaps;
228     LPVIDMEM pvmList;
229 } VIDMEMINFO, *LPVIDMEMINFO;
230 
231 typedef struct _HEAPALIAS {
232   FLATPTR fpVidMem;
233   LPVOID lpAlias;
234   DWORD dwAliasSize;
235 } HEAPALIAS, *LPHEAPALIAS;
236 
237 typedef struct _HEAPALIASINFO {
238   DWORD dwRefCnt;
239   DWORD dwFlags;
240   DWORD dwNumHeaps;
241   LPHEAPALIAS lpAliases;
242 } HEAPALIASINFO, *LPHEAPALIASINFO;
243 
244 #define HEAPALIASINFO_MAPPEDREAL  0x00000001
245 #define HEAPALIASINFO_MAPPEDDUMMY 0x00000002
246 
247 /*****************************************************************************
248  * capabilities structures
249  */
250 typedef struct _DDCORECAPS {
251   DWORD dwSize;
252   DWORD dwCaps;
253   DWORD dwCaps2;
254   DWORD dwCKeyCaps;
255   DWORD dwFXCaps;
256   DWORD dwFXAlphaCaps;
257   DWORD dwPalCaps;
258   DWORD dwSVCaps;
259   DWORD dwAlphaBltConstBitDepths;
260   DWORD dwAlphaBltPixelBitDepths;
261   DWORD dwAlphaBltSurfaceBitDepths;
262   DWORD dwAlphaOverlayConstBitDepths;
263   DWORD dwAlphaOverlayPixelBitDepths;
264   DWORD dwAlphaOverlaySurfaceBitDepths;
265   DWORD dwZBufferBitDepths;
266   DWORD dwVidMemTotal;
267   DWORD dwVidMemFree;
268   DWORD dwMaxVisibleOverlays;
269   DWORD dwCurrVisibleOverlays;
270   DWORD dwNumFourCCCodes;
271   DWORD dwAlignBoundarySrc;
272   DWORD dwAlignSizeSrc;
273   DWORD dwAlignBoundaryDest;
274   DWORD dwAlignSizeDest;
275   DWORD dwAlignStrideAlign;
276   DWORD dwRops[DD_ROP_SPACE];
277   DDSCAPS ddsCaps;
278   DWORD dwMinOverlayStretch;
279   DWORD dwMaxOverlayStretch;
280   DWORD dwMinLiveVideoStretch;
281   DWORD dwMaxLiveVideoStretch;
282   DWORD dwMinHwCodecStretch;
283   DWORD dwMaxHwCodecStretch;
284   DWORD dwReserved1;
285   DWORD dwReserved2;
286   DWORD dwReserved3;
287   DWORD dwSVBCaps;
288   DWORD dwSVBCKeyCaps;
289   DWORD dwSVBFXCaps;
290   DWORD dwSVBRops[DD_ROP_SPACE];
291   DWORD dwVSBCaps;
292   DWORD dwVSBCKeyCaps;
293   DWORD dwVSBFXCaps;
294   DWORD dwVSBRops[DD_ROP_SPACE];
295   DWORD dwSSBCaps;
296   DWORD dwSSBCKeyCaps;
297   DWORD dwSSBFXCaps;
298   DWORD dwSSBRops[DD_ROP_SPACE];
299   DWORD dwMaxVideoPorts;
300   DWORD dwCurrVideoPorts;
301   DWORD dwSVBCaps2;
302 } DDCORECAPS, *LPDDCORECAPS;
303 
304 typedef struct _DDNONLOCALVIDMEMCAPS {
305   DWORD dwSize;
306   DWORD dwNLVBCaps;
307   DWORD dwNLVBCaps2;
308   DWORD dwNLVBCKeyCaps;
309   DWORD dwNLVBFXCaps;
310   DWORD dwNLVBRops[DD_ROP_SPACE];
311 } DDNONLOCALVIDMEMCAPS, *LPDDNONLOCALVIDMEMCAPS;
312 
313 #define DDSCAPS_EXECUTEBUFFER  DDSCAPS_RESERVED2
314 #define DDSCAPS2_VERTEXBUFFER  DDSCAPS2_RESERVED1
315 #define DDSCAPS2_COMMANDBUFFER DDSCAPS2_RESERVED2
316 
317 /*****************************************************************************
318  * ddraw->driver callbacks
319  */
320 #define DDHAL_DRIVER_NOTHANDLED               0x00000000l
321 #define DDHAL_DRIVER_HANDLED                  0x00000001l
322 #define DDHAL_DRIVER_NOCKEYHW                 0x00000002l
323 
324 typedef struct _DDHAL_DESTROYDRIVERDATA *LPDDHAL_DESTROYDRIVERDATA;
325 typedef struct _DDHAL_CREATESURFACEDATA *LPDDHAL_CREATESURFACEDATA;
326 typedef struct _DDHAL_DRVSETCOLORKEYDATA *LPDDHAL_DRVSETCOLORKEYDATA;
327 typedef struct _DDHAL_SETMODEDATA *LPDDHAL_SETMODEDATA;
328 typedef struct _DDHAL_WAITFORVERTICALBLANKDATA *LPDDHAL_WAITFORVERTICALBLANKDATA;
329 typedef struct _DDHAL_CANCREATESURFACEDATA *LPDDHAL_CANCREATESURFACEDATA;
330 typedef struct _DDHAL_CREATEPALETTEDATA *LPDDHAL_CREATEPALETTEDATA;
331 typedef struct _DDHAL_GETSCANLINEDATA *LPDDHAL_GETSCANLINEDATA;
332 typedef struct _DDHAL_SETEXCLUSIVEMODEDATA *LPDDHAL_SETEXCLUSIVEMODEDATA;
333 typedef struct _DDHAL_FLIPTOGDISURFACEDATA *LPDDHAL_FLIPTOGDISURFACEDATA;
334 
335 typedef DWORD (PASCAL *LPDDHAL_DESTROYDRIVER)       (LPDDHAL_DESTROYDRIVERDATA);
336 typedef DWORD (PASCAL *LPDDHAL_CREATESURFACE)       (LPDDHAL_CREATESURFACEDATA);
337 typedef DWORD (PASCAL *LPDDHAL_SETCOLORKEY)         (LPDDHAL_DRVSETCOLORKEYDATA);
338 typedef DWORD (PASCAL *LPDDHAL_SETMODE)             (LPDDHAL_SETMODEDATA);
339 typedef DWORD (PASCAL *LPDDHAL_WAITFORVERTICALBLANK)(LPDDHAL_WAITFORVERTICALBLANKDATA);
340 typedef DWORD (PASCAL *LPDDHAL_CANCREATESURFACE)    (LPDDHAL_CANCREATESURFACEDATA );
341 typedef DWORD (PASCAL *LPDDHAL_CREATEPALETTE)       (LPDDHAL_CREATEPALETTEDATA);
342 typedef DWORD (PASCAL *LPDDHAL_GETSCANLINE)         (LPDDHAL_GETSCANLINEDATA);
343 typedef DWORD (PASCAL *LPDDHAL_SETEXCLUSIVEMODE)    (LPDDHAL_SETEXCLUSIVEMODEDATA);
344 typedef DWORD (PASCAL *LPDDHAL_FLIPTOGDISURFACE)    (LPDDHAL_FLIPTOGDISURFACEDATA);
345 
346 typedef struct _DDHAL_DDCALLBACKS {
347   DWORD dwSize;
348   DWORD dwFlags;
349   LPDDHAL_DESTROYDRIVER DestroyDriver;
350   LPDDHAL_CREATESURFACE CreateSurface;
351   LPDDHAL_SETCOLORKEY SetColorKey;
352   LPDDHAL_SETMODE SetMode;
353   LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank;
354   LPDDHAL_CANCREATESURFACE CanCreateSurface;
355   LPDDHAL_CREATEPALETTE CreatePalette;
356   LPDDHAL_GETSCANLINE GetScanLine;
357   /* DirectX 2 */
358   LPDDHAL_SETEXCLUSIVEMODE SetExclusiveMode;
359   LPDDHAL_FLIPTOGDISURFACE FlipToGDISurface;
360 } DDHAL_DDCALLBACKS, *LPDDHAL_DDCALLBACKS;
361 
362 typedef struct _DDHAL_DESTROYSURFACEDATA *LPDDHAL_DESTROYSURFACEDATA;
363 typedef struct _DDHAL_FLIPDATA *LPDDHAL_FLIPDATA;
364 typedef struct _DDHAL_SETCLIPLISTDATA *LPDDHAL_SETCLIPLISTDATA;
365 typedef struct _DDHAL_LOCKDATA *LPDDHAL_LOCKDATA;
366 typedef struct _DDHAL_UNLOCKDATA *LPDDHAL_UNLOCKDATA;
367 typedef struct _DDHAL_BLTDATA *LPDDHAL_BLTDATA;
368 typedef struct _DDHAL_SETCOLORKEYDATA *LPDDHAL_SETCOLORKEYDATA;
369 typedef struct _DDHAL_ADDATTACHEDSURFACEDATA *LPDDHAL_ADDATTACHEDSURFACEDATA;
370 typedef struct _DDHAL_GETBLTSTATUSDATA *LPDDHAL_GETBLTSTATUSDATA;
371 typedef struct _DDHAL_GETFLIPSTATUSDATA *LPDDHAL_GETFLIPSTATUSDATA;
372 typedef struct _DDHAL_UPDATEOVERLAYDATA *LPDDHAL_UPDATEOVERLAYDATA;
373 typedef struct _DDHAL_SETOVERLAYPOSITIONDATA *LPDDHAL_SETOVERLAYPOSITIONDATA;
374 typedef struct _DDHAL_SETPALETTEDATA *LPDDHAL_SETPALETTEDATA;
375 
376 typedef DWORD (PASCAL *LPDDHALSURFCB_DESTROYSURFACE) (LPDDHAL_DESTROYSURFACEDATA);
377 typedef DWORD (PASCAL *LPDDHALSURFCB_FLIP) (LPDDHAL_FLIPDATA);
378 typedef DWORD (PASCAL *LPDDHALSURFCB_SETCLIPLIST) (LPDDHAL_SETCLIPLISTDATA);
379 typedef DWORD (PASCAL *LPDDHALSURFCB_LOCK) (LPDDHAL_LOCKDATA);
380 typedef DWORD (PASCAL *LPDDHALSURFCB_UNLOCK) (LPDDHAL_UNLOCKDATA);
381 typedef DWORD (PASCAL *LPDDHALSURFCB_BLT) (LPDDHAL_BLTDATA);
382 typedef DWORD (PASCAL *LPDDHALSURFCB_SETCOLORKEY) (LPDDHAL_SETCOLORKEYDATA);
383 typedef DWORD (PASCAL *LPDDHALSURFCB_ADDATTACHEDSURFACE)(LPDDHAL_ADDATTACHEDSURFACEDATA);
384 typedef DWORD (PASCAL *LPDDHALSURFCB_GETBLTSTATUS) (LPDDHAL_GETBLTSTATUSDATA);
385 typedef DWORD (PASCAL *LPDDHALSURFCB_GETFLIPSTATUS) (LPDDHAL_GETFLIPSTATUSDATA);
386 typedef DWORD (PASCAL *LPDDHALSURFCB_UPDATEOVERLAY) (LPDDHAL_UPDATEOVERLAYDATA);
387 typedef DWORD (PASCAL *LPDDHALSURFCB_SETOVERLAYPOSITION)(LPDDHAL_SETOVERLAYPOSITIONDATA);
388 typedef DWORD (PASCAL *LPDDHALSURFCB_SETPALETTE) (LPDDHAL_SETPALETTEDATA);
389 
390 typedef struct _DDHAL_DDSURFACECALLBACKS {
391   DWORD dwSize;
392   DWORD dwFlags;
393   LPDDHALSURFCB_DESTROYSURFACE DestroySurface;
394   LPDDHALSURFCB_FLIP Flip;
395   LPDDHALSURFCB_SETCLIPLIST SetClipList;
396   LPDDHALSURFCB_LOCK Lock;
397   LPDDHALSURFCB_UNLOCK Unlock;
398   LPDDHALSURFCB_BLT Blt;
399   LPDDHALSURFCB_SETCOLORKEY SetColorKey;
400   LPDDHALSURFCB_ADDATTACHEDSURFACE AddAttachedSurface;
401   LPDDHALSURFCB_GETBLTSTATUS GetBltStatus;
402   LPDDHALSURFCB_GETFLIPSTATUS GetFlipStatus;
403   LPDDHALSURFCB_UPDATEOVERLAY UpdateOverlay;
404   LPDDHALSURFCB_SETOVERLAYPOSITION SetOverlayPosition;
405   LPVOID reserved4;
406   LPDDHALSURFCB_SETPALETTE SetPalette;
407 } DDHAL_DDSURFACECALLBACKS, *LPDDHAL_DDSURFACECALLBACKS;
408 
409 typedef struct _DDHAL_DESTROYPALETTEDATA *LPDDHAL_DESTROYPALETTEDATA;
410 typedef struct _DDHAL_SETENTRIESDATA *LPDDHAL_SETENTRIESDATA;
411 
412 typedef DWORD (PASCAL *LPDDHALPALCB_DESTROYPALETTE) (LPDDHAL_DESTROYPALETTEDATA);
413 typedef DWORD (PASCAL *LPDDHALPALCB_SETENTRIES) (LPDDHAL_SETENTRIESDATA);
414 
415 typedef struct _DDHAL_DDPALETTECALLBACKS {
416   DWORD dwSize;
417   DWORD dwFlags;
418   LPDDHALPALCB_DESTROYPALETTE DestroyPalette;
419   LPDDHALPALCB_SETENTRIES SetEntries;
420 } DDHAL_DDPALETTECALLBACKS, *LPDDHAL_DDPALETTECALLBACKS;
421 
422 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_CANCREATEEXEBUF) (LPDDHAL_CANCREATESURFACEDATA);
423 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_CREATEEXEBUF) (LPDDHAL_CREATESURFACEDATA);
424 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_DESTROYEXEBUF) (LPDDHAL_DESTROYSURFACEDATA);
425 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_LOCKEXEBUF) (LPDDHAL_LOCKDATA);
426 typedef DWORD (PASCAL *LPDDHALEXEBUFCB_UNLOCKEXEBUF) (LPDDHAL_UNLOCKDATA);
427 
428 typedef struct _DDHAL_DDEXEBUFCALLBACKS {
429   DWORD dwSize;
430   DWORD dwFlags;
431   LPDDHALEXEBUFCB_CANCREATEEXEBUF CanCreateExecuteBuffer;
432   LPDDHALEXEBUFCB_CREATEEXEBUF CreateExecuteBuffer;
433   LPDDHALEXEBUFCB_DESTROYEXEBUF DestroyExecuteBuffer;
434   LPDDHALEXEBUFCB_LOCKEXEBUF LockExecuteBuffer;
435   LPDDHALEXEBUFCB_UNLOCKEXEBUF UnlockExecuteBuffer;
436 } DDHAL_DDEXEBUFCALLBACKS, *LPDDHAL_DDEXEBUFCALLBACKS;
437 
438 typedef struct _DDHAL_GETAVAILDRIVERMEMORYDATA *LPDDHAL_GETAVAILDRIVERMEMORYDATA;
439 typedef struct _DDHAL_UPDATENONLOCALHEAPDATA *LPDDHAL_UPDATENONLOCALHEAPDATA;
440 typedef struct _DDHAL_GETHEAPALIGNMENTDATA *LPDDHAL_GETHEAPALIGNMENTDATA;
441 
442 typedef DWORD (PASCAL *LPDDHAL_GETAVAILDRIVERMEMORY)(LPDDHAL_GETAVAILDRIVERMEMORYDATA);
443 typedef DWORD (PASCAL *LPDDHAL_UPDATENONLOCALHEAP)  (LPDDHAL_UPDATENONLOCALHEAPDATA);
444 typedef DWORD (PASCAL *LPDDHAL_GETHEAPALIGNMENT)    (LPDDHAL_GETHEAPALIGNMENTDATA);
445 
446 typedef struct _DDHAL_DDMISCELLANEOUSCALLBACKS {
447   DWORD dwSize;
448   DWORD dwFlags;
449   LPDDHAL_GETAVAILDRIVERMEMORY GetAvailDriverMemory;
450   LPDDHAL_UPDATENONLOCALHEAP UpdateNonLocalHeap;
451   LPDDHAL_GETHEAPALIGNMENT GetHeapAlignment;
452   LPDDHALSURFCB_GETBLTSTATUS GetSysmemBltStatus;
453 } DDHAL_DDMISCELLANEOUSCALLBACKS, *LPDDHAL_DDMISCELLANEOUSCALLBACKS;
454 
455 typedef struct _DDHAL_CREATESURFACEEXDATA *LPDDHAL_CREATESURFACEEXDATA;
456 typedef struct _DDHAL_GETDRIVERSTATEDATA *LPDDHAL_GETDRIVERSTATEDATA;
457 typedef struct _DDHAL_DESTROYDDLOCALDATA *LPDDHAL_DESTROYDDLOCALDATA;
458 
459 typedef DWORD (PASCAL *LPDDHAL_CREATESURFACEEX)(LPDDHAL_CREATESURFACEEXDATA);
460 typedef DWORD (PASCAL *LPDDHAL_GETDRIVERSTATE) (LPDDHAL_GETDRIVERSTATEDATA);
461 typedef DWORD (PASCAL *LPDDHAL_DESTROYDDLOCAL) (LPDDHAL_DESTROYDDLOCALDATA);
462 
463 typedef struct _DDHAL_DDMISCELLANEOUS2CALLBACKS {
464   DWORD dwSize;
465   DWORD dwFlags;
466   LPVOID Reserved;
467   LPDDHAL_CREATESURFACEEX CreateSurfaceEx;
468   LPDDHAL_GETDRIVERSTATE GetDriverState;
469   LPDDHAL_DESTROYDDLOCAL DestroyDDLocal;
470 } DDHAL_DDMISCELLANEOUS2CALLBACKS, *LPDDHAL_DDMISCELLANEOUS2CALLBACKS;
471 
472 typedef struct _DDHAL_CANCREATEVPORTDATA       *LPDDHAL_CANCREATEVPORTDATA;
473 typedef struct _DDHAL_CREATEVPORTDATA          *LPDDHAL_CREATEVPORTDATA;
474 typedef struct _DDHAL_FLIPVPORTDATA            *LPDDHAL_FLIPVPORTDATA;
475 typedef struct _DDHAL_GETVPORTCONNECTDATA      *LPDDHAL_GETVPORTCONNECTDATA;
476 typedef struct _DDHAL_GETVPORTBANDWIDTHDATA    *LPDDHAL_GETVPORTBANDWIDTHDATA;
477 typedef struct _DDHAL_GETVPORTINPUTFORMATDATA  *LPDDHAL_GETVPORTINPUTFORMATDATA;
478 typedef struct _DDHAL_GETVPORTOUTPUTFORMATDATA *LPDDHAL_GETVPORTOUTPUTFORMATDATA;
479 typedef struct _DDHAL_GETVPORTFIELDDATA        *LPDDHAL_GETVPORTFIELDDATA;
480 typedef struct _DDHAL_GETVPORTLINEDATA         *LPDDHAL_GETVPORTLINEDATA;
481 typedef struct _DDHAL_DESTROYVPORTDATA         *LPDDHAL_DESTROYVPORTDATA;
482 typedef struct _DDHAL_GETVPORTFLIPSTATUSDATA   *LPDDHAL_GETVPORTFLIPSTATUSDATA;
483 typedef struct _DDHAL_UPDATEVPORTDATA          *LPDDHAL_UPDATEVPORTDATA;
484 typedef struct _DDHAL_WAITFORVPORTSYNCDATA     *LPDDHAL_WAITFORVPORTSYNCDATA;
485 typedef struct _DDHAL_GETVPORTSIGNALDATA       *LPDDHAL_GETVPORTSIGNALDATA;
486 typedef struct _DDHAL_VPORTCOLORDATA           *LPDDHAL_VPORTCOLORDATA;
487 
488 typedef DWORD (PASCAL *LPDDHALVPORTCB_CANCREATEVIDEOPORT)(LPDDHAL_CANCREATEVPORTDATA);
489 typedef DWORD (PASCAL *LPDDHALVPORTCB_CREATEVIDEOPORT)(LPDDHAL_CREATEVPORTDATA);
490 typedef DWORD (PASCAL *LPDDHALVPORTCB_FLIP)(LPDDHAL_FLIPVPORTDATA);
491 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETBANDWIDTH)(LPDDHAL_GETVPORTBANDWIDTHDATA);
492 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETINPUTFORMATS)(LPDDHAL_GETVPORTINPUTFORMATDATA);
493 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETOUTPUTFORMATS)(LPDDHAL_GETVPORTOUTPUTFORMATDATA);
494 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETFIELD)(LPDDHAL_GETVPORTFIELDDATA);
495 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETLINE)(LPDDHAL_GETVPORTLINEDATA);
496 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETVPORTCONNECT)(LPDDHAL_GETVPORTCONNECTDATA);
497 typedef DWORD (PASCAL *LPDDHALVPORTCB_DESTROYVPORT)(LPDDHAL_DESTROYVPORTDATA);
498 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETFLIPSTATUS)(LPDDHAL_GETVPORTFLIPSTATUSDATA);
499 typedef DWORD (PASCAL *LPDDHALVPORTCB_UPDATE)(LPDDHAL_UPDATEVPORTDATA);
500 typedef DWORD (PASCAL *LPDDHALVPORTCB_WAITFORSYNC)(LPDDHAL_WAITFORVPORTSYNCDATA);
501 typedef DWORD (PASCAL *LPDDHALVPORTCB_GETSIGNALSTATUS)(LPDDHAL_GETVPORTSIGNALDATA);
502 typedef DWORD (PASCAL *LPDDHALVPORTCB_COLORCONTROL)(LPDDHAL_VPORTCOLORDATA);
503 
504 typedef struct _DDHAL_DDVIDEOPORTCALLBACKS {
505   DWORD dwSize;
506   DWORD dwFlags;
507   LPDDHALVPORTCB_CANCREATEVIDEOPORT CanCreateVideoPort;
508   LPDDHALVPORTCB_CREATEVIDEOPORT CreateVideoPort;
509   LPDDHALVPORTCB_FLIP FlipVideoPort;
510   LPDDHALVPORTCB_GETBANDWIDTH GetVideoPortBandwidth;
511   LPDDHALVPORTCB_GETINPUTFORMATS GetVideoPortInputFormats;
512   LPDDHALVPORTCB_GETOUTPUTFORMATS GetVideoPortOutputFormats;
513   LPVOID lpReserved1;
514   LPDDHALVPORTCB_GETFIELD GetVideoPortField;
515   LPDDHALVPORTCB_GETLINE GetVideoPortLine;
516   LPDDHALVPORTCB_GETVPORTCONNECT GetVideoPortConnectInfo;
517   LPDDHALVPORTCB_DESTROYVPORT DestroyVideoPort;
518   LPDDHALVPORTCB_GETFLIPSTATUS GetVideoPortFlipStatus;
519   LPDDHALVPORTCB_UPDATE UpdateVideoPort;
520   LPDDHALVPORTCB_WAITFORSYNC WaitForVideoPortSync;
521   LPDDHALVPORTCB_GETSIGNALSTATUS GetVideoSignalStatus;
522   LPDDHALVPORTCB_COLORCONTROL ColorControl;
523 } DDHAL_DDVIDEOPORTCALLBACKS;
524 
525 typedef struct _DDHAL_COLORCONTROLDATA *LPDDHAL_COLORCONTROLDATA;
526 
527 typedef DWORD (PASCAL *LPDDHALCOLORCB_COLORCONTROL)(LPDDHAL_COLORCONTROLDATA);
528 
529 typedef struct _DDHAL_DDCOLORCONTROLCALLBACKS {
530   DWORD dwSize;
531   DWORD dwFlags;
532   LPDDHALCOLORCB_COLORCONTROL ColorControl;
533 } DDHAL_DDCOLORCONTROLCALLBACKS;
534 
535 typedef struct _DDHAL_SYNCSURFACEDATA   *LPDDHAL_SYNCSURFACEDATA;
536 typedef struct _DDHAL_SYNCVIDEOPORTDATA *LPDDHAL_SYNCVIDEOPORTDATA;
537 
538 typedef DWORD (PASCAL *LPDDHALKERNELCB_SYNCSURFACE)(LPDDHAL_SYNCSURFACEDATA);
539 typedef DWORD (PASCAL *LPDDHALKERNELCB_SYNCVIDEOPORT)(LPDDHAL_SYNCVIDEOPORTDATA);
540 
541 typedef struct _DDHAL_DDKERNELCALLBACKS {
542   DWORD dwSize;
543   DWORD dwFlags;
544   LPDDHALKERNELCB_SYNCSURFACE SyncSurfaceData;
545   LPDDHALKERNELCB_SYNCVIDEOPORT SyncVideoPortData;
546 } DDHAL_DDKERNELCALLBACKS, *LPDDHAL_DDKERNELCALLBACKS;
547 
548 typedef struct _DDHAL_GETMOCOMPGUIDSDATA *LPDDHAL_GETMOCOMPGUIDSDATA;
549 typedef struct _DDHAL_GETMOCOMPFORMATSDATA *LPDDHAL_GETMOCOMPFORMATSDATA;
550 typedef struct _DDHAL_CREATEMOCOMPDATA *LPDDHAL_CREATEMOCOMPDATA;
551 typedef struct _DDHAL_GETMOCOMPCOMPBUFFDATA *LPDDHAL_GETMOCOMPCOMPBUFFDATA;
552 typedef struct _DDHAL_GETINTERNALMOCOMPDATA *LPDDHAL_GETINTERNALMOCOMPDATA;
553 typedef struct _DDHAL_BEGINMOCOMPFRAMEDATA *LPDDHAL_BEGINMOCOMPFRAMEDATA;
554 typedef struct _DDHAL_ENDMOCOMPFRAMEDATA *LPDDHAL_ENDMOCOMPFRAMEDATA;
555 typedef struct _DDHAL_RENDERMOCOMPDATA *LPDDHAL_RENDERMOCOMPDATA;
556 typedef struct _DDHAL_QUERYMOCOMPSTATUSDATA *LPDDHAL_QUERYMOCOMPSTATUSDATA;
557 typedef struct _DDHAL_DESTROYMOCOMPDATA *LPDDHAL_DESTROYMOCOMPDATA;
558 
559 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_GETGUIDS)(LPDDHAL_GETMOCOMPGUIDSDATA);
560 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_GETFORMATS)(LPDDHAL_GETMOCOMPFORMATSDATA);
561 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_CREATE)(LPDDHAL_CREATEMOCOMPDATA);
562 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_GETCOMPBUFFINFO)(LPDDHAL_GETMOCOMPCOMPBUFFDATA);
563 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_GETINTERNALINFO)(LPDDHAL_GETINTERNALMOCOMPDATA);
564 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_BEGINFRAME)(LPDDHAL_BEGINMOCOMPFRAMEDATA);
565 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_ENDFRAME)(LPDDHAL_ENDMOCOMPFRAMEDATA);
566 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_RENDER)(LPDDHAL_RENDERMOCOMPDATA);
567 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_QUERYSTATUS)(LPDDHAL_QUERYMOCOMPSTATUSDATA);
568 typedef DWORD (PASCAL *LPDDHALMOCOMPCB_DESTROY)(LPDDHAL_DESTROYMOCOMPDATA);
569 
570 typedef struct _DDHAL_DDMOTIONCOMPCALLBACKS {
571   DWORD dwSize;
572   DWORD dwFlags;
573   LPDDHALMOCOMPCB_GETGUIDS GetMoCompGuids;
574   LPDDHALMOCOMPCB_GETFORMATS GetMoCompFormats;
575   LPDDHALMOCOMPCB_CREATE CreateMoComp;
576   LPDDHALMOCOMPCB_GETCOMPBUFFINFO GetMoCompBuffInfo;
577   LPDDHALMOCOMPCB_GETINTERNALINFO GetInternalMoCompInfo;
578   LPDDHALMOCOMPCB_BEGINFRAME BeginMoCompFrame;
579   LPDDHALMOCOMPCB_ENDFRAME EndMoCompFrame;
580   LPDDHALMOCOMPCB_RENDER RenderMoComp;
581   LPDDHALMOCOMPCB_QUERYSTATUS QueryMoCompStatus;
582   LPDDHALMOCOMPCB_DESTROY DestroyMoComp;
583 } DDHAL_DDMOTIONCOMPCALLBACKS, *LPDDHAL_DDMOTIONCOMPCALLBACKS;
584 
585 typedef HRESULT (WINAPI *LPDDGAMMACALIBRATORPROC)(LPDDGAMMARAMP, LPBYTE);
586 
587 /*****************************************************************************
588  * driver info structure
589  *
590  * The HAL is queried for additional callbacks via the GetDriverInfo callback.
591  */
592 typedef struct _DDHAL_GETDRIVERINFODATA *LPDDHAL_GETDRIVERINFODATA;
593 typedef DWORD (PASCAL *LPDDHAL_GETDRIVERINFO)(LPDDHAL_GETDRIVERINFODATA);
594 
595 typedef struct _DDHAL_GETDRIVERINFODATA {
596   DWORD dwSize;
597   DWORD dwFlags;
598   GUID guidInfo;
599   DWORD dwExpectedSize;
600   LPVOID lpvData;
601   DWORD dwActualSize;
602   HRESULT ddRVal;
603   ULONG_PTR dwContext;
604 } DDHAL_GETDRIVERINFODATA;
605 
606 typedef struct _DDHALINFO {
607   DWORD dwSize;
608   LPDDHAL_DDCALLBACKS lpDDCallbacks;
609   LPDDHAL_DDSURFACECALLBACKS lpDDSurfaceCallbacks;
610   LPDDHAL_DDPALETTECALLBACKS lpDDPaletteCallbacks;
611   VIDMEMINFO vmiData;
612   DDCORECAPS ddCaps;
613   DWORD dwMonitorFrequency;
614   LPDDHAL_GETDRIVERINFO GetDriverInfo;
615   DWORD dwModeIndex;
616   LPDWORD lpdwFourCC;
617   DWORD dwNumModes;
618   LPDDHALMODEINFO lpModeInfo;
619   DWORD dwFlags;
620   LPVOID lpPDevice;
621   DWORD hInstance;
622   /* DirectX 2 */
623   ULONG_PTR lpD3DGlobalDriverData;
624   ULONG_PTR lpD3DHALCallbacks;
625   LPDDHAL_DDEXEBUFCALLBACKS lpDDExeBufCallbacks;
626 } DDHALINFO;
627 
628 #define DDPALETTECALLBACKSSIZE sizeof(DDHAL_DDPALETTECALLBACKS)
629 #define DDSURFACECALLBACKSSIZE sizeof(DDHAL_DDSURFACECALLBACKS)
630 #define DDMISCELLANEOUSCALLBACKSSIZE sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS)
631 #define DDMISCELLANEOUS2CALLBACKSSIZE sizeof(DDHAL_DDMISCELLANEOUS2CALLBACKS)
632 #define DDEXEBUFCALLBACKSSIZE sizeof(DDHAL_DDEXEBUFCALLBACKS)
633 #define DDVIDEOPORTCALLBACKSSIZE sizeof(DDHAL_DDVIDEOPORTCALLBACKS)
634 #define DDCOLORCONTROLCALLBACKSSIZE sizeof(DDHAL_DDCOLORCONTROLCALLBACKS)
635 #define DDKERNELCALLBACKSSIZE sizeof(DDHAL_DDKERNELCALLBACKS)
636 #define DDMOTIONCOMPCALLBACKSSIZE sizeof(DDHAL_DDMOTIONCOMPCALLBACKS)
637 
638 #define MAX_PALETTE_SIZE                    256
639 
640 #define MAX_AUTOFLIP_BUFFERS                10
641 #define DDSCAPS2_INDEXBUFFER                DDSCAPS2_RESERVED3
642 #define DDSCAPS3_VIDEO                      DDSCAPS3_RESERVED2
643 #define D3DFMT_INTERNAL_D32                 71
644 #define D3DFMT_INTERNAL_S1D15               72
645 #define D3DFMT_INTERNAL_D15S1               73
646 #define D3DFMT_INTERNAL_S8D24               74
647 #define D3DFMT_INTERNAL_D24S8               75
648 #define D3DFMT_INTERNAL_X8D24               76
649 #define D3DFMT_INTERNAL_D24X8               77
650 #define DDHAL_PLEASEALLOC_BLOCKSIZE         0x00000002l
651 #define DDHAL_PLEASEALLOC_LINEARSIZE        0x00000003l
652 
653 #define DDHAL_CB32_DESTROYDRIVER            0x00000001l
654 #define DDHAL_CB32_CREATESURFACE            0x00000002l
655 #define DDHAL_CB32_SETCOLORKEY              0x00000004l
656 #define DDHAL_CB32_SETMODE                  0x00000008l
657 #define DDHAL_CB32_WAITFORVERTICALBLANK     0x00000010l
658 #define DDHAL_CB32_CANCREATESURFACE         0x00000020l
659 #define DDHAL_CB32_CREATEPALETTE            0x00000040l
660 #define DDHAL_CB32_GETSCANLINE              0x00000080l
661 #define DDHAL_CB32_SETEXCLUSIVEMODE         0x00000100l
662 #define DDHAL_CB32_FLIPTOGDISURFACE         0x00000200l
663 #define DDHAL_PALCB32_DESTROYPALETTE        0x00000001l
664 #define DDHAL_PALCB32_SETENTRIES            0x00000002l
665 #define DDHALINFO_ISPRIMARYDISPLAY          0x00000001
666 #define DDHALINFO_MODEXILLEGAL              0x00000002
667 #define DDHALINFO_GETDRIVERINFOSET          0x00000004
668 #define DDHALINFO_GETDRIVERINFO2            0x00000008
669 #define DDRAWI_VPORTSTART                   0x0001
670 #define DDRAWI_VPORTSTOP                    0x0002
671 #define DDRAWI_VPORTUPDATE                  0x0003
672 #define DDRAWI_VPORTGETCOLOR                0x0001
673 #define DDRAWI_VPORTSETCOLOR                0x0002
674 #define DDHAL_SURFCB32_DESTROYSURFACE       0x00000001
675 #define DDHAL_SURFCB32_FLIP                 0x00000002
676 #define DDHAL_SURFCB32_SETCLIPLIST          0x00000004
677 #define DDHAL_SURFCB32_LOCK                 0x00000008
678 #define DDHAL_SURFCB32_UNLOCK               0x00000010
679 #define DDHAL_SURFCB32_BLT                  0x00000020
680 #define DDHAL_SURFCB32_SETCOLORKEY          0x00000040
681 #define DDHAL_SURFCB32_ADDATTACHEDSURFACE   0x00000080
682 #define DDHAL_SURFCB32_GETBLTSTATUS         0x00000100
683 #define DDHAL_SURFCB32_GETFLIPSTATUS        0x00000200
684 #define DDHAL_SURFCB32_UPDATEOVERLAY        0x00000400
685 #define DDHAL_SURFCB32_SETOVERLAYPOSITION   0x00000800
686 #define DDHAL_SURFCB32_RESERVED4            0x00001000
687 #define DDHAL_SURFCB32_SETPALETTE           0x00002000
688 #define DDHAL_MISCCB32_GETAVAILDRIVERMEMORY 0x00000001
689 #define DDHAL_MISCCB32_UPDATENONLOCALHEAP   0x00000002
690 #define DDHAL_MISCCB32_GETHEAPALIGNMENT     0x00000004
691 #define DDHAL_MISCCB32_GETSYSMEMBLTSTATUS   0x00000008
692 #define DDHAL_MISC2CB32_ALPHABLT            0x00000001
693 #define DDHAL_MISC2CB32_CREATESURFACEEX     0x00000002
694 #define DDHAL_MISC2CB32_GETDRIVERSTATE      0x00000004
695 #define DDHAL_MISC2CB32_DESTROYDDLOCAL      0x00000008
696 #define DDHAL_EXEBUFCB32_CANCREATEEXEBUF    0x00000001l
697 #define DDHAL_EXEBUFCB32_CREATEEXEBUF       0x00000002l
698 #define DDHAL_EXEBUFCB32_DESTROYEXEBUF      0x00000004l
699 #define DDHAL_EXEBUFCB32_LOCKEXEBUF         0x00000008l
700 #define DDHAL_EXEBUFCB32_UNLOCKEXEBUF       0x00000010l
701 #define DDHAL_VPORT32_CANCREATEVIDEOPORT    0x00000001
702 #define DDHAL_VPORT32_CREATEVIDEOPORT       0x00000002
703 #define DDHAL_VPORT32_FLIP                  0x00000004
704 #define DDHAL_VPORT32_GETBANDWIDTH          0x00000008
705 #define DDHAL_VPORT32_GETINPUTFORMATS       0x00000010
706 #define DDHAL_VPORT32_GETOUTPUTFORMATS      0x00000020
707 #define DDHAL_VPORT32_GETFIELD              0x00000080
708 #define DDHAL_VPORT32_GETLINE               0x00000100
709 #define DDHAL_VPORT32_GETCONNECT            0x00000200
710 #define DDHAL_VPORT32_DESTROY               0x00000400
711 #define DDHAL_VPORT32_GETFLIPSTATUS         0x00000800
712 #define DDHAL_VPORT32_UPDATE                0x00001000
713 #define DDHAL_VPORT32_WAITFORSYNC           0x00002000
714 #define DDHAL_VPORT32_GETSIGNALSTATUS       0x00004000
715 #define DDHAL_VPORT32_COLORCONTROL          0x00008000
716 #define DDHAL_COLOR_COLORCONTROL            0x00000001
717 #define DDHAL_KERNEL_SYNCSURFACEDATA        0x00000001l
718 #define DDHAL_KERNEL_SYNCVIDEOPORTDATA      0x00000002l
719 #define DDHAL_MOCOMP32_GETGUIDS             0x00000001
720 #define DDHAL_MOCOMP32_GETFORMATS           0x00000002
721 #define DDHAL_MOCOMP32_CREATE               0x00000004
722 #define DDHAL_MOCOMP32_GETCOMPBUFFINFO      0x00000008
723 #define DDHAL_MOCOMP32_GETINTERNALINFO      0x00000010
724 #define DDHAL_MOCOMP32_BEGINFRAME           0x00000020
725 #define DDHAL_MOCOMP32_ENDFRAME             0x00000040
726 #define DDHAL_MOCOMP32_RENDER               0x00000080
727 #define DDHAL_MOCOMP32_QUERYSTATUS          0x00000100
728 #define DDHAL_MOCOMP32_DESTROY              0x00000200
729 
730 /* where the high-level ddraw implementation stores the callbacks */
731 typedef struct _DDHAL_CALLBACKS {
732   DDHAL_DDCALLBACKS cbDDCallbacks;
733   DDHAL_DDSURFACECALLBACKS cbDDSurfaceCallbacks;
734   DDHAL_DDPALETTECALLBACKS cbDDPaletteCallbacks;
735   DDHAL_DDCALLBACKS HALDD;
736   DDHAL_DDSURFACECALLBACKS HALDDSurface;
737   DDHAL_DDPALETTECALLBACKS HALDDPalette;
738   DDHAL_DDCALLBACKS HELDD;
739   DDHAL_DDSURFACECALLBACKS HELDDSurface;
740   DDHAL_DDPALETTECALLBACKS HELDDPalette;
741   DDHAL_DDEXEBUFCALLBACKS cbDDExeBufCallbacks;
742   DDHAL_DDEXEBUFCALLBACKS HALDDExeBuf;
743   DDHAL_DDEXEBUFCALLBACKS HELDDExeBuf;
744   DDHAL_DDVIDEOPORTCALLBACKS cbDDVideoPortCallbacks;
745   DDHAL_DDVIDEOPORTCALLBACKS HALDDVideoPort;
746   DDHAL_DDCOLORCONTROLCALLBACKS cbDDColorControlCallbacks;
747   DDHAL_DDCOLORCONTROLCALLBACKS HALDDColorControl;
748   DDHAL_DDMISCELLANEOUSCALLBACKS cbDDMiscellaneousCallbacks;
749   DDHAL_DDMISCELLANEOUSCALLBACKS HALDDMiscellaneous;
750   DDHAL_DDKERNELCALLBACKS cbDDKernelCallbacks;
751   DDHAL_DDKERNELCALLBACKS HALDDKernel;
752   DDHAL_DDMOTIONCOMPCALLBACKS cbDDMotionCompCallbacks;
753   DDHAL_DDMOTIONCOMPCALLBACKS HALDDMotionComp;
754 } DDHAL_CALLBACKS, *LPDDHAL_CALLBACKS;
755 
756 /*****************************************************************************
757  * parameter structures
758  */
759 typedef struct _DDHAL_DESTROYDRIVERDATA {
760   LPDDRAWI_DIRECTDRAW_GBL lpDD;
761   HRESULT ddRVal;
762   LPDDHAL_DESTROYDRIVER DestroyDriver;
763 } DDHAL_DESTROYDRIVERDATA;
764 
765 typedef struct _DDHAL_SETMODEDATA {
766   LPDDRAWI_DIRECTDRAW_GBL lpDD;
767   DWORD dwModeIndex;
768   HRESULT ddRVal;
769   LPDDHAL_SETMODE SetMode;
770   BOOL inexcl;
771   BOOL useRefreshRate;
772 } DDHAL_SETMODEDATA;
773 
774 typedef struct _DDHAL_CREATESURFACEDATA {
775   LPDDRAWI_DIRECTDRAW_GBL lpDD;
776   LPDDSURFACEDESC lpDDSurfaceDesc;
777   LPDDRAWI_DDRAWSURFACE_LCL *lplpSList;
778   DWORD dwSCnt;
779   HRESULT ddRVal;
780   LPDDHAL_CREATESURFACE CreateSurface;
781 } DDHAL_CREATESURFACEDATA;
782 
783 typedef struct _DDHAL_CANCREATESURFACEDATA {
784   LPDDRAWI_DIRECTDRAW_GBL lpDD;
785   LPDDSURFACEDESC lpDDSurfaceDesc;
786   DWORD bIsDifferentPixelFormat;
787   HRESULT ddRVal;
788   LPDDHAL_CANCREATESURFACE CanCreateSurface;
789 } DDHAL_CANCREATESURFACEDATA;
790 
791 typedef struct _DDHAL_CREATEPALETTEDATA {
792   LPDDRAWI_DIRECTDRAW_GBL lpDD;
793   LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette;
794   LPPALETTEENTRY lpColorTable;
795   HRESULT ddRVal;
796   LPDDHAL_CREATEPALETTE CreatePalette;
797   BOOL is_excl;
798 } DDHAL_CREATEPALETTEDATA;
799 
800 typedef struct _DDHAL_SETEXCLUSIVEMODEDATA {
801   LPDDRAWI_DIRECTDRAW_GBL lpDD;
802   DWORD dwEnterExcl;
803   DWORD dwReserved;
804   HRESULT ddRVal;
805   LPDDHAL_SETEXCLUSIVEMODE SetExclusiveMode;
806 } DDHAL_SETEXCLUSIVEMODEDATA;
807 
808 /* surfaces */
809 typedef struct _DDHAL_DESTROYSURFACEDATA {
810   LPDDRAWI_DIRECTDRAW_GBL lpDD;
811   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
812   HRESULT ddRVal;
813   LPDDHALSURFCB_DESTROYSURFACE DestroySurface;
814 } DDHAL_DESTROYSURFACEDATA;
815 
816 typedef struct _DDHAL_FLIPDATA {
817   LPDDRAWI_DIRECTDRAW_GBL lpDD;
818   LPDDRAWI_DDRAWSURFACE_LCL lpSurfCurr;
819   LPDDRAWI_DDRAWSURFACE_LCL lpSurfTarg;
820   DWORD dwFlags;
821   HRESULT ddRVal;
822   LPDDHALSURFCB_FLIP Flip;
823   LPDDRAWI_DDRAWSURFACE_LCL lpSurfCurrLeft;
824   LPDDRAWI_DDRAWSURFACE_LCL lpSurfTargLeft;
825 } DDHAL_FLIPDATA;
826 
827 typedef struct _DDHAL_LOCKDATA {
828   LPDDRAWI_DIRECTDRAW_GBL lpDD;
829   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
830   DWORD bHasRect;
831   RECTL rArea;
832   LPVOID lpSurfData;
833   HRESULT ddRVal;
834   LPDDHALSURFCB_LOCK Lock;
835   DWORD dwFlags;
836 } DDHAL_LOCKDATA;
837 
838 typedef struct _DDHAL_UNLOCKDATA {
839   LPDDRAWI_DIRECTDRAW_GBL lpDD;
840   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
841   HRESULT ddRVal;
842   LPDDHALSURFCB_UNLOCK Unlock;
843 } DDHAL_UNLOCKDATA;
844 
845 typedef struct _DDHAL_BLTDATA {
846   LPDDRAWI_DIRECTDRAW_GBL lpDD;
847   LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;
848   RECTL rDest;
849   LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface;
850   RECTL rSrc;
851   DWORD dwFlags;
852   DWORD dwROPFlags;
853   DDBLTFX bltFX;
854   HRESULT ddRVal;
855   LPDDHALSURFCB_BLT Blt;
856   BOOL IsClipped;
857   RECTL rOrigDest;
858   RECTL rOrigSrc;
859   DWORD dwRectCnt;
860   LPRECT prDestRects;
861 } DDHAL_BLTDATA;
862 
863 typedef struct _DDHAL_SETPALETTEDATA {
864   LPDDRAWI_DIRECTDRAW_GBL lpDD;
865   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
866   LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette;
867   HRESULT ddRVal;
868   LPDDHALSURFCB_SETPALETTE SetPalette;
869   BOOL Attach;
870 } DDHAL_SETPALETTEDATA;
871 
872 /* palettes */
873 typedef struct _DDHAL_DESTROYPALETTEDATA {
874   LPDDRAWI_DIRECTDRAW_GBL lpDD;
875   LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette;
876   HRESULT ddRVal;
877   LPDDHALPALCB_DESTROYPALETTE DestroyPalette;
878 } DDHAL_DESTROYPALETTEDATA;
879 
880 typedef struct _DDHAL_SETENTRIESDATA {
881   LPDDRAWI_DIRECTDRAW_GBL lpDD;
882   LPDDRAWI_DDRAWPALETTE_GBL lpDDPalette;
883   DWORD dwBase;
884   DWORD dwNumEntries;
885   LPPALETTEENTRY lpEntries;
886   HRESULT ddRVal;
887   LPDDHALPALCB_SETENTRIES SetEntries;
888 } DDHAL_SETENTRIESDATA;
889 
890 typedef struct _DDHAL_CANCREATEVPORTDATA {
891   LPDDRAWI_DIRECTDRAW_LCL lpDD;
892   LPDDVIDEOPORTDESC lpDDVideoPortDesc;
893   HRESULT ddRVal;
894   LPDDHALVPORTCB_CANCREATEVIDEOPORT CanCreateVideoPort;
895 } DDHAL_CANCREATEVPORTDATA;
896 
897 typedef struct _DDHAL_CREATEVPORTDATA {
898   LPDDRAWI_DIRECTDRAW_LCL lpDD;
899   LPDDVIDEOPORTDESC lpDDVideoPortDesc;
900   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
901   HRESULT ddRVal;
902   LPDDHALVPORTCB_CREATEVIDEOPORT CreateVideoPort;
903 } DDHAL_CREATEVPORTDATA;
904 
905 typedef struct _DDHAL_GETVPORTBANDWIDTHDATA {
906   LPDDRAWI_DIRECTDRAW_LCL lpDD;
907   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
908   LPDDPIXELFORMAT lpddpfFormat;
909   DWORD dwWidth;
910   DWORD dwHeight;
911   DWORD dwFlags;
912   LPDDVIDEOPORTBANDWIDTH lpBandwidth;
913   HRESULT ddRVal;
914   LPDDHALVPORTCB_GETBANDWIDTH GetVideoPortBandwidth;
915 } DDHAL_GETVPORTBANDWIDTHDATA;
916 
917 typedef struct _DDHAL_GETVPORTINPUTFORMATDATA {
918   LPDDRAWI_DIRECTDRAW_LCL lpDD;
919   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
920   DWORD dwFlags;
921   LPDDPIXELFORMAT lpddpfFormat;
922   DWORD dwNumFormats;
923   HRESULT ddRVal;
924   LPDDHALVPORTCB_GETINPUTFORMATS GetVideoPortInputFormats;
925 } DDHAL_GETVPORTINPUTFORMATDATA;
926 
927 typedef struct _DDHAL_GETVPORTFIELDDATA {
928   LPDDRAWI_DIRECTDRAW_LCL lpDD;
929   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
930   BOOL bField;
931   HRESULT ddRVal;
932   LPDDHALVPORTCB_GETFIELD GetVideoPortField;
933 } DDHAL_GETVPORTFIELDDATA;
934 
935 typedef struct _DDHAL_GETVPORTOUTPUTFORMATDATA {
936   LPDDRAWI_DIRECTDRAW_LCL lpDD;
937   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
938   DWORD dwFlags;
939   LPDDPIXELFORMAT lpddpfInputFormat;
940   LPDDPIXELFORMAT lpddpfOutputFormats;
941   DWORD dwNumFormats;
942   HRESULT ddRVal;
943   LPDDHALVPORTCB_GETOUTPUTFORMATS GetVideoPortOutputFormats;
944 } DDHAL_GETVPORTOUTPUTFORMATDATA;
945 
946 typedef struct _DDHAL_GETVPORTLINEDATA {
947   LPDDRAWI_DIRECTDRAW_LCL lpDD;
948   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
949   DWORD dwLine;
950   HRESULT ddRVal;
951   LPDDHALVPORTCB_GETLINE GetVideoPortLine;
952 } DDHAL_GETVPORTLINEDATA;
953 
954 typedef struct _DDHAL_DESTROYVPORTDATA {
955   LPDDRAWI_DIRECTDRAW_LCL lpDD;
956   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
957   HRESULT ddRVal;
958   LPDDHALVPORTCB_DESTROYVPORT DestroyVideoPort;
959 } DDHAL_DESTROYVPORTDATA;
960 
961 typedef struct _DDHAL_GETVPORTFLIPSTATUSDATA {
962   LPDDRAWI_DIRECTDRAW_LCL lpDD;
963   FLATPTR fpSurface;
964   HRESULT ddRVal;
965   LPDDHALVPORTCB_GETFLIPSTATUS GetVideoPortFlipStatus;
966 } DDHAL_GETVPORTFLIPSTATUSDATA;
967 
968 typedef struct _DDHAL_UPDATEVPORTDATA {
969   LPDDRAWI_DIRECTDRAW_LCL lpDD;
970   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
971   LPDDRAWI_DDRAWSURFACE_INT *lplpDDSurface;
972   LPDDRAWI_DDRAWSURFACE_INT *lplpDDVBISurface;
973   LPDDVIDEOPORTINFO lpVideoInfo;
974   DWORD dwFlags;
975   DWORD dwNumAutoflip;
976   DWORD dwNumVBIAutoflip;
977   HRESULT ddRVal;
978   LPDDHALVPORTCB_UPDATE UpdateVideoPort;
979 } DDHAL_UPDATEVPORTDATA;
980 
981 typedef struct _DDHAL_WAITFORVPORTSYNCDATA {
982   LPDDRAWI_DIRECTDRAW_LCL lpDD;
983   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
984   DWORD dwFlags;
985   DWORD dwLine;
986   DWORD dwTimeOut;
987   HRESULT ddRVal;
988   LPDDHALVPORTCB_WAITFORSYNC WaitForVideoPortSync;
989 } DDHAL_WAITFORVPORTSYNCDATA;
990 
991 typedef struct _DDHAL_GETVPORTSIGNALDATA {
992   LPDDRAWI_DIRECTDRAW_LCL lpDD;
993   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
994   DWORD dwStatus;
995   HRESULT ddRVal;
996   LPDDHALVPORTCB_GETSIGNALSTATUS GetVideoSignalStatus;
997 } DDHAL_GETVPORTSIGNALDATA;
998 
999 typedef struct _DDHAL_VPORTCOLORDATA {
1000   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1001   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
1002   DWORD dwFlags;
1003   LPDDCOLORCONTROL lpColorData;
1004   HRESULT ddRVal;
1005   LPDDHALVPORTCB_COLORCONTROL ColorControl;
1006 } DDHAL_VPORTCOLORDATA;
1007 
1008 typedef struct _DDHAL_FLIPVPORTDATA {
1009   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1010   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
1011   LPDDRAWI_DDRAWSURFACE_LCL lpSurfCurr;
1012   LPDDRAWI_DDRAWSURFACE_LCL lpSurfTarg;
1013   HRESULT ddRVal;
1014   LPDDHALVPORTCB_FLIP FlipVideoPort;
1015 } DDHAL_FLIPVPORTDATA;
1016 
1017 typedef struct _DDHAL_GETVPORTCONNECTDATA {
1018   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1019   DWORD dwPortId;
1020   LPDDVIDEOPORTCONNECT lpConnect;
1021   DWORD dwNumEntries;
1022   HRESULT ddRVal;
1023   LPDDHALVPORTCB_GETVPORTCONNECT GetVideoPortConnectInfo;
1024 } DDHAL_GETVPORTCONNECTDATA;
1025 
1026 typedef struct _DDHAL_SYNCSURFACEDATA {
1027   DWORD dwSize;
1028   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1029   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1030   DWORD dwSurfaceOffset;
1031   ULONG_PTR fpLockPtr;
1032   LONG lPitch;
1033   DWORD dwOverlayOffset;
1034   DWORD dwOverlaySrcWidth;
1035   DWORD dwOverlaySrcHeight;
1036   DWORD dwOverlayDestWidth;
1037   DWORD dwOverlayDestHeight;
1038   ULONG_PTR dwDriverReserved1;
1039   ULONG_PTR dwDriverReserved2;
1040   ULONG_PTR dwDriverReserved3;
1041   HRESULT ddRVal;
1042 } DDHAL_SYNCSURFACEDATA;
1043 
1044 typedef struct _DDHAL_SYNCVIDEOPORTDATA {
1045   DWORD dwSize;
1046   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1047   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
1048   DWORD dwOriginOffset;
1049   DWORD dwHeight;
1050   DWORD dwVBIHeight;
1051   ULONG_PTR dwDriverReserved1;
1052   ULONG_PTR dwDriverReserved2;
1053   ULONG_PTR dwDriverReserved3;
1054   HRESULT ddRVal;
1055 } DDHAL_SYNCVIDEOPORTDATA;
1056 
1057 typedef struct _DDHAL_DESTROYDDLOCALDATA {
1058   DWORD dwFlags;
1059   LPDDRAWI_DIRECTDRAW_LCL pDDLcl;
1060   HRESULT ddRVal;
1061 } DDHAL_DESTROYDDLOCALDATA;
1062 
1063 typedef struct _DDHAL_CREATESURFACEEXDATA {
1064   DWORD dwFlags;
1065   LPDDRAWI_DIRECTDRAW_LCL lpDDLcl;
1066   LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl;
1067   HRESULT ddRVal;
1068 } DDHAL_CREATESURFACEEXDATA;
1069 
1070 typedef struct _DDHAL_GETHEAPALIGNMENTDATA {
1071   ULONG_PTR dwInstance;
1072   DWORD dwHeap;
1073   HRESULT ddRVal;
1074   LPDDHAL_GETHEAPALIGNMENT GetHeapAlignment;
1075   HEAPALIGNMENT Alignment;
1076 } DDHAL_GETHEAPALIGNMENTDATA;
1077 
1078 typedef struct _DDMORESURFACECAPS {
1079   DWORD dwSize;
1080   DDSCAPSEX ddsCapsMore;
1081   struct tagExtendedHeapRestrictions {
1082     DDSCAPSEX ddsCapsEx;
1083     DDSCAPSEX ddsCapsExAlt;
1084   } ddsExtendedHeapRestrictions[1];
1085 } DDMORESURFACECAPS, *LPDDMORESURFACECAPS;
1086 
1087 typedef struct _DDSTEREOMODE {
1088   DWORD dwSize;
1089   DWORD dwHeight;
1090   DWORD dwWidth;
1091   DWORD dwBpp;
1092   DWORD dwRefreshRate;
1093   BOOL bSupported;
1094 } DDSTEREOMODE, *LPDDSTEREOMODE;
1095 
1096 /*****************************************************************************
1097  * high-level ddraw implementation structures
1098  */
1099 typedef struct _IUNKNOWN_LIST {
1100   struct _IUNKNOWN_LIST *lpLink;
1101   LPGUID lpGuid;
1102 #ifndef _NO_COM
1103   IUnknown *lpIUnknown;
1104 #else
1105   LPVOID lpIUnknown;
1106 #endif /* _NO_COM */
1107 } IUNKNOWN_LIST, *LPIUNKNOWN_LIST;
1108 
1109 typedef struct _PROCESS_LIST {
1110   struct _PROCESS_LIST *lpLink;
1111   DWORD dwProcessId;
1112   DWORD dwRefCnt;
1113   DWORD dwAlphaDepth;
1114   DWORD dwZDepth;
1115 } PROCESS_LIST, *LPPROCESS_LIST;
1116 
1117 typedef struct _ATTACHLIST {
1118   DWORD dwFlags;
1119   struct _ATTACHLIST *lpLink;
1120   LPDDRAWI_DDRAWSURFACE_LCL lpAttached;
1121   LPDDRAWI_DDRAWSURFACE_INT lpIAttached;
1122 } ATTACHLIST, *LPATTACHLIST;
1123 
1124 #define DDAL_IMPLICIT 0x00000001
1125 
1126 typedef struct _ACCESSRECTLIST {
1127   struct _ACCESSRECTLIST *lpLink;
1128   RECT rDest;
1129   LPDDRAWI_DIRECTDRAW_LCL lpOwner;
1130   LPVOID lpSurfaceData;
1131   DWORD dwFlags;
1132   LPHEAPALIASINFO lpHeapAliasInfo;
1133 } ACCESSRECTLIST, *LPACCESSRECTLIST;
1134 
1135 #define ACCESSRECT_VRAMSTYLE           0x00000001
1136 #define ACCESSRECT_NOTHOLDINGWIN16LOCK 0x00000002
1137 #define ACCESSRECT_BROKEN              0x00000004
1138 
1139 typedef struct _DBLNODE {
1140   struct _DBLNODE *next;
1141   struct _DBLNODE *prev;
1142   LPDDRAWI_DDRAWSURFACE_LCL object;
1143   LPDDRAWI_DDRAWSURFACE_INT object_int;
1144 } DBLNODE, *LPDBLNODE;
1145 
1146 typedef struct _DDRAWI_DIRECTDRAW_INT {
1147   LPVOID lpVtbl;
1148   LPDDRAWI_DIRECTDRAW_LCL lpLcl;
1149   LPDDRAWI_DIRECTDRAW_INT lpLink;
1150   DWORD dwIntRefCnt;
1151 } DDRAWI_DIRECTDRAW_INT;
1152 
1153 typedef struct _DDRAWI_DIRECTDRAW_LCL {
1154   DWORD lpDDMore;
1155   LPDDRAWI_DIRECTDRAW_GBL lpGbl;
1156   DWORD dwUnused0;
1157   DWORD dwLocalFlags;
1158   DWORD dwLocalRefCnt;
1159   DWORD dwProcessId;
1160 #ifndef _NO_COM
1161   IUnknown *pUnkOuter;
1162 #else
1163   PVOID pUnkOuter;
1164 #endif
1165   DWORD dwObsolete1;
1166   ULONG_PTR hWnd;
1167   ULONG_PTR hDC;
1168   DWORD dwErrorMode;
1169   LPDDRAWI_DDRAWSURFACE_INT lpPrimary;
1170   LPDDRAWI_DDRAWSURFACE_INT lpCB;
1171   DWORD dwPreferredMode;
1172   /* DirectX 2 */
1173   HINSTANCE hD3DInstance;
1174 #ifndef _NO_COM
1175   IUnknown *pD3DIUnknown;
1176 #else
1177   PVOID pD3DIUnknown;
1178 #endif
1179   LPDDHAL_CALLBACKS lpDDCB;
1180   ULONG_PTR hDDVxd;
1181   /* DirectX 5.0 */
1182   DWORD dwAppHackFlags;
1183   /* DirectX 5.0A */
1184   ULONG_PTR hFocusWnd;
1185   DWORD dwHotTracking;
1186   DWORD dwIMEState;
1187   /* DirectX 6.0 */
1188   ULONG_PTR hWndPopup;
1189   ULONG_PTR hDD;
1190   ULONG_PTR hGammaCalibrator;
1191   LPDDGAMMACALIBRATORPROC lpGammaCalibrator;
1192 } DDRAWI_DIRECTDRAW_LCL;
1193 
1194 #define DDRAWILCL_HASEXCLUSIVEMODE    0x00000001
1195 #define DDRAWILCL_ISFULLSCREEN        0x00000002
1196 #define DDRAWILCL_SETCOOPCALLED       0x00000004
1197 #define DDRAWILCL_ACTIVEYES           0x00000008
1198 #define DDRAWILCL_ACTIVENO            0x00000010
1199 #define DDRAWILCL_HOOKEDHWND          0x00000020
1200 #define DDRAWILCL_ALLOWMODEX          0x00000040
1201 #define DDRAWILCL_V1SCLBEHAVIOUR      0x00000080
1202 #define DDRAWILCL_MODEHASBEENCHANGED  0x00000100
1203 #define DDRAWILCL_CREATEDWINDOW       0x00000200
1204 #define DDRAWILCL_DIRTYDC             0x00000400
1205 #define DDRAWILCL_DISABLEINACTIVATE   0x00000800
1206 #define DDRAWILCL_CURSORCLIPPED       0x00001000
1207 #define DDRAWILCL_EXPLICITMONITOR     0x00002000
1208 #define DDRAWILCL_MULTITHREADED       0x00004000
1209 #define DDRAWILCL_FPUSETUP            0x00008000
1210 #define DDRAWILCL_POWEREDDOWN         0x00010000
1211 #define DDRAWILCL_DIRECTDRAW7         0x00020000
1212 #define DDRAWILCL_ATTEMPTEDD3DCONTEXT 0x00040000
1213 #define DDRAWILCL_FPUPRESERVE         0x00080000
1214 #define DDRAWILCL_DX8DRIVER           0x00100000
1215 #define DDRAWILCL_DIRECTDRAW8         0x00200000
1216 
1217 typedef struct _DDRAWI_DIRECTDRAW_GBL {
1218   DWORD dwRefCnt;
1219   DWORD dwFlags;
1220   FLATPTR fpPrimaryOrig;
1221   DDCORECAPS ddCaps;
1222   DWORD dwInternal1;
1223   DWORD dwUnused1[9];
1224   LPDDHAL_CALLBACKS lpDDCBtmp;
1225   LPDDRAWI_DDRAWSURFACE_INT dsList;
1226   LPDDRAWI_DDRAWPALETTE_INT palList;
1227   LPDDRAWI_DDRAWCLIPPER_INT clipperList;
1228   LPDDRAWI_DIRECTDRAW_GBL lp16DD;
1229   DWORD dwMaxOverlays;
1230   DWORD dwCurrOverlays;
1231   DWORD dwMonitorFrequency;
1232   DDCORECAPS ddHELCaps;
1233   DWORD dwUnused2[50];
1234   DDCOLORKEY ddckCKDestOverlay;
1235   DDCOLORKEY ddckCKSrcOverlay;
1236   VIDMEMINFO vmiData;
1237   LPVOID lpDriverHandle;
1238   LPDDRAWI_DIRECTDRAW_LCL lpExclusiveOwner;
1239   DWORD dwModeIndex;
1240   DWORD dwModeIndexOrig;
1241   DWORD dwNumFourCC;
1242   LPDWORD lpdwFourCC;
1243   DWORD dwNumModes;
1244   LPDDHALMODEINFO lpModeInfo;
1245   PROCESS_LIST plProcessList;
1246   DWORD dwSurfaceLockCount;
1247   DWORD dwAliasedLockCnt;
1248   ULONG_PTR dwReserved3;
1249   ULONG_PTR hDD;
1250   char cObsolete[12];
1251   DWORD dwReserved1;
1252   DWORD dwReserved2;
1253   DBLNODE dbnOverlayRoot;
1254   volatile LPWORD lpwPDeviceFlags;
1255   DWORD dwPDevice;
1256   DWORD dwWin16LockCnt;
1257   DWORD dwUnused3;
1258   DWORD hInstance;
1259   DWORD dwEvent16;
1260   DWORD dwSaveNumModes;
1261   /* DirectX 2 */
1262   ULONG_PTR lpD3DGlobalDriverData;
1263   ULONG_PTR lpD3DHALCallbacks;
1264   DDCORECAPS ddBothCaps;
1265   /* DirectX 5.0 */
1266   LPDDVIDEOPORTCAPS lpDDVideoPortCaps;
1267   LPDDRAWI_DDVIDEOPORT_INT dvpList;
1268   ULONG_PTR lpD3DHALCallbacks2;
1269   RECT rectDevice;
1270   DWORD cMonitors;
1271   LPVOID gpbmiSrc;
1272   LPVOID gpbmiDest;
1273   LPHEAPALIASINFO phaiHeapAliases;
1274   ULONG_PTR hKernelHandle;
1275   ULONG_PTR pfnNotifyProc;
1276   LPDDKERNELCAPS lpDDKernelCaps;
1277   LPDDNONLOCALVIDMEMCAPS lpddNLVCaps;
1278   LPDDNONLOCALVIDMEMCAPS lpddNLVHELCaps;
1279   LPDDNONLOCALVIDMEMCAPS lpddNLVBothCaps;
1280   ULONG_PTR lpD3DExtendedCaps;
1281   /* DirectX 5.0A */
1282   DWORD dwDOSBoxEvent;
1283   RECT rectDesktop;
1284   char cDriverName[MAX_DRIVER_NAME];
1285   /* DirectX 6.0 */
1286   ULONG_PTR lpD3DHALCallbacks3;
1287   DWORD dwNumZPixelFormats;
1288   LPDDPIXELFORMAT lpZPixelFormats;
1289   LPDDRAWI_DDMOTIONCOMP_INT mcList;
1290   DWORD hDDVxd;
1291   DDSCAPSEX ddsCapsMore;
1292 } DDRAWI_DIRECTDRAW_GBL;
1293 
1294 #define DDRAWI_xxxxxxxxx1              0x00000001
1295 #define DDRAWI_xxxxxxxxx2              0x00000002
1296 #define DDRAWI_VIRTUALDESKTOP          0x00000008
1297 #define DDRAWI_MODEX                   0x00000010
1298 #define DDRAWI_DISPLAYDRV              0x00000020
1299 #define DDRAWI_FULLSCREEN              0x00000040
1300 #define DDRAWI_MODECHANGED             0x00000080
1301 #define DDRAWI_NOHARDWARE              0x00000100
1302 #define DDRAWI_PALETTEINIT             0x00000200
1303 #define DDRAWI_NOEMULATION             0x00000400
1304 #define DDRAWI_HASCKEYDESTOVERLAY      0x00000800
1305 #define DDRAWI_HASCKEYSRCOVERLAY       0x00001000
1306 #define DDRAWI_HASGDIPALETTE           0x00002000
1307 #define DDRAWI_EMULATIONINITIALIZED    0x00004000
1308 #define DDRAWI_HASGDIPALETTE_EXCLUSIVE 0x00008000
1309 #define DDRAWI_MODEXILLEGAL            0x00010000
1310 #define DDRAWI_FLIPPEDTOGDI            0x00020000
1311 #define DDRAWI_NEEDSWIN16FORVRAMLOCK   0x00040000
1312 #define DDRAWI_PDEVICEVRAMBITCLEARED   0x00080000
1313 #define DDRAWI_STANDARDVGA             0x00100000
1314 #define DDRAWI_EXTENDEDALIGNMENT       0x00200000
1315 #define DDRAWI_CHANGINGMODE            0x00400000
1316 #define DDRAWI_GDIDRV                  0x00800000
1317 #define DDRAWI_ATTACHEDTODESKTOP       0x01000000
1318 #define DDRAWI_UMODELOADED             0x02000000
1319 #define DDRAWI_DDRAWDATANOTFETCHED     0x04000000
1320 #define DDRAWI_SECONDARYDRIVERLOADED   0x08000000
1321 #define DDRAWI_TESTINGMODES            0x10000000
1322 #define DDRAWI_DRIVERINFO2             0x20000000
1323 #define DDRAWI_BADPDEV                 0x40000000
1324 
1325 /* surfaces */
1326 typedef struct _DDRAWI_DDRAWSURFACE_INT {
1327   LPVOID lpVtbl;
1328   LPDDRAWI_DDRAWSURFACE_LCL lpLcl;
1329   LPDDRAWI_DDRAWSURFACE_INT lpLink;
1330   DWORD dwIntRefCnt;
1331 } DDRAWI_DDRAWSURFACE_INT;
1332 
1333 typedef struct _DDRAWI_DDRAWSURFACE_GBL {
1334   DWORD dwRefCnt;
1335   DWORD dwGlobalFlags;
1336   __GNU_EXTENSION union {
1337     LPACCESSRECTLIST lpRectList;
1338     DWORD dwBlockSizeY;
1339     LONG lSlicePitch;
1340   };
1341   __GNU_EXTENSION union {
1342     LPVMEMHEAP lpVidMemHeap;
1343     DWORD dwBlockSizeX;
1344   };
1345   __GNU_EXTENSION union {
1346     LPDDRAWI_DIRECTDRAW_GBL lpDD;
1347     LPVOID lpDDHandle;
1348   };
1349   FLATPTR fpVidMem;
1350   __GNU_EXTENSION union {
1351     LONG lPitch;
1352     DWORD dwLinearSize;
1353   };
1354   WORD wHeight;
1355   WORD wWidth;
1356   DWORD dwUsageCount;
1357   ULONG_PTR dwReserved1;
1358   DDPIXELFORMAT ddpfSurface;
1359 } DDRAWI_DDRAWSURFACE_GBL;
1360 
1361 #define DDRAWISURFGBL_MEMFREE                    0x00000001L
1362 #define DDRAWISURFGBL_SYSMEMREQUESTED            0x00000002L
1363 #define DDRAWISURFGBL_ISGDISURFACE               0x00000004L
1364 #define DDRAWISURFGBL_SOFTWAREAUTOFLIP           0x00000008L
1365 #define DDRAWISURFGBL_LOCKNOTHOLDINGWIN16LOCK    0x00000010L
1366 #define DDRAWISURFGBL_LOCKVRAMSTYLE              0x00000020L
1367 #define DDRAWISURFGBL_LOCKBROKEN                 0x00000040L
1368 #define DDRAWISURFGBL_IMPLICITHANDLE             0x00000080L
1369 #define DDRAWISURFGBL_ISCLIENTMEM                0x00000100L
1370 #define DDRAWISURFGBL_HARDWAREOPSOURCE           0x00000200L
1371 #define DDRAWISURFGBL_HARDWAREOPDEST             0x00000400L
1372 #define DDRAWISURFGBL_HARDWAREOPSTARTED (DDRAWISURFGBL_HARDWAREOPSOURCE|DDRAWISURFGBL_HARDWAREOPDEST)
1373 #define DDRAWISURFGBL_VPORTINTERLEAVED           0x00000800L
1374 #define DDRAWISURFGBL_VPORTDATA                  0x00001000L
1375 #define DDRAWISURFGBL_LATEALLOCATELINEAR         0x00002000L
1376 #define DDRAWISURFGBL_SYSMEMEXECUTEBUFFER        0x00004000L
1377 #define DDRAWISURFGBL_FASTLOCKHELD               0x00008000L
1378 #define DDRAWISURFGBL_READONLYLOCKHELD           0x00010000L
1379 #define DDRAWISURFGBL_DX8SURFACE                 0x00080000L
1380 #define DDRAWISURFGBL_DDHELDONTFREE              0x00100000L
1381 #define DDRAWISURFGBL_NOTIFYWHENUNLOCKED         0x00200000L
1382 #define DDRAWISURFGBL_RESERVED0                  0x80000000L // Reserved flag
1383 
1384 typedef struct _DDRAWI_DDRAWSURFACE_GBL_MORE {
1385   DWORD dwSize;
1386   __GNU_EXTENSION union {
1387     DWORD dwPhysicalPageTable;
1388     FLATPTR fpPhysicalVidMem;
1389   };
1390   LPDWORD pPageTable;
1391   DWORD cPages;
1392   ULONG_PTR dwSavedDCContext;
1393   FLATPTR fpAliasedVidMem;
1394   ULONG_PTR dwDriverReserved;
1395   ULONG_PTR dwHELReserved;
1396   DWORD cPageUnlocks;
1397   ULONG_PTR hKernelSurface;
1398   DWORD dwKernelRefCnt;
1399   LPDDCOLORCONTROL lpColorInfo;
1400   FLATPTR fpNTAlias;
1401   DWORD dwContentsStamp;
1402   LPVOID lpvUnswappedDriverReserved;
1403   LPVOID lpDDRAWReserved2;
1404   DWORD dwDDRAWReserved1;
1405   DWORD dwDDRAWReserved2;
1406   FLATPTR fpAliasOfVidMem;
1407 } DDRAWI_DDRAWSURFACE_GBL_MORE;
1408 
1409 /* the MS version of this macro was somewhat obfuscated and unreadable
1410  * (possibly because of mediocre MS coders)... so I simplified it...
1411  * (and so I commit no copyright violations either, hah) */
1412 #define GET_LPDDRAWSURFACE_GBL_MORE(psurf_gbl) \
1413   (*(((LPDDRAWI_DDRAWSURFACE_GBL_MORE *)(psurf_gbl)) - 1))
1414 
1415 #define SURFACE_PHYSICALVIDMEM( psurf_gbl ) \
1416   ( GET_LPDDRAWSURFACE_GBL_MORE(psurf_gbl )->fpPhysicalVidMem )
1417 
1418 typedef struct  _DISPLAYMODEINFO {
1419   WORD wWidth;
1420   WORD wHeight;
1421   BYTE wBPP;
1422   BYTE wMonitorsAttachedToDesktop;
1423   WORD wRefreshRate;
1424 } DISPLAYMODEINFO, *LPDISPLAYMODEINFO;
1425 
1426 #define EQUAL_DISPLAYMODE ( A, B ) (0 == memcmp(&(A), &(B), sizeof (DISPLAYMODEINFO)))
1427 
1428 typedef struct _DDRAWI_DDRAWSURFACE_MORE {
1429   DWORD dwSize;
1430   IUNKNOWN_LIST *lpIUnknowns;
1431   LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl;
1432   DWORD dwPageLockCount;
1433   DWORD dwBytesAllocated;
1434   LPDDRAWI_DIRECTDRAW_INT lpDD_int;
1435   DWORD dwMipMapCount;
1436   LPDDRAWI_DDRAWCLIPPER_INT lpDDIClipper;
1437   /* DirectX 5.0 */
1438   LPHEAPALIASINFO lpHeapAliasInfo;
1439   DWORD dwOverlayFlags;
1440   VOID *rgjunc;
1441   LPDDRAWI_DDVIDEOPORT_LCL lpVideoPort;
1442   LPDDOVERLAYFX lpddOverlayFX;
1443   DDSCAPSEX ddsCapsEx;
1444   DWORD dwTextureStage;
1445   LPVOID lpDDRAWReserved;
1446   LPVOID lpDDRAWReserved2;
1447   LPVOID lpDDrawReserved3;
1448   DWORD dwDDrawReserved4;
1449   LPVOID lpDDrawReserved5;
1450   LPDWORD lpGammaRamp;
1451   LPDWORD lpOriginalGammaRamp;
1452   LPVOID lpDDrawReserved6;
1453 # ifndef WIN95
1454   DISPLAYMODEINFO dmiDDrawReserved7;
1455 # endif
1456   DWORD dwSurfaceHandle;
1457   DWORD qwDDrawReserved8[2];
1458   LPVOID lpDDrawReserved9;
1459   DWORD cSurfaces;
1460   LPDDSURFACEDESC2 pCreatedDDSurfaceDesc2;
1461   LPDDRAWI_DDRAWSURFACE_LCL *slist;
1462   DWORD dwFVF;
1463   LPVOID lpVB;
1464 } DDRAWI_DDRAWSURFACE_MORE;
1465 
1466 typedef struct _DDRAWI_DDRAWSURFACE_LCL {
1467   LPDDRAWI_DDRAWSURFACE_MORE lpSurfMore;
1468   LPDDRAWI_DDRAWSURFACE_GBL lpGbl;
1469   ULONG_PTR hDDSurface;
1470   LPATTACHLIST lpAttachList;
1471   LPATTACHLIST lpAttachListFrom;
1472   DWORD dwLocalRefCnt;
1473   DWORD dwProcessId;
1474   DWORD dwFlags;
1475   DDSCAPS ddsCaps;
1476   __GNU_EXTENSION union {
1477     LPDDRAWI_DDRAWPALETTE_INT lpDDPalette;
1478     LPDDRAWI_DDRAWPALETTE_INT lp16DDPalette;
1479   };
1480   __GNU_EXTENSION union {
1481     LPDDRAWI_DDRAWCLIPPER_LCL lpDDClipper;
1482     LPDDRAWI_DDRAWCLIPPER_INT lp16DDClipper;
1483   };
1484   DWORD dwModeCreatedIn;
1485   DWORD dwBackBufferCount;
1486   DDCOLORKEY ddckCKDestBlt;
1487   DDCOLORKEY ddckCKSrcBlt;
1488   ULONG_PTR hDC;
1489   ULONG_PTR dwReserved1;
1490   DDCOLORKEY ddckCKSrcOverlay;
1491   DDCOLORKEY ddckCKDestOverlay;
1492   LPDDRAWI_DDRAWSURFACE_INT lpSurfaceOverlaying;
1493   DBLNODE dbnOverlayNode;
1494   RECT rcOverlaySrc;
1495   RECT rcOverlayDest;
1496   DWORD dwClrXparent;
1497   DWORD dwAlpha;
1498   LONG lOverlayX;
1499   LONG lOverlayY;
1500 } DDRAWI_DDRAWSURFACE_LCL;
1501 
1502 #define DDRAWISURF_ATTACHED           0x00000001L
1503 #define DDRAWISURF_IMPLICITCREATE     0x00000002L
1504 #define DDRAWISURF_ISFREE             0x00000004L
1505 #define DDRAWISURF_ATTACHED_FROM      0x00000008L
1506 #define DDRAWISURF_IMPLICITROOT       0x00000010L
1507 #define DDRAWISURF_PARTOFPRIMARYCHAIN 0x00000020L
1508 #define DDRAWISURF_DATAISALIASED      0x00000040L
1509 #define DDRAWISURF_HASDC              0x00000080L
1510 #define DDRAWISURF_HASCKEYDESTOVERLAY 0x00000100L
1511 #define DDRAWISURF_HASCKEYDESTBLT     0x00000200L
1512 #define DDRAWISURF_HASCKEYSRCOVERLAY  0x00000400L
1513 #define DDRAWISURF_HASCKEYSRCBLT      0x00000800L
1514 #define DDRAWISURF_LOCKEXCLUDEDCURSOR 0x00001000L
1515 #define DDRAWISURF_HASPIXELFORMAT     0x00002000L
1516 #define DDRAWISURF_HASOVERLAYDATA     0x00004000L
1517 #define DDRAWISURF_SETGAMMA           0x00008000L
1518 #define DDRAWISURF_SW_CKEYDESTOVERLAY 0x00010000L
1519 #define DDRAWISURF_SW_CKEYDESTBLT     0x00020000L
1520 #define DDRAWISURF_SW_CKEYSRCOVERLAY  0x00040000L
1521 #define DDRAWISURF_SW_CKEYSRCBLT      0x00080000L
1522 #define DDRAWISURF_HW_CKEYDESTOVERLAY 0x00100000L
1523 #define DDRAWISURF_HW_CKEYDESTBLT     0x00200000L
1524 #define DDRAWISURF_HW_CKEYSRCOVERLAY  0x00400000L
1525 #define DDRAWISURF_HW_CKEYSRCBLT      0x00800000L
1526 #define DDRAWISURF_INMASTERSPRITELIST 0x01000000L
1527 #define DDRAWISURF_HELCB              0x02000000L
1528 #define DDRAWISURF_FRONTBUFFER        0x04000000L
1529 #define DDRAWISURF_BACKBUFFER         0x08000000L
1530 #define DDRAWISURF_INVALID            0x10000000L
1531 #define DDRAWISURF_DCIBUSY            0x20000000L
1532 #define DDRAWISURF_GETDCNULL          0x40000000L
1533 #define DDRAWISURF_STEREOSURFACELEFT  0x20000000L
1534 #define DDRAWISURF_DRIVERMANAGED      0x40000000L
1535 #define DDRAWISURF_DCILOCK            0x80000000L
1536 
1537 /* palettes */
1538 typedef struct _DDRAWI_DDRAWPALETTE_INT {
1539   LPVOID lpVtbl;
1540   LPDDRAWI_DDRAWPALETTE_LCL lpLcl;
1541   LPDDRAWI_DDRAWPALETTE_INT lpLink;
1542   DWORD dwIntRefCnt;
1543 } DDRAWI_DDRAWPALETTE_INT;
1544 
1545 typedef struct _DDRAWI_DDRAWPALETTE_GBL {
1546   DWORD dwRefCnt;
1547   DWORD dwFlags;
1548   LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl;
1549   DWORD dwProcessId;
1550   LPPALETTEENTRY lpColorTable;
1551   __GNU_EXTENSION union {
1552     ULONG_PTR dwReserved1;
1553     HPALETTE hHELGDIPalette;
1554   };
1555   DWORD dwDriverReserved;
1556   DWORD dwContentsStamp;
1557   DWORD dwSaveStamp;
1558   DWORD dwHandle;
1559 } DDRAWI_DDRAWPALETTE_GBL;
1560 
1561 #define DDRAWIPAL_256           0x00000001
1562 #define DDRAWIPAL_16            0x00000002
1563 #define DDRAWIPAL_GDI           0x00000004
1564 #define DDRAWIPAL_STORED_8      0x00000008
1565 #define DDRAWIPAL_STORED_16     0x00000010
1566 #define DDRAWIPAL_STORED_24     0x00000020
1567 #define DDRAWIPAL_EXCLUSIVE     0x00000040
1568 #define DDRAWIPAL_INHEL         0x00000080
1569 #define DDRAWIPAL_DIRTY         0x00000100
1570 #define DDRAWIPAL_ALLOW256      0x00000200
1571 #define DDRAWIPAL_4             0x00000400
1572 #define DDRAWIPAL_2             0x00000800
1573 #define DDRAWIPAL_STORED_8INDEX 0x00001000
1574 #define DDRAWIPAL_ALPHA         0x00002000
1575 
1576 #define D3DFORMAT_OP_TEXTURE                              0x00000001L
1577 #define D3DFORMAT_OP_VOLUMETEXTURE                        0x00000002L
1578 #define D3DFORMAT_OP_CUBETEXTURE                          0x00000004L
1579 #define D3DFORMAT_OP_OFFSCREEN_RENDERTARGET               0x00000008L
1580 #define D3DFORMAT_OP_SAME_FORMAT_RENDERTARGET             0x00000010L
1581 #define D3DFORMAT_OP_ZSTENCIL                             0x00000040L
1582 #define D3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH  0x00000080L
1583 #define D3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET 0x00000100L
1584 #define D3DFORMAT_OP_DISPLAYMODE                          0x00000400L
1585 #define D3DFORMAT_OP_3DACCELERATION                       0x00000800L
1586 #define D3DFORMAT_OP_PIXELSIZE                            0x00001000L
1587 #define D3DFORMAT_OP_CONVERT_TO_ARGB                      0x00002000L
1588 #define D3DFORMAT_OP_OFFSCREENPLAIN                       0x00004000L
1589 #define D3DFORMAT_OP_SRGBREAD                             0x00008000L
1590 #define D3DFORMAT_OP_BUMPMAP                              0x00010000L
1591 #define D3DFORMAT_OP_NOFILTER                             0x00040000L
1592 #define DDPF_D3DFORMAT                                    0x00200000l
1593 #define DDPF_NOVEL_TEXTURE_FORMAT                         0x00100000l
1594 #define D3DFORMAT_MEMBEROFGROUP_ARGB                      0x00080000L
1595 #define D3DFORMAT_OP_SRGBWRITE                            0x00100000L
1596 #define D3DFORMAT_OP_NOALPHABLEND                         0x00200000L
1597 #define D3DFORMAT_OP_AUTOGENMIPMAP                        0x00400000L
1598 #define D3DFORMAT_OP_VERTEXTEXTURE                        0x00800000L
1599 #define D3DFORMAT_OP_NOTEXCOORDWRAPNORMIP                 0x01000000L
1600 #define DELETED_OK                                        0
1601 #define DELETED_LASTONE                                   1
1602 #define DELETED_NOTFOUND                                  2
1603 #define DDCALLBACKSSIZE_V1                                (offsetof(DDHAL_DDCALLBACKS, SetExclusiveMode))
1604 #define DDCALLBACKSSIZE                                   sizeof( DDHAL_DDCALLBACKS )
1605 #define DDRAWICLIP_WATCHWINDOW                            0x00000001
1606 #define DDRAWICLIP_ISINITIALIZED                          0x00000002
1607 #define DDRAWICLIP_INMASTERSPRITELIST                     0x00000004
1608 #define PFINDEX_UNINITIALIZED                             (0UL)
1609 #define PFINDEX_UNSUPPORTED                               (~0UL)
1610 #define ROP_HAS_SOURCE                                    0x00000001l
1611 #define ROP_HAS_PATTERN                                   0x00000002l
1612 #define ROP_HAS_SOURCEPATTERN                             ROP_HAS_SOURCE | ROP_HAS_PATTERN
1613 #define DDRAWIVPORT_ON                                    0x00000001
1614 #define DDRAWIVPORT_SOFTWARE_AUTOFLIP                     0x00000002
1615 #define DDRAWIVPORT_COLORKEYANDINTERP                     0x00000004
1616 #define DDRAWIVPORT_NOKERNELHANDLES                       0x00000008
1617 #define DDRAWIVPORT_SOFTWARE_BOB                          0x00000010
1618 #define DDRAWIVPORT_VBION                                 0x00000020
1619 #define DDRAWIVPORT_VIDEOON                               0x00000040
1620 #define DDRAWI_GETCOLOR                                   0x0001
1621 #define DDRAWI_SETCOLOR                                   0x0002
1622 #define DDMCQUERY_READ                                    0x00000001
1623 #define DDWAITVB_I_TESTVB                                 0x80000006
1624 
1625 #define DDBLT_ANYALPHA                                           \
1626   (DDBLT_ALPHASRCSURFACEOVERRIDE | DDBLT_ALPHASRCCONSTOVERRIDE | \
1627    DDBLT_ALPHASRC | DDBLT_ALPHADESTSURFACEOVERRIDE |             \
1628    DDBLT_ALPHADESTCONSTOVERRIDE | DDBLT_ALPHADEST)
1629 
1630 #define DDHAL_ALIGNVALIDCAPS (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_EXECUTEBUFFER | \
1631                               DDSCAPS_OVERLAY | DDSCAPS_TEXTURE |              \
1632                               DDSCAPS_ZBUFFER | DDSCAPS_ALPHA | DDSCAPS_FLIP )
1633 
1634 #define DDHALINFOSIZE_V2 sizeof(DDHALINFO)
1635 
1636 #define DDOVER_ANYALPHA                                            \
1637   (DDOVER_ALPHASRCSURFACEOVERRIDE | DDOVER_ALPHASRCCONSTOVERRIDE | \
1638    DDOVER_ALPHASRC | DDOVER_ALPHADESTSURFACEOVERRIDE |             \
1639    DDOVER_ALPHADESTCONSTOVERRIDE | DDOVER_ALPHADEST)
1640 
1641 typedef struct _DDRAWI_DDRAWPALETTE_LCL {
1642   DWORD lpPalMore;
1643   LPDDRAWI_DDRAWPALETTE_GBL lpGbl;
1644   ULONG_PTR dwUnused0;
1645   DWORD dwLocalRefCnt;
1646 #ifndef _NO_COM
1647   IUnknown *pUnkOuter;
1648 #else
1649   PVOID pUnkOuter;
1650 #endif
1651   LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl;
1652   ULONG_PTR dwReserved1;
1653   /* DirectX 6.0 */
1654   ULONG_PTR dwDDRAWReserved1;
1655   ULONG_PTR dwDDRAWReserved2;
1656   ULONG_PTR dwDDRAWReserved3;
1657 } DDRAWI_DDRAWPALETTE_LCL;
1658 
1659 typedef struct _DDMCCOMPBUFFERINFO {
1660   DWORD dwSize;
1661   DWORD dwNumCompBuffers;
1662   DWORD dwWidthToCreate;
1663   DWORD dwHeightToCreate;
1664   DWORD dwBytesToAllocate;
1665   DDSCAPS2 ddCompCaps;
1666   DDPIXELFORMAT ddPixelFormat;
1667 } DDMCCOMPBUFFERINFO, *LPDDMCCOMPBUFFERINFO;
1668 
1669 typedef struct _DDMCBUFFERINFO {
1670   DWORD dwSize;
1671   LPDDRAWI_DDRAWSURFACE_LCL lpCompSurface;
1672   DWORD dwDataOffset;
1673   DWORD dwDataSize;
1674   LPVOID lpPrivate;
1675 } DDMCBUFFERINFO, *LPDDMCBUFFERINFO;
1676 
1677 typedef struct _DDHAL_GETDRIVERSTATEDATA {
1678   DWORD dwFlags;
1679   __GNU_EXTENSION union {
1680     ULONG_PTR dwhContext;
1681   };
1682   LPDWORD lpdwStates;
1683   DWORD dwLength;
1684   HRESULT ddRVal;
1685 } DDHAL_GETDRIVERSTATEDATA;
1686 
1687 typedef struct _DDHAL_ADDATTACHEDSURFACEDATA {
1688   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1689   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1690   LPDDRAWI_DDRAWSURFACE_LCL lpSurfAttached;
1691   HRESULT ddRVal;
1692   LPDDHALSURFCB_ADDATTACHEDSURFACE AddAttachedSurface;
1693 } DDHAL_ADDATTACHEDSURFACEDATA;
1694 
1695 typedef struct _DDHAL_BEGINMOCOMPFRAMEDATA {
1696   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1697   LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
1698   LPDDRAWI_DDRAWSURFACE_LCL lpDestSurface;
1699   DWORD dwInputDataSize;
1700   LPVOID lpInputData;
1701   DWORD dwOutputDataSize;
1702   LPVOID lpOutputData;
1703   HRESULT ddRVal;
1704   LPDDHALMOCOMPCB_BEGINFRAME BeginMoCompFrame;
1705 } DDHAL_BEGINMOCOMPFRAMEDATA;
1706 
1707 typedef struct _DDHAL_COLORCONTROLDATA {
1708   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1709   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1710   LPDDCOLORCONTROL lpColorData;
1711   DWORD dwFlags;
1712   HRESULT ddRVal;
1713   LPDDHALCOLORCB_COLORCONTROL ColorControl;
1714 } DDHAL_COLORCONTROLDATA;
1715 
1716 typedef struct _DDHAL_CREATEMOCOMPDATA {
1717   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1718   LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
1719   LPGUID lpGuid;
1720   DWORD dwUncompWidth;
1721   DWORD dwUncompHeight;
1722   DDPIXELFORMAT ddUncompPixelFormat;
1723   LPVOID lpData;
1724   DWORD dwDataSize;
1725   HRESULT ddRVal;
1726   LPDDHALMOCOMPCB_CREATE CreateMoComp;
1727 } DDHAL_CREATEMOCOMPDATA;
1728 
1729 typedef struct _DDHAL_DESTROYMOCOMPDATA {
1730   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1731   LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
1732   HRESULT ddRVal;
1733   LPDDHALMOCOMPCB_DESTROY DestroyMoComp;
1734 } DDHAL_DESTROYMOCOMPDATA;
1735 
1736 typedef struct _DDHAL_ENDMOCOMPFRAMEDATA {
1737   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1738   LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
1739   LPVOID lpInputData;
1740   DWORD dwInputDataSize;
1741   HRESULT ddRVal;
1742   LPDDHALMOCOMPCB_ENDFRAME EndMoCompFrame;
1743 } DDHAL_ENDMOCOMPFRAMEDATA;
1744 
1745 typedef struct _DDHAL_FLIPTOGDISURFACEDATA {
1746   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1747   DWORD dwToGDI;
1748   DWORD dwReserved;
1749   HRESULT ddRVal;
1750   LPDDHAL_FLIPTOGDISURFACE FlipToGDISurface;
1751 } DDHAL_FLIPTOGDISURFACEDATA;
1752 
1753 typedef struct _DDHAL_GETAVAILDRIVERMEMORYDATA {
1754   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1755   DDSCAPS DDSCaps;
1756   DWORD dwTotal;
1757   DWORD dwFree;
1758   HRESULT ddRVal;
1759   LPDDHAL_GETAVAILDRIVERMEMORY GetAvailDriverMemory;
1760   DDSCAPSEX ddsCapsEx;
1761 } DDHAL_GETAVAILDRIVERMEMORYDATA;
1762 
1763 typedef struct _DDHAL_GETBLTSTATUSDATA {
1764   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1765   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1766   DWORD dwFlags;
1767   HRESULT ddRVal;
1768   LPDDHALSURFCB_GETBLTSTATUS GetBltStatus;
1769 } DDHAL_GETBLTSTATUSDATA;
1770 
1771 typedef struct _DDHAL_GETFLIPSTATUSDATA {
1772   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1773   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1774   DWORD dwFlags;
1775   HRESULT ddRVal;
1776   LPDDHALSURFCB_GETFLIPSTATUS GetFlipStatus;
1777 } DDHAL_GETFLIPSTATUSDATA;
1778 
1779 typedef struct _DDHAL_GETINTERNALMOCOMPDATA {
1780   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1781   LPGUID lpGuid;
1782   DWORD dwWidth;
1783   DWORD dwHeight;
1784   DDPIXELFORMAT ddPixelFormat;
1785   DWORD dwScratchMemAlloc;
1786   HRESULT ddRVal;
1787   LPDDHALMOCOMPCB_GETINTERNALINFO GetInternalMoCompInfo;
1788 } DDHAL_GETINTERNALMOCOMPDATA;
1789 
1790 typedef struct _DDHAL_GETMOCOMPCOMPBUFFDATA {
1791   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1792   LPGUID lpGuid;
1793   DWORD dwWidth;
1794   DWORD dwHeight;
1795   DDPIXELFORMAT ddPixelFormat;
1796   DWORD dwNumTypesCompBuffs;
1797   LPDDMCCOMPBUFFERINFO lpCompBuffInfo;
1798   HRESULT ddRVal;
1799   LPDDHALMOCOMPCB_GETCOMPBUFFINFO GetMoCompBuffInfo;
1800 } DDHAL_GETMOCOMPCOMPBUFFDATA;
1801 
1802 typedef struct _DDHAL_GETMOCOMPGUIDSDATA {
1803   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1804   DWORD dwNumGuids;
1805   LPGUID lpGuids;
1806   HRESULT ddRVal;
1807   LPDDHALMOCOMPCB_GETGUIDS GetMoCompGuids;
1808 } DDHAL_GETMOCOMPGUIDSDATA;
1809 
1810 typedef struct _DDHAL_GETMOCOMPFORMATSDATA {
1811   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1812   LPGUID lpGuid;
1813   DWORD dwNumFormats;
1814   LPDDPIXELFORMAT lpFormats;
1815   HRESULT ddRVal;
1816   LPDDHALMOCOMPCB_GETFORMATS GetMoCompFormats;
1817 } DDHAL_GETMOCOMPFORMATSDATA;
1818 
1819 typedef struct _DDHAL_GETSCANLINEDATA {
1820   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1821   DWORD dwScanLine;
1822   HRESULT ddRVal;
1823   LPDDHAL_GETSCANLINE GetScanLine;
1824 } DDHAL_GETSCANLINEDATA;
1825 
1826 typedef struct _DDHAL_QUERYMOCOMPSTATUSDATA {
1827   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1828   LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
1829   LPDDRAWI_DDRAWSURFACE_LCL lpSurface;
1830   DWORD dwFlags;
1831   HRESULT ddRVal;
1832   LPDDHALMOCOMPCB_QUERYSTATUS QueryMoCompStatus;
1833 } DDHAL_QUERYMOCOMPSTATUSDATA;
1834 
1835 typedef struct _DDHAL_RENDERMOCOMPDATA {
1836   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1837   LPDDRAWI_DDMOTIONCOMP_LCL lpMoComp;
1838   DWORD dwNumBuffers;
1839   LPDDMCBUFFERINFO lpBufferInfo;
1840   DWORD dwFunction;
1841   LPVOID lpInputData;
1842   DWORD dwInputDataSize;
1843   LPVOID lpOutputData;
1844   DWORD dwOutputDataSize;
1845   HRESULT ddRVal;
1846   LPDDHALMOCOMPCB_RENDER RenderMoComp;
1847 } DDHAL_RENDERMOCOMPDATA;
1848 
1849 typedef struct _DDHAL_SETCOLORKEYDATA {
1850   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1851   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1852   DWORD dwFlags;
1853   DDCOLORKEY ckNew;
1854   HRESULT ddRVal;
1855   LPDDHALSURFCB_SETCOLORKEY SetColorKey;
1856 } DDHAL_SETCOLORKEYDATA;
1857 
1858 typedef struct _DDHAL_SETOVERLAYPOSITIONDATA {
1859   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1860   LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface;
1861   LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;
1862   LONG lXPos;
1863   LONG lYPos;
1864   HRESULT ddRVal;
1865   LPDDHALSURFCB_SETOVERLAYPOSITION SetOverlayPosition;
1866 } DDHAL_SETOVERLAYPOSITIONDATA;
1867 
1868 typedef struct _DDHAL_UPDATEOVERLAYDATA {
1869   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1870   LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface;
1871   RECTL rDest;
1872   LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface;
1873   RECTL rSrc;
1874   DWORD dwFlags;
1875   DDOVERLAYFX overlayFX;
1876   HRESULT ddRVal;
1877   LPDDHALSURFCB_UPDATEOVERLAY UpdateOverlay;
1878 } DDHAL_UPDATEOVERLAYDATA;
1879 
1880 typedef struct _DDHAL_WAITFORVERTICALBLANKDATA {
1881   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1882   DWORD dwFlags;
1883   DWORD bIsInVB;
1884   ULONG_PTR hEvent;
1885   HRESULT ddRVal;
1886   LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank;
1887 } DDHAL_WAITFORVERTICALBLANKDATA;
1888 
1889 typedef struct _DDHAL_DRVSETCOLORKEYDATA {
1890   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1891   DWORD dwFlags;
1892   DDCOLORKEY ckNew;
1893   HRESULT ddRVal;
1894   LPDDHAL_SETCOLORKEY SetColorKey;
1895 } DDHAL_DRVSETCOLORKEYDATA;
1896 
1897 typedef struct _DDMONITORINFO {
1898   WORD Manufacturer;
1899   WORD Product;
1900   DWORD SerialNumber;
1901   GUID DeviceIdentifier;
1902   int Mode640x480;
1903   int Mode800x600;
1904   int Mode1024x768;
1905   int Mode1280x1024;
1906   int Mode1600x1200;
1907   int ModeReserved1;
1908   int ModeReserved2;
1909   int ModeReserved3;
1910 } DDMONITORINFO, FAR *LPDDMONITORINFO;
1911 
1912 typedef struct _DDRAWI_DDRAWCLIPPER_INT {
1913   LPVOID lpVtbl;
1914   LPDDRAWI_DDRAWCLIPPER_LCL lpLcl;
1915   LPDDRAWI_DDRAWCLIPPER_INT lpLink;
1916   DWORD dwIntRefCnt;
1917 } DDRAWI_DDRAWCLIPPER_INT;
1918 
1919 typedef struct _DDHAL_UPDATENONLOCALHEAPDATA {
1920   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1921   DWORD dwHeap;
1922   FLATPTR fpGARTLin;
1923   FLATPTR fpGARTDev;
1924   ULONG_PTR ulPolicyMaxBytes;
1925   HRESULT ddRVal;
1926   LPDDHAL_UPDATENONLOCALHEAP UpdateNonLocalHeap;
1927 } DDHAL_UPDATENONLOCALHEAPDATA;
1928 
1929 typedef struct _DDHAL_SETCLIPLISTDATA {
1930   LPDDRAWI_DIRECTDRAW_GBL lpDD;
1931   LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface;
1932   HRESULT ddRVal;
1933   LPDDHALSURFCB_SETCLIPLIST SetClipList;
1934 } DDHAL_SETCLIPLISTDATA;
1935 
1936 typedef struct _DDRAWI_DDMOTIONCOMP_LCL {
1937   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1938   GUID guid;
1939   DWORD dwUncompWidth;
1940   DWORD dwUncompHeight;
1941   DDPIXELFORMAT ddUncompPixelFormat;
1942   DWORD dwInternalFlags;
1943   DWORD dwRefCnt;
1944   DWORD dwProcessId;
1945   HANDLE hMoComp;
1946   DWORD dwDriverReserved1;
1947   DWORD dwDriverReserved2;
1948   DWORD dwDriverReserved3;
1949   LPVOID lpDriverReserved1;
1950   LPVOID lpDriverReserved2;
1951   LPVOID lpDriverReserved3;
1952 } DDRAWI_DDMOTIONCOMP_LCL;
1953 
1954 typedef struct _DDRAWI_DDMOTIONCOMP_INT {
1955   LPVOID lpVtbl;
1956   LPDDRAWI_DDMOTIONCOMP_LCL lpLcl;
1957   LPDDRAWI_DDMOTIONCOMP_INT lpLink;
1958   DWORD dwIntRefCnt;
1959 } DDRAWI_DDMOTIONCOMP_INT;
1960 
1961 typedef struct _DDRAWI_DDVIDEOPORT_LCL {
1962   LPDDRAWI_DIRECTDRAW_LCL lpDD;
1963   DDVIDEOPORTDESC ddvpDesc;
1964   DDVIDEOPORTINFO ddvpInfo;
1965   LPDDRAWI_DDRAWSURFACE_INT lpSurface;
1966   LPDDRAWI_DDRAWSURFACE_INT lpVBISurface;
1967   LPDDRAWI_DDRAWSURFACE_INT *lpFlipInts;
1968   DWORD dwNumAutoflip;
1969   DWORD dwProcessID;
1970   DWORD dwStateFlags;
1971   DWORD dwFlags;
1972   DWORD dwRefCnt;
1973   FLATPTR fpLastFlip;
1974   ULONG_PTR dwReserved1;
1975   ULONG_PTR dwReserved2;
1976   HANDLE hDDVideoPort;
1977   DWORD dwNumVBIAutoflip;
1978   LPDDVIDEOPORTDESC lpVBIDesc;
1979   LPDDVIDEOPORTDESC lpVideoDesc;
1980   LPDDVIDEOPORTINFO lpVBIInfo;
1981   LPDDVIDEOPORTINFO lpVideoInfo;
1982   DWORD dwVBIProcessID;
1983   LPDDRAWI_DDVIDEOPORT_INT lpVPNotify;
1984 } DDRAWI_DDVIDEOPORT_LCL;
1985 
1986 typedef struct _DDRAWI_DDVIDEOPORT_INT {
1987   LPVOID lpVtbl;
1988   LPDDRAWI_DDVIDEOPORT_LCL lpLcl;
1989   LPDDRAWI_DDVIDEOPORT_INT lpLink;
1990   DWORD dwIntRefCnt;
1991   DWORD dwFlags;
1992 } DDRAWI_DDVIDEOPORT_INT;
1993 
1994 typedef struct _DDRAWI_DDRAWCLIPPER_LCL {
1995   DWORD lpClipMore;
1996   LPDDRAWI_DDRAWCLIPPER_GBL lpGbl;
1997   LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl;
1998   DWORD dwLocalRefCnt;
1999 #ifndef _NO_COM
2000   IUnknown *pUnkOuter;
2001 #else
2002   PVOID pUnkOuter;
2003 #endif
2004   LPDDRAWI_DIRECTDRAW_INT lpDD_int;
2005   ULONG_PTR dwReserved1;
2006 #ifndef _NO_COM
2007   IUnknown *pAddrefedThisOwner;
2008 #else
2009   PVOID pAddrefedThisOwner;
2010 #endif
2011 } DDRAWI_DDRAWCLIPPER_LCL;
2012 
2013 typedef struct _DDRAWI_DDRAWCLIPPER_GBL {
2014   DWORD dwRefCnt;
2015   DWORD dwFlags;
2016   LPDDRAWI_DIRECTDRAW_GBL lpDD;
2017   DWORD dwProcessId;
2018   ULONG_PTR dwReserved1;
2019   ULONG_PTR hWnd;
2020   LPRGNDATA lpStaticClipList;
2021 } DDRAWI_DDRAWCLIPPER_GBL;
2022 
2023 typedef BOOL (PASCAL *LPDDHEL_INIT)(LPDDRAWI_DIRECTDRAW_GBL,BOOL);
2024 
2025 extern HRESULT DDAPI
2026 LateAllocateSurfaceMem(
2027   LPDIRECTDRAWSURFACE lpSurface,
2028   DWORD dwPleaseAllocType,
2029   DWORD dwWidthInBytesOrSize,
2030   DWORD dwHeight);
2031 
2032 LPDIRECTDRAWSURFACE GetNextMipMap(
2033   LPDIRECTDRAWSURFACE lpLevel);
2034 
2035 typedef struct IDirectDrawClipperVtbl DIRECTDRAWCLIPPERCALLBACKS;
2036 typedef struct IDirectDrawPaletteVtbl DIRECTDRAWPALETTECALLBACKS;
2037 typedef struct IDirectDrawSurfaceVtbl DIRECTDRAWSURFACECALLBACKS;
2038 typedef struct IDirectDrawSurface2Vtbl DIRECTDRAWSURFACE2CALLBACKS;
2039 typedef struct IDirectDrawSurface3Vtbl DIRECTDRAWSURFACE3CALLBACKS;
2040 typedef struct IDirectDrawSurface4Vtbl DIRECTDRAWSURFACE4CALLBACKS;
2041 typedef struct IDirectDrawSurface7Vtbl DIRECTDRAWSURFACE7CALLBACKS;
2042 typedef struct IDirectDrawColorControlVtbl DIRECTDRAWCOLORCONTROLCALLBACKS;
2043 typedef struct IDirectDrawVtbl DIRECTDRAWCALLBACKS;
2044 typedef struct IDirectDraw2Vtbl DIRECTDRAW2CALLBACKS;
2045 typedef struct IDirectDraw4Vtbl DIRECTDRAW4CALLBACKS;
2046 typedef struct IDirectDraw7Vtbl DIRECTDRAW7CALLBACKS;
2047 typedef struct IDirectDrawKernelVtbl DIRECTDRAWKERNELCALLBACKS;
2048 typedef struct IDirectDrawSurfaceKernelVtbl DIRECTDRAWSURFACEKERNELCALLBACKS;
2049 typedef struct IDirectDrawGammaControlVtbl DIRECTDRAWGAMMACONTROLCALLBACKS;
2050 
2051 typedef DIRECTDRAWCLIPPERCALLBACKS  *LPDIRECTDRAWCLIPPERCALLBACKS;
2052 typedef DIRECTDRAWPALETTECALLBACKS  *LPDIRECTDRAWPALETTECALLBACKS;
2053 typedef DIRECTDRAWSURFACECALLBACKS  *LPDIRECTDRAWSURFACECALLBACKS;
2054 typedef DIRECTDRAWCALLBACKS  *LPDIRECTDRAWCALLBACKS;
2055 
2056 HRESULT CALLBACK
2057 D3DParseUnknownCommand (
2058   LPVOID lpvCommands,
2059   LPVOID *lplpvReturnedCommand);
2060 
2061 #ifdef __cplusplus
2062 } /* extern "C" */
2063 #endif
2064 
2065 #endif /* __DDRAWI_INCLUDED__ */
2066