Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

496 lines
12 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ddkmapi.h
  6. * Content: Kernel mode APIs for accessing DirectDraw support.
  7. *
  8. ***************************************************************************/
  9. #ifndef __DDKMAPI_INCLUDED__
  10. #define __DDKMAPI_INCLUDED__
  11. /*
  12. * API entry point
  13. */
  14. DWORD
  15. FAR PASCAL
  16. DxApi(
  17. DWORD dwFunctionNum,
  18. LPVOID lpvInBuffer,
  19. DWORD cbInBuffer,
  20. LPVOID lpvOutBuffer,
  21. DWORD cbOutBuffer
  22. );
  23. typedef
  24. DWORD
  25. (FAR PASCAL *LPDXAPI)(
  26. DWORD dwFunctionNum,
  27. LPVOID lpvInBuffer,
  28. DWORD cbInBuffer,
  29. LPVOID lpvOutBuffer,
  30. DWORD cbOutBuffer
  31. );
  32. #define DXAPI_MAJORVERSION 1
  33. #define DXAPI_MINORVERSION 0
  34. #define DD_FIRST_DXAPI 0x500
  35. typedef ULONG (FAR PASCAL *LPDD_NOTIFYCALLBACK)(DWORD dwFlags, PVOID pContext, DWORD dwParam1, DWORD dwParam2);
  36. /*
  37. * Queries the DXAPI version number.
  38. *
  39. * Input: Null
  40. * Output: LPDDGETVERSIONNUMBER
  41. */
  42. #define DD_DXAPI_GETVERSIONNUMBER (DD_FIRST_DXAPI)
  43. typedef struct _DDGETVERSIONNUMBER
  44. {
  45. DWORD ddRVal;
  46. DWORD dwMajorVersion;
  47. DWORD dwMinorVersion;
  48. } DDGETVERSIONNUMBER, FAR *LPDDGETVERSIONNUMBER;
  49. /*
  50. * Closes the kernel mode handle.
  51. *
  52. * Input: LPDDCLOSEHANDLE
  53. * Output: DWORD DirectDraw return value
  54. */
  55. #define DD_DXAPI_CLOSEHANDLE (DD_FIRST_DXAPI+1)
  56. typedef struct _DDCLOSEHANDLE
  57. {
  58. HANDLE hHandle;
  59. } DDCLOSEHANDLE, FAR *LPDDCLOSEHANDLE;
  60. /*
  61. * Opens the DirectDraw object and returns a kernel mode handle.
  62. *
  63. * Input: LPDDOPENDIRECTDRAWIN
  64. * Output: LPDDOPENDIRECTDRAWOUT
  65. */
  66. #define DD_DXAPI_OPENDIRECTDRAW (DD_FIRST_DXAPI+2)
  67. typedef struct _DDOPENDIRECTDRAWIN
  68. {
  69. ULONG_PTR dwDirectDrawHandle;
  70. LPDD_NOTIFYCALLBACK pfnDirectDrawClose;
  71. PVOID pContext;
  72. } DDOPENDIRECTDRAWIN, FAR *LPDDOPENDIRECTDRAWIN;
  73. typedef struct _DDOPENDIRECTDRAWOUT
  74. {
  75. DWORD ddRVal;
  76. HANDLE hDirectDraw;
  77. } DDOPENDIRECTDRAWOUT, FAR *LPDDOPENDIRECTDRAWOUT;
  78. /*
  79. * Opens the surface and returns a kernel mode handle.
  80. *
  81. * Input: LPDDOPENSURFACEIN
  82. * Output: LPDDOPENSURFACEOUT
  83. */
  84. #define DD_DXAPI_OPENSURFACE (DD_FIRST_DXAPI+3)
  85. typedef struct _DDOPENSURFACEIN
  86. {
  87. HANDLE hDirectDraw;
  88. ULONG_PTR dwSurfaceHandle;
  89. LPDD_NOTIFYCALLBACK pfnSurfaceClose;
  90. PVOID pContext;
  91. } DDOPENSURFACEIN, FAR *LPDDOPENSURFACEIN;
  92. typedef struct _DDOPENSURFACEOUT
  93. {
  94. DWORD ddRVal;
  95. HANDLE hSurface;
  96. } DDOPENSURFACEOUT, FAR *LPDDOPENSURFACEOUT;
  97. /*
  98. * Opens the VideoPort and returns a kernel mode handle.
  99. *
  100. * Input: LPDDOPENVIDEOPORTIN
  101. * Output: LPDDOPENVIDEOPORTOUT
  102. */
  103. #define DD_DXAPI_OPENVIDEOPORT (DD_FIRST_DXAPI+4)
  104. typedef struct _DDOPENVIDEOPORTIN
  105. {
  106. HANDLE hDirectDraw;
  107. ULONG dwVideoPortHandle;
  108. LPDD_NOTIFYCALLBACK pfnVideoPortClose;
  109. PVOID pContext;
  110. } DDOPENVIDEOPORTIN, FAR *LPDDOPENVIDEOPORTIN;
  111. typedef struct _DDOPENVIDEOPORTOUT
  112. {
  113. DWORD ddRVal;
  114. HANDLE hVideoPort;
  115. } DDOPENVIDEOPORTOUT, FAR *LPDDOPENVIDEOPORTOUT;
  116. /*
  117. * Returns the kernel mode capabilities supported by the device
  118. *
  119. * Input: HANDLE hDirectDraw
  120. * Output: LPDDGETKERNELCAPSOUT
  121. */
  122. #define DD_DXAPI_GETKERNELCAPS (DD_FIRST_DXAPI+5)
  123. typedef struct _DDGETKERNELCAPSOUT
  124. {
  125. DWORD ddRVal;
  126. DWORD dwCaps;
  127. DWORD dwIRQCaps;
  128. } DDGETKERNELCAPSOUT, FAR *LPDDGETKERNELCAPSOUT;
  129. /*
  130. * Gets the current field number
  131. *
  132. * Input: LPDDGETFIELDNUMIN
  133. * Output: LPDDGETFIELDNUMOUT
  134. */
  135. #define DD_DXAPI_GET_VP_FIELD_NUMBER (DD_FIRST_DXAPI+6)
  136. typedef struct _DDGETFIELDNUMIN
  137. {
  138. HANDLE hDirectDraw;
  139. HANDLE hVideoPort;
  140. } DDGETFIELDNUMIN, FAR *LPDDGETFIELDNUMIN;
  141. typedef struct _DDGETFIELDNUMOUT
  142. {
  143. DWORD ddRVal;
  144. DWORD dwFieldNum;
  145. } DDGETFIELDNUMOUT, FAR *LPDDGETFIELDNUMOUT;
  146. /*
  147. * Sets the current field number
  148. *
  149. * Input: LPDDSETFIELDNUM
  150. * Output: DWORD DirectDraw return value
  151. */
  152. #define DD_DXAPI_SET_VP_FIELD_NUMBER (DD_FIRST_DXAPI+7)
  153. typedef struct _DDSETFIELDNUM
  154. {
  155. HANDLE hDirectDraw;
  156. HANDLE hVideoPort;
  157. DWORD dwFieldNum;
  158. } DDSETFIELDNUM, FAR *LPDDSETFIELDNUM;
  159. /*
  160. * Indicates which fields should be skipped to undo the 3:2 pulldown.
  161. *
  162. * Input: LPDDSETSKIPFIELD
  163. * Output: DWORD DirectDraw return value
  164. */
  165. #define DD_DXAPI_SET_VP_SKIP_FIELD (DD_FIRST_DXAPI+8)
  166. typedef struct _DDSETSKIPFIELD
  167. {
  168. HANDLE hDirectDraw;
  169. HANDLE hVideoPort;
  170. DWORD dwStartField;
  171. } DDSETSKIPFIELD, FAR *LPDDSETSKIPFIELD;
  172. /*
  173. * Notifies whether the surface is in bob or weave mode.
  174. *
  175. * Input: LPDDGETSURFACESTATEIN
  176. * Output: LPDDGETSURFACESTATEOUT
  177. */
  178. #define DD_DXAPI_GET_SURFACE_STATE (DD_FIRST_DXAPI+9)
  179. typedef struct _DDGETSURFACESTATEIN
  180. {
  181. HANDLE hDirectDraw;
  182. HANDLE hSurface;
  183. } DDGETSURFACESTATEIN, FAR *LPDDGETSURFACESTATEIN;
  184. typedef struct _DDGETSURFACESTATEOUT
  185. {
  186. DWORD ddRVal;
  187. DWORD dwStateCaps;
  188. DWORD dwStateStatus;
  189. } DDGETSURFACESTATEOUT, FAR *LPDDGETSURFACESTATEOUT;
  190. /*
  191. * Changes the surface between bob and weave mode.
  192. *
  193. * Input: LPDDSETSURFACESTATE
  194. * Output: DWORD DirectDraw return value
  195. */
  196. #define DD_DXAPI_SET_SURFACE_STATE (DD_FIRST_DXAPI+10)
  197. typedef struct _DDSETSURFACETATE
  198. {
  199. HANDLE hDirectDraw;
  200. HANDLE hSurface;
  201. DWORD dwState;
  202. DWORD dwStartField;
  203. } DDSETSURFACESTATE, FAR *LPDDSETSURFACESTATE;
  204. /*
  205. * Allows direct access to the surface memory
  206. *
  207. * Input: LPDDLOCKIN
  208. * Output: LPDDLOCKOUT
  209. */
  210. #define DD_DXAPI_LOCK (DD_FIRST_DXAPI+11)
  211. typedef struct _DDLOCKIN
  212. {
  213. HANDLE hDirectDraw;
  214. HANDLE hSurface;
  215. } DDLOCKIN, FAR *LPDDLOCKIN;
  216. typedef struct _DDLOCKOUT
  217. {
  218. DWORD ddRVal;
  219. DWORD dwSurfHeight;
  220. DWORD dwSurfWidth;
  221. LONG lSurfPitch;
  222. PVOID lpSurface;
  223. DWORD SurfaceCaps;
  224. DWORD dwFormatFlags;
  225. DWORD dwFormatFourCC;
  226. DWORD dwFormatBitCount;
  227. union
  228. {
  229. DWORD dwRBitMask;
  230. DWORD dwYBitMask;
  231. };
  232. union
  233. {
  234. DWORD dwGBitMask;
  235. DWORD dwUBitMask;
  236. };
  237. union
  238. {
  239. DWORD dwBBitMask;
  240. DWORD dwVBitMask;
  241. };
  242. } DDLOCKOUT, FAR *LPDDLOCKOUT;
  243. /*
  244. * Flips the overlay surface
  245. *
  246. * Input: LPDDFLIPOVERLAY
  247. * Output: DWORD DirectDraw return value
  248. */
  249. #define DD_DXAPI_FLIP_OVERLAY (DD_FIRST_DXAPI+12)
  250. typedef struct _DDFLIPOVERLAY
  251. {
  252. HANDLE hDirectDraw;
  253. HANDLE hCurrentSurface;
  254. HANDLE hTargetSurface;
  255. DWORD dwFlags;
  256. } DDFLIPOVERLAY, FAR *LPDDFLIPOVERLAY;
  257. /*
  258. * Flips the video port
  259. *
  260. * Input: LPDDFLIPOVERLAY
  261. * Output: DWORD DirectDraw return value
  262. */
  263. #define DD_DXAPI_FLIP_VP (DD_FIRST_DXAPI+13)
  264. typedef struct _DDFLIPVIDEOPORT
  265. {
  266. HANDLE hDirectDraw;
  267. HANDLE hVideoPort;
  268. HANDLE hCurrentSurface;
  269. HANDLE hTargetSurface;
  270. DWORD dwFlags;
  271. } DDFLIPVIDEOPORT, FAR *LPDDFLIPVIDEOPORT;
  272. /*
  273. * Returns the current surface receiving the data while autoflipping
  274. *
  275. * Input: LPDDGETAUTOFLIPIN
  276. * Output: LPDDGETAUTOFLIPOUT
  277. */
  278. #define DD_DXAPI_GET_CURRENT_VP_AUTOFLIP_SURFACE (DD_FIRST_DXAPI+14)
  279. typedef struct _DDGETAUTOFLIPIN
  280. {
  281. HANDLE hDirectDraw;
  282. HANDLE hVideoPort;
  283. } DDGETAUTOFLIPIN, FAR *LPDDGETAUTOFLIPIN;
  284. typedef struct _DDGETAUTOFLIPOUT
  285. {
  286. DWORD ddRVal;
  287. HANDLE hVideoSurface;
  288. HANDLE hVBISurface;
  289. BOOL bPolarity;
  290. } DDGETAUTOFLIPOUT, FAR *LPDDGETAUTOFLIPOUT;
  291. /*
  292. * Returns the surface that received the previous field of data (could
  293. * be the same as current if video is interleaved)
  294. *
  295. * Input: LPDDGETAUTOFLIPIN
  296. * Output: LPDDGETAUTOFLIPOUT
  297. */
  298. #define DD_DXAPI_GET_LAST_VP_AUTOFLIP_SURFACE (DD_FIRST_DXAPI+15)
  299. /*
  300. * Registers a callback for when various events occur.
  301. *
  302. * Input: LPDDREGISTERCALLBACK
  303. * Output: DWORD DirectDraw return value
  304. */
  305. #define DD_DXAPI_REGISTER_CALLBACK (DD_FIRST_DXAPI+16)
  306. typedef struct _DDREGISTERCALLBACK
  307. {
  308. HANDLE hDirectDraw;
  309. ULONG dwEvents;
  310. LPDD_NOTIFYCALLBACK pfnCallback;
  311. ULONG_PTR dwParam1;
  312. ULONG_PTR dwParam2;
  313. PVOID pContext;
  314. } DDREGISTERCALLBACK, FAR *LPDDREGISTERCALLBACK;
  315. /*
  316. * Unregisters a callback for when various events occur.
  317. *
  318. * Input: LPDDREGISTERCALLBACK
  319. * Output: DWORD DirectDraw return value
  320. */
  321. #define DD_DXAPI_UNREGISTER_CALLBACK (DD_FIRST_DXAPI+17)
  322. /*
  323. * Returns the polarity (odd/even) of the current field
  324. *
  325. * Input: LPDDGETPOLARITYIN
  326. * Output: LPDDGETPOLARITYOUT
  327. */
  328. #define DD_DXAPI_GET_POLARITY (DD_FIRST_DXAPI+18)
  329. typedef struct _DDGETPOLARITYIN
  330. {
  331. HANDLE hDirectDraw;
  332. HANDLE hVideoPort;
  333. } DDGETPOLARITYIN, FAR *LPDDGETPOLARITYIN;
  334. typedef struct _DDGETPOLARITYOUT
  335. {
  336. DWORD ddRVal;
  337. BOOL bPolarity;
  338. } DDGETPOLARITYOUT, FAR *LPDDGETPOLARITYOUT;
  339. /*
  340. * Opens the device for capture
  341. *
  342. * Input: LPDDOPENCAPTUREDEVICEIN
  343. * Output: LPDDOPENCAPTUREDEVICEOUT
  344. */
  345. #define DD_DXAPI_OPENVPCAPTUREDEVICE (DD_FIRST_DXAPI+19)
  346. typedef struct _DDOPENVPCAPTUREDEVICEIN
  347. {
  348. HANDLE hDirectDraw;
  349. HANDLE hVideoPort;
  350. DWORD dwStartLine;
  351. DWORD dwEndLine;
  352. DWORD dwCaptureEveryNFields;
  353. LPDD_NOTIFYCALLBACK pfnCaptureClose;
  354. PVOID pContext;
  355. DWORD dwFlags;
  356. } DDOPENVPCAPTUREDEVICEIN, FAR * LPDDOPENVPCAPTUREDEVICEIN;
  357. typedef struct _DDOPENVPCAPTUREDEVICEOUT
  358. {
  359. DWORD ddRVal;
  360. HANDLE hCapture;
  361. } DDOPENVPCAPTUREDEVICEOUT, FAR * LPDDOPENVPCAPTUREDEVICEOUT;
  362. #define DDOPENCAPTURE_VIDEO 0x0001 // Capture from the video stream
  363. #define DDOPENCAPTURE_VBI 0x0002 // Capture from the VBI stream
  364. /*
  365. * Adds a capture buffer to the internal video port capture queue
  366. *
  367. * Input: LPDDADDVPCAPTUREBUFF
  368. * Output: DWORD DirectDraw return value
  369. */
  370. #define DD_DXAPI_ADDVPCAPTUREBUFFER (DD_FIRST_DXAPI+20)
  371. typedef struct _DDCAPBUFFINFO
  372. {
  373. DWORD dwFieldNumber;
  374. DWORD bPolarity;
  375. LARGE_INTEGER liTimeStamp;
  376. DWORD ddRVal;
  377. } DDCAPBUFFINFO, FAR * LPDDCAPBUFFINFO;
  378. typedef struct _DDADDVPCAPTUREBUFF
  379. {
  380. HANDLE hCapture;
  381. DWORD dwFlags;
  382. PMDL pMDL;
  383. PKEVENT pKEvent;
  384. LPDDCAPBUFFINFO lpBuffInfo;
  385. } DDADDVPCAPTUREBUFF, FAR * LPDDADDVPCAPTUREBUFF;
  386. #define DDADDBUFF_SYSTEMMEMORY 0x0001 // lpBuffer points to sys mem
  387. #define DDADDBUFF_NONLOCALVIDMEM 0x0002 // lpBuffer points to AGP mem
  388. #define DDADDBUFF_INVERT 0x0004 // invert the buffer during capture
  389. /*
  390. * Flushes the internal video port capture queue
  391. *
  392. * Input: HANDLE to capture device
  393. * Output: DWORD DirectDraw return value
  394. */
  395. #define DD_DXAPI_FLUSHVPCAPTUREBUFFERS (DD_FIRST_DXAPI+21)
  396. /*
  397. * State flags returned by DSVXD_DXAPI_DD_GET_SURFACE_STATE
  398. */
  399. #define DDSTATE_BOB 0x0001
  400. #define DDSTATE_WEAVE 0x0002
  401. #define DDSTATE_EXPLICITLY_SET 0x0004
  402. #define DDSTATE_SOFTWARE_AUTOFLIP 0x0008
  403. #define DDSTATE_SKIPEVENFIELDS 0x0010
  404. /*
  405. * Event flags - passed into RegisterCallback
  406. */
  407. #define DDEVENT_DISPLAY_VSYNC 0x0001
  408. #define DDEVENT_VP_VSYNC 0x0002
  409. #define DDEVENT_VP_LINE 0x0004
  410. #define DDEVENT_PRERESCHANGE 0x0008
  411. #define DDEVENT_POSTRESCHANGE 0x0010
  412. #define DDEVENT_PREDOSBOX 0x0020
  413. #define DDEVENT_POSTDOSBOX 0x0040
  414. /*
  415. * Notification flags - passed to the notification proc
  416. */
  417. #define DDNOTIFY_DISPLAY_VSYNC 0x0001 // dwParam1 = hDirectDraw
  418. #define DDNOTIFY_VP_VSYNC 0x0002 // dwParam1 = hVideoPort
  419. #define DDNOTIFY_VP_LINE 0x0004 // dwParam1 = hVideoPort
  420. #define DDNOTIFY_PRERESCHANGE 0x0008 // dwParam1 = hDirectDraw
  421. #define DDNOTIFY_POSTRESCHANGE 0x0010 // dwParam1 = hDirectDraw
  422. #define DDNOTIFY_PREDOSBOX 0x0020 // dwParam1 = hDirectDraw
  423. #define DDNOTIFY_POSTDOSBOX 0x0040 // dwParam1 = hDirectDraw
  424. #define DDNOTIFY_CLOSEDIRECTDRAW 0x0080 // dwParam1 = hDirectDraw
  425. #define DDNOTIFY_CLOSESURFACE 0x0100 // dwParam1 = hSurface
  426. #define DDNOTIFY_CLOSEVIDEOPORT 0x0200 // dwParam1 = hVideoPort
  427. #define DDNOTIFY_CLOSECAPTURE 0x0400 // dwParam1 = hCapture
  428. #endif