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