[HEADERS]
[reactos.git] / reactos / include / ddk / ddkmapi.h
1 /*
2 * ddkmapi.h
3 *
4 * DirectDraw support for DxApi function
5 *
6 * Contributors:
7 * Created by Magnus Olsen
8 *
9 * THIS SOFTWARE IS NOT COPYRIGHTED
10 *
11 * This source code is offered for use in the public domain. You may
12 * use, modify or distribute it freely.
13 *
14 * This code is distributed in the hope that it will be useful but
15 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16 * DISCLAIMED. This includes but is not limited to warranties of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 */
20
21 #ifndef __DDKMAPI_INCLUDED__
22 #define __DDKMAPI_INCLUDED__
23
24 /* Helper macro to enable gcc's extension. */
25 #ifndef __GNU_EXTENSION
26 #ifdef __GNUC__
27 #define __GNU_EXTENSION __extension__
28 #else
29 #define __GNU_EXTENSION
30 #endif
31 #endif
32
33 #if defined(_DXAPI_)
34 #define DXAPI
35 #else
36 #define DXAPI DECLSPEC_IMPORT
37 #endif
38
39
40
41 #define DXAPI_MAJORVERSION 1
42 #define DXAPI_MINORVERSION 0
43
44 #define DD_FIRST_DXAPI 0x500
45 #define DD_DXAPI_GETVERSIONNUMBER (DD_FIRST_DXAPI)
46 #define DD_DXAPI_CLOSEHANDLE (DD_FIRST_DXAPI+1)
47 #define DD_DXAPI_OPENDIRECTDRAW (DD_FIRST_DXAPI+2)
48 #define DD_DXAPI_OPENSURFACE (DD_FIRST_DXAPI+3)
49 #define DD_DXAPI_OPENVIDEOPORT (DD_FIRST_DXAPI+4)
50 #define DD_DXAPI_GETKERNELCAPS (DD_FIRST_DXAPI+5)
51 #define DD_DXAPI_GET_VP_FIELD_NUMBER (DD_FIRST_DXAPI+6)
52 #define DD_DXAPI_SET_VP_FIELD_NUMBER (DD_FIRST_DXAPI+7)
53 #define DD_DXAPI_SET_VP_SKIP_FIELD (DD_FIRST_DXAPI+8)
54 #define DD_DXAPI_GET_SURFACE_STATE (DD_FIRST_DXAPI+9)
55 #define DD_DXAPI_SET_SURFACE_STATE (DD_FIRST_DXAPI+10)
56 #define DD_DXAPI_LOCK (DD_FIRST_DXAPI+11)
57 #define DD_DXAPI_FLIP_OVERLAY (DD_FIRST_DXAPI+12)
58 #define DD_DXAPI_FLIP_VP (DD_FIRST_DXAPI+13)
59 #define DD_DXAPI_GET_CURRENT_VP_AUTOFLIP_SURFACE (DD_FIRST_DXAPI+14)
60 #define DD_DXAPI_GET_LAST_VP_AUTOFLIP_SURFACE (DD_FIRST_DXAPI+15)
61 #define DD_DXAPI_REGISTER_CALLBACK (DD_FIRST_DXAPI+16)
62 #define DD_DXAPI_UNREGISTER_CALLBACK (DD_FIRST_DXAPI+17)
63 #define DD_DXAPI_GET_POLARITY (DD_FIRST_DXAPI+18)
64 #define DD_DXAPI_OPENVPCAPTUREDEVICE (DD_FIRST_DXAPI+19)
65 #define DD_DXAPI_ADDVPCAPTUREBUFFER (DD_FIRST_DXAPI+20)
66 #define DD_DXAPI_FLUSHVPCAPTUREBUFFERS (DD_FIRST_DXAPI+21)
67
68 /* DDOPENVPCAPTUREDEVICEIN.dwFlags constants */
69 #define DDOPENCAPTURE_VIDEO 0x0001
70 #define DDOPENCAPTURE_VBI 0x0002
71
72 /* DDADDVPCAPTUREBUFF.dwFlags constants */
73 #define DDADDBUFF_SYSTEMMEMORY 0x0001
74 #define DDADDBUFF_NONLOCALVIDMEM 0x0002
75 #define DDADDBUFF_INVERT 0x0004
76
77 /* DDGETSURFACESTATEOUT.dwStateCaps/dwStateStatus constants */
78 #define DDSTATE_BOB 0x0001
79 #define DDSTATE_WEAVE 0x0002
80 #define DDSTATE_EXPLICITLY_SET 0x0004
81 #define DDSTATE_SOFTWARE_AUTOFLIP 0x0008
82 #define DDSTATE_SKIPEVENFIELDS 0x0010
83
84 /* DDREGISTERCALLBACK.dwEvents constants */
85 #define DDEVENT_DISPLAY_VSYNC 0x0001
86 #define DDEVENT_VP_VSYNC 0x0002
87 #define DDEVENT_VP_LINE 0x0004
88 #define DDEVENT_PRERESCHANGE 0x0008
89 #define DDEVENT_POSTRESCHANGE 0x0010
90 #define DDEVENT_PREDOSBOX 0x0020
91 #define DDEVENT_POSTDOSBOX 0x0040
92
93 /* LPDD_NOTIFYCALLBACK.dwFlags constants */
94 #define DDNOTIFY_DISPLAY_VSYNC 0x0001
95 #define DDNOTIFY_VP_VSYNC 0x0002
96 #define DDNOTIFY_VP_LINE 0x0004
97 #define DDNOTIFY_PRERESCHANGE 0x0008
98 #define DDNOTIFY_POSTRESCHANGE 0x0010
99 #define DDNOTIFY_PREDOSBOX 0x0020
100 #define DDNOTIFY_POSTDOSBOX 0x0040
101 #define DDNOTIFY_CLOSEDIRECTDRAW 0x0080
102 #define DDNOTIFY_CLOSESURFACE 0x0100
103 #define DDNOTIFY_CLOSEVIDEOPORT 0x0200
104 #define DDNOTIFY_CLOSECAPTURE 0x0400
105
106 typedef DWORD (PASCAL *LPDXAPI)(DWORD dwFunctionNum, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer);
107 typedef ULONG (PASCAL *LPDD_NOTIFYCALLBACK) (DWORD dwFlags, PVOID pContext, DWORD dwParam1, DWORD dwParam2);
108
109 typedef struct _DDCAPBUFFINFO
110 {
111 DWORD dwFieldNumber;
112 DWORD bPolarity;
113 LARGE_INTEGER liTimeStamp;
114 DWORD ddRVal;
115 } DDCAPBUFFINFO, * LPDDCAPBUFFINFO;
116
117 typedef struct _DDADDVPCAPTUREBUFF
118 {
119 HANDLE hCapture;
120 DWORD dwFlags;
121 PMDL pMDL;
122 PKEVENT pKEvent;
123 LPDDCAPBUFFINFO lpBuffInfo;
124 } DDADDVPCAPTUREBUFF, * LPDDADDVPCAPTUREBUFF;
125
126 typedef struct _DDCLOSEHANDLE
127 {
128 HANDLE hHandle;
129 } DDCLOSEHANDLE, *LPDDCLOSEHANDLE;
130
131 typedef struct _DDFLIPOVERLAY
132 {
133 HANDLE hDirectDraw;
134 HANDLE hCurrentSurface;
135 HANDLE hTargetSurface;
136 DWORD dwFlags;
137 } DDFLIPOVERLAY, *LPDDFLIPOVERLAY;
138
139 typedef struct _DDFLIPVIDEOPORT
140 {
141 HANDLE hDirectDraw;
142 HANDLE hVideoPort;
143 HANDLE hCurrentSurface;
144 HANDLE hTargetSurface;
145 DWORD dwFlags;
146 } DDFLIPVIDEOPORT, *LPDDFLIPVIDEOPORT;
147
148 typedef struct _DDGETAUTOFLIPIN
149 {
150 HANDLE hDirectDraw;
151 HANDLE hVideoPort;
152 } DDGETAUTOFLIPIN, *LPDDGETAUTOFLIPIN;
153
154 typedef struct _DDGETAUTOFLIPOUT
155 {
156 DWORD ddRVal;
157 HANDLE hVideoSurface;
158 HANDLE hVBISurface;
159 BOOL bPolarity;
160 } DDGETAUTOFLIPOUT, *LPDDGETAUTOFLIPOUT;
161
162 typedef struct _DDGETPOLARITYIN
163 {
164 HANDLE hDirectDraw;
165 HANDLE hVideoPort;
166 } DDGETPOLARITYIN, *LPDDGETPOLARITYIN;
167
168 typedef struct _DDGETPOLARITYOUT
169 {
170 DWORD ddRVal;
171 BOOL bPolarity;
172 } DDGETPOLARITYOUT, *LPDDGETPOLARITYOUT;
173
174 typedef struct _DDGETSURFACESTATEIN
175 {
176 HANDLE hDirectDraw;
177 HANDLE hSurface;
178 } DDGETSURFACESTATEIN, *LPDDGETSURFACESTATEIN;
179
180 typedef struct _DDGETSURFACESTATEOUT
181 {
182 DWORD ddRVal;
183 DWORD dwStateCaps;
184 DWORD dwStateStatus;
185 } DDGETSURFACESTATEOUT, *LPDDGETSURFACESTATEOUT;
186
187 typedef struct _DDGETFIELDNUMIN
188 {
189 HANDLE hDirectDraw;
190 HANDLE hVideoPort;
191 } DDGETFIELDNUMIN, *LPDDGETFIELDNUMIN;
192
193 typedef struct _DDGETFIELDNUMOUT
194 {
195 DWORD ddRVal;
196 DWORD dwFieldNum;
197 } DDGETFIELDNUMOUT, *LPDDGETFIELDNUMOUT;
198
199 typedef struct _DDGETKERNELCAPSOUT
200 {
201 DWORD ddRVal;
202 DWORD dwCaps;
203 DWORD dwIRQCaps;
204 } DDGETKERNELCAPSOUT, *LPDDGETKERNELCAPSOUT;
205
206 typedef struct _DDGETVERSIONNUMBER
207 {
208 DWORD ddRVal;
209 DWORD dwMajorVersion;
210 DWORD dwMinorVersion;
211 } DDGETVERSIONNUMBER, *LPDDGETVERSIONNUMBER;
212
213 typedef struct _DDLOCKIN
214 {
215 HANDLE hDirectDraw;
216 HANDLE hSurface;
217 } DDLOCKIN, *LPDDLOCKIN;
218
219 typedef struct _DDLOCKOUT
220 {
221 DWORD ddRVal;
222 DWORD dwSurfHeight;
223 DWORD dwSurfWidth;
224 LONG lSurfPitch;
225 PVOID lpSurface;
226 DWORD SurfaceCaps;
227 DWORD dwFormatFlags;
228 DWORD dwFormatFourCC;
229 DWORD dwFormatBitCount;
230 __GNU_EXTENSION union
231 {
232 DWORD dwRBitMask;
233 DWORD dwYBitMask;
234 };
235 __GNU_EXTENSION union
236 {
237 DWORD dwGBitMask;
238 DWORD dwUBitMask;
239 };
240 __GNU_EXTENSION union
241 {
242 DWORD dwBBitMask;
243 DWORD dwVBitMask;
244 };
245 } DDLOCKOUT, *LPDDLOCKOUT;
246
247
248 typedef struct _DDOPENDIRECTDRAWIN
249 {
250 ULONG_PTR dwDirectDrawHandle;
251 LPDD_NOTIFYCALLBACK pfnDirectDrawClose;
252 PVOID pContext;
253 } DDOPENDIRECTDRAWIN, *LPDDOPENDIRECTDRAWIN;
254
255 typedef struct _DDOPENDIRECTDRAWOUT
256 {
257 DWORD ddRVal;
258 HANDLE hDirectDraw;
259 } DDOPENDIRECTDRAWOUT, *LPDDOPENDIRECTDRAWOUT;
260
261 typedef struct _DDOPENSURFACEIN
262 {
263 HANDLE hDirectDraw;
264 ULONG_PTR dwSurfaceHandle;
265 LPDD_NOTIFYCALLBACK pfnSurfaceClose;
266 PVOID pContext;
267 } DDOPENSURFACEIN, *LPDDOPENSURFACEIN;
268
269 typedef struct _DDOPENSURFACEOUT
270 {
271 DWORD ddRVal;
272 HANDLE hSurface;
273 } DDOPENSURFACEOUT, *LPDDOPENSURFACEOUT;
274
275 typedef struct _DDOPENVIDEOPORTIN
276 {
277 HANDLE hDirectDraw;
278 ULONG dwVideoPortHandle;
279 LPDD_NOTIFYCALLBACK pfnVideoPortClose;
280 PVOID pContext;
281 } DDOPENVIDEOPORTIN, *LPDDOPENVIDEOPORTIN;
282
283 typedef struct _DDOPENVIDEOPORTOUT
284 {
285 DWORD ddRVal;
286 HANDLE hVideoPort;
287 } DDOPENVIDEOPORTOUT, *LPDDOPENVIDEOPORTOUT;
288
289 typedef struct _DDOPENVPCAPTUREDEVICEIN
290 {
291 HANDLE hDirectDraw;
292 HANDLE hVideoPort;
293 DWORD dwStartLine;
294 DWORD dwEndLine;
295 DWORD dwCaptureEveryNFields;
296 LPDD_NOTIFYCALLBACK pfnCaptureClose;
297 PVOID pContext;
298 DWORD dwFlags;
299 } DDOPENVPCAPTUREDEVICEIN, * LPDDOPENVPCAPTUREDEVICEIN;
300
301 typedef struct _DDOPENVPCAPTUREDEVICEOUT
302 {
303 DWORD ddRVal;
304 HANDLE hCapture;
305 } DDOPENVPCAPTUREDEVICEOUT, * LPDDOPENVPCAPTUREDEVICEOUT;
306
307 typedef struct _DDREGISTERCALLBACK
308 {
309 HANDLE hDirectDraw;
310 ULONG dwEvents;
311 LPDD_NOTIFYCALLBACK pfnCallback;
312 ULONG_PTR dwParam1;
313 ULONG_PTR dwParam2;
314 PVOID pContext;
315 } DDREGISTERCALLBACK, *LPDDREGISTERCALLBACK;
316
317 typedef struct _DDSETSURFACETATE
318 {
319 HANDLE hDirectDraw;
320 HANDLE hSurface;
321 DWORD dwState;
322 DWORD dwStartField;
323 } DDSETSURFACESTATE, *LPDDSETSURFACESTATE;
324
325 typedef struct _DDSETFIELDNUM
326 {
327 HANDLE hDirectDraw;
328 HANDLE hVideoPort;
329 DWORD dwFieldNum;
330 } DDSETFIELDNUM, *LPDDSETFIELDNUM;
331
332 typedef struct _DDSETSKIPFIELD
333 {
334 HANDLE hDirectDraw;
335 HANDLE hVideoPort;
336 DWORD dwStartField;
337 } DDSETSKIPFIELD, *LPDDSETSKIPFIELD;
338
339
340 DXAPI
341 DWORD PASCAL
342 DxApi(IN DWORD dwFunctionNum,
343 IN LPVOID lpvInBuffer,
344 IN DWORD cbInBuffer,
345 OUT LPVOID lpvOutBuffer,
346 OUT DWORD cbOutBuffer);
347
348
349
350 #endif /* __DDKMAPI_INCLUDED__ */