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.

474 lines
14 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1996 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dinputv.h
  6. * Content: private DirectInput VxD include file
  7. *
  8. ***************************************************************************/
  9. #ifndef __DINPUTV_INCLUDED__
  10. #define __DINPUTV_INCLUDED__
  11. /* XLATOFF */
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /* XLATON */
  16. /****************************************************************************
  17. *
  18. * DeviceIOCtl codes for DINPUT.VXD
  19. *
  20. * IOCTL_FIRST is where DINPUT keeps its IOCTL codes. Modify it
  21. * if necessary to move DINPUT's IOCTLs to a new location.
  22. *
  23. * All DINPUT IOCTLs are private between DINPUT.DLL and DINPUT.VXD.
  24. * You can change them with impunity.
  25. *
  26. ***************************************************************************/
  27. #define IOCTL_FIRST 0x0100
  28. /* H2INCSWITCHES -t -f */
  29. #if 0
  30. /* Declare some types so h2inc will get them */
  31. typedef LONG HWND;
  32. typedef LONG DWORD;
  33. #endif
  34. /* Declare some more types for Win9x builds and h2inc */
  35. #ifndef MAXULONG_PTR
  36. typedef DWORD ULONG_PTR;
  37. typedef DWORD *PULONG_PTR;
  38. typedef DWORD UINT_PTR;
  39. typedef DWORD *PULONG_PTR;
  40. #endif //MAXULONG_PTR
  41. /****************************************************************************
  42. *
  43. * The shared portion of the VXDINSTANCE structure.
  44. *
  45. * Instance "handles" are really pointers to a VXDINSTANCE structure.
  46. *
  47. ***************************************************************************/
  48. typedef struct VXDINSTANCE { /* vi */
  49. ULONG fl; /* Flags */
  50. void * pState; /* Instantaneous device state */
  51. DIDEVICEOBJECTDATA *pBuffer; /* Device object data buffer */
  52. DIDEVICEOBJECTDATA *pEnd; /* End of buffer */
  53. DIDEVICEOBJECTDATA *pHead; /* Where new data appears */
  54. DIDEVICEOBJECTDATA *pTail; /* Oldest object data */
  55. ULONG fOverflow; /* Did the buffer overflow? */
  56. /* (exactly 0 or 1) */
  57. struct CDIDev *pdd; /* For misc communication */
  58. HWND hwnd; /* The cooperative window */
  59. } VXDINSTANCE, *PVXDINSTANCE;
  60. #define VIFL_CAPTURED_BIT 0
  61. #define VIFL_CAPTURED 0x00000001 /* Device is captured (exclusive) */
  62. #define VIFL_ACQUIRED_BIT 1
  63. #define VIFL_ACQUIRED 0x00000002 /* Device is acquired */
  64. #define VIFL_RELATIVE_BIT 2
  65. #define VIFL_RELATIVE 0x00000004 /* Device wants relative data */
  66. #define VIFL_EMULATED_BIT 3
  67. #define VIFL_EMULATED 0x00000008 /* Device uses emulation */
  68. #define VIFL_UNPLUGGED_BIT 4
  69. #define VIFL_UNPLUGGED 0x00000010 /* Device is disconnected */
  70. #define VIFL_NOWINKEY_BIT 5
  71. #define VIFL_NOWINKEY 0x00000020 /* The Window Key are disabled */
  72. #define VIFL_MODECOMPAT_BIT 6
  73. #define VIFL_MODECOMPAT 0x00000040 /* Set if this application needs
  74. buggy DX7 axis mode behavior */
  75. #ifdef WANT_TO_FIX_MANBUG43879
  76. #define VIFL_FOREGROUND_BIT 7
  77. #define VIFL_FOREGROUND 0x00000080 /* Device is foreground */
  78. #endif
  79. #define VIFL_INITIALIZE_BIT 8
  80. #define VIFL_INITIALIZE 0x00000100 /* This flag is set during the acquisition
  81. of a HID device so that we can get the
  82. initial device state successfully. */
  83. /*
  84. * The high word of fl contains device-specific flags. They are
  85. * currently used to record emulation information, and they aren't
  86. * really device-specific because we have so few emulation flags.
  87. *
  88. * The high word is just the emulation flags shifted upwards.
  89. */
  90. #define DIGETEMFL(fl) ((fl) >> 16)
  91. #define DIMAKEEMFL(fl) ((fl) << 16)
  92. /****************************************************************************
  93. *
  94. * System-defined IOCTL codes
  95. *
  96. ***************************************************************************/
  97. #define IOCTL_GETVERSION 0x0000
  98. /****************************************************************************
  99. *
  100. * DINPUT-class IOCTLs
  101. *
  102. ***************************************************************************/
  103. /*
  104. * IN: None
  105. *
  106. * OUT: None
  107. *
  108. * The foreground window has lost activation. Force all exclusively
  109. * acquired devices to be unacquired.
  110. *
  111. * This IOCTL is no longer used. (Actually, it was never used.)
  112. *
  113. */
  114. #define IOCTL_INPUTLOST (IOCTL_FIRST + 0)
  115. typedef struct VXDDEVICEFORMAT { /* devf */
  116. ULONG cbData; /* Size of device data */
  117. ULONG cObj; /* Number of objects in data format */
  118. DIOBJECTDATAFORMAT *rgodf; /* Array of descriptions */
  119. ULONG_PTR dwExtra; /* Extra dword for private communication */
  120. DWORD dwEmulation; /* Flags controlling emulation */
  121. } VXDDEVICEFORMAT, *PVXDDEVICEFORMAT;
  122. /*
  123. * IN: An instance handle that needs to be cleaned up.
  124. *
  125. * OUT: None.
  126. *
  127. */
  128. #define IOCTL_DESTROYINSTANCE (IOCTL_FIRST + 1)
  129. /*
  130. * pDfOfs is an array of DWORDs. Each entry corresponds to a byte in the
  131. * device data format, indicating the offset in the *client* data format
  132. * which records the data. Or it is -1 if the client isn't tracking this
  133. * object.
  134. *
  135. * For example, if the object at device offset 4 is to be reported at
  136. * client data offset 12, then pDfOfs[4] = 12.
  137. */
  138. typedef struct VXDDATAFORMAT { /* vdf */
  139. VXDINSTANCE *pvi; /* Instance identifier */
  140. ULONG cbData; /* Size of device data */
  141. DWORD * pDfOfs; /* Array of data format offsets */
  142. } VXDDATAFORMAT, *PVXDDATAFORMAT;
  143. /*
  144. * IN: PVXDDATAFORMAT.
  145. *
  146. * OUT: None
  147. *
  148. * The application has changed the data format. Notify the VxD so that
  149. * data can be collected appropriately.
  150. *
  151. */
  152. #define IOCTL_SETDATAFORMAT (IOCTL_FIRST + 2)
  153. /*
  154. * IN: An instance handle to be acquired.
  155. *
  156. * OUT: None.
  157. *
  158. */
  159. #define IOCTL_ACQUIREINSTANCE (IOCTL_FIRST + 3)
  160. /*
  161. * IN: An instance handle to be unacquired.
  162. *
  163. * OUT: None.
  164. *
  165. */
  166. #define IOCTL_UNACQUIREINSTANCE (IOCTL_FIRST + 4)
  167. typedef struct VXDDWORDDATA { /* vdd */
  168. VXDINSTANCE *pvi; /* Instance identifier */
  169. ULONG dw; /* Some dword */
  170. } VXDDWORDDATA, *PVXDDWORDDATA;
  171. /*
  172. * IN: VXDDWORDDATA (dw = ring 0 handle)
  173. *
  174. * OUT: None.
  175. *
  176. */
  177. #define IOCTL_SETNOTIFYHANDLE (IOCTL_FIRST + 5)
  178. /*
  179. * IN: VXDDWORDDATA (dw = buffer size)
  180. *
  181. * OUT: None.
  182. *
  183. */
  184. #define IOCTL_SETBUFFERSIZE (IOCTL_FIRST + 6)
  185. /****************************************************************************
  186. *
  187. * Mouse class IOCTLs
  188. *
  189. ***************************************************************************/
  190. /*
  191. * IN: VXDDEVICEFORMAT (dwExtra = number of axes)
  192. *
  193. * OUT: Instance handle
  194. */
  195. #define IOCTL_MOUSE_CREATEINSTANCE (IOCTL_FIRST + 7)
  196. /*
  197. * IN: VXDDWORDDATA; dw is a BYTE[4] of initial mouse button states
  198. *
  199. * OUT: None
  200. */
  201. #define IOCTL_MOUSE_INITBUTTONS (IOCTL_FIRST + 8)
  202. /****************************************************************************
  203. *
  204. * Keyboard class IOCTLs
  205. *
  206. ***************************************************************************/
  207. /*
  208. * IN: VXDDEVICEFORMAT (dwExtra = keyboard type translation table)
  209. *
  210. * OUT: Instance handle
  211. */
  212. #define IOCTL_KBD_CREATEINSTANCE (IOCTL_FIRST + 9)
  213. /*
  214. * IN: VXDDWORDDATA; dw is a bitmask
  215. * 1 = KANA key is down, 2 = CAPITAL key is down
  216. *
  217. * OUT: None
  218. */
  219. #define IOCTL_KBD_INITKEYS (IOCTL_FIRST + 10)
  220. /****************************************************************************
  221. *
  222. * Joystick class IOCTLs
  223. *
  224. ***************************************************************************/
  225. /*
  226. * IN: VXDDEVICEFORMAT (dwExtra = joystick id number)
  227. *
  228. * OUT: Instance handle
  229. */
  230. #define IOCTL_JOY_CREATEINSTANCE (IOCTL_FIRST + 11)
  231. /*
  232. * IN: An instance handle to be pinged
  233. *
  234. * OUT: Instance handle
  235. */
  236. #define IOCTL_JOY_PING (IOCTL_FIRST + 12)
  237. /*
  238. * IN: DWORD external joystick ID
  239. *
  240. * OUT: VXDINITPARMS containing goo we get from VJOYD.
  241. *
  242. */
  243. typedef struct VXDINITPARMS { /* vip */
  244. ULONG hres; /* result */
  245. ULONG dwSize; /* Which version of VJOYD are we? */
  246. ULONG dwFlags; /* Describes the device */
  247. ULONG dwId; /* Internal joystick ID */
  248. ULONG dwFirmwareRevision;
  249. ULONG dwHardwareRevision;
  250. ULONG dwFFDriverVersion;
  251. ULONG dwFilenameLengths;
  252. void * pFilenameBuffer;
  253. DWORD Usages[6]; /* X, Y, Z, R, U, V */
  254. DWORD dwPOV0usage;
  255. DWORD dwPOV1usage;
  256. DWORD dwPOV2usage;
  257. DWORD dwPOV3usage;
  258. } VXDINITPARMS, *PVXDINITPARMS;
  259. /*
  260. * Flags returned in VXDINITPARMS
  261. */
  262. #define VIP_UNIT_ID 0x00000001L /* unit id is valid */
  263. #define VIP_ISHID 0x00000002L /* This is a HID device */
  264. #define VIP_SENDSNOTIFY 0x00000004L /* Driver will notify */
  265. #define IOCTL_JOY_GETINITPARMS (IOCTL_FIRST + 13)
  266. /*
  267. * IN: VXDFFIO describing FF I/O request
  268. *
  269. * pvArgs points to an array of arguments. We rely on several
  270. * quirks of fate for this to work.
  271. *
  272. * 1. STDCALL pushes arguments on the stack from right to left,
  273. * so the address of the first argument can be used as a
  274. * structure pointer.
  275. *
  276. * 2. All the VJOYD interfaces pass arguments in registers.
  277. *
  278. * 3. The registers used by VJOYD interfaces are always in the
  279. * order eax, ecx, edx, esi, edi, matching the order in which
  280. * the arguments are passed to IDirectInputEffectDriver.
  281. *
  282. * OUT: HRESULT containing result code
  283. *
  284. */
  285. /* XLATOFF */
  286. #include <pshpack4.h>
  287. /* XLATON */
  288. typedef struct VXDFFIO { /* ffio */
  289. DWORD dwIOCode; /* I/O code */
  290. void * pvArgs; /* Array of arguments */
  291. } VXDFFIO, *PVXDFFIO;
  292. /* XLATOFF */
  293. #include <poppack.h>
  294. /* XLATON */
  295. #define FFIO_ESCAPE 0
  296. #define FFIO_SETGAIN 1
  297. #define FFIO_SETFFSTATE 2
  298. #define FFIO_GETFFSTATE 3
  299. #define FFIO_DOWNLOADEFFECT 4
  300. #define FFIO_DESTROYEFFECT 5
  301. #define FFIO_STARTEFFECT 6
  302. #define FFIO_STOPEFFECT 7
  303. #define FFIO_GETEFFECTSTATUS 8
  304. #define FFIO_MAX 9
  305. #define IOCTL_JOY_FFIO (IOCTL_FIRST + 14)
  306. /****************************************************************************
  307. *
  308. * Misc services
  309. *
  310. ***************************************************************************/
  311. /*
  312. * IN: Nothing
  313. *
  314. * OUT: Pointer to dword sequence pointer
  315. */
  316. #define IOCTL_GETSEQUENCEPTR (IOCTL_FIRST + 15)
  317. /****************************************************************************
  318. *
  319. * Back to Joystick
  320. *
  321. ***************************************************************************/
  322. /*
  323. * Define these again, because NT doesn't have vjoyd
  324. * and because vjoyd.inc doesn't define them.
  325. */
  326. #define JOYPF_X 0x00000001
  327. #define JOYPF_Y 0x00000002
  328. #define JOYPF_Z 0x00000004
  329. #define JOYPF_R 0x00000008
  330. #define JOYPF_U 0x00000010
  331. #define JOYPF_V 0x00000020
  332. #define JOYPF_POV0 0x00000040
  333. #define JOYPF_POV1 0x00000080
  334. #define JOYPF_POV2 0x00000100
  335. #define JOYPF_POV3 0x00000200
  336. #define JOYPF_POV(n) (JOYPF_POV0 << (n))
  337. #define JOYPF_BTN0 0x00000400
  338. #define JOYPF_BTN1 0x00000800
  339. #define JOYPF_BTN2 0x00001000
  340. #define JOYPF_BTN3 0x00002000
  341. #define JOYPF_ALLAXES 0x0000003F
  342. #define JOYPF_ALLCAPS 0x00003FFF
  343. #define JOYPF_POSITION 0x00010000
  344. #define JOYPF_VELOCITY 0x00020000
  345. #define JOYPF_ACCELERATION 0x00040000
  346. #define JOYPF_FORCE 0x00080000
  347. #define JOYPF_ALLMODES 0x000F0000
  348. #define JOYPF_NUMMODES 4
  349. /*
  350. * IN: DWORD external joystick ID
  351. *
  352. * OUT: array of DWORDs listing which axes are valid where
  353. *
  354. */
  355. typedef struct VXDAXISCAPS { /* vac */
  356. DWORD dwPos; /* Axis positions */
  357. DWORD dwVel; /* Axis velocities */
  358. DWORD dwAccel; /* Axis accelerations */
  359. DWORD dwForce; /* Axis forces */
  360. } VXDAXISCAPS, *PVXDAXISCAPS;
  361. #define IOCTL_JOY_GETAXES (IOCTL_FIRST + 16)
  362. /****************************************************************************
  363. *
  364. * Mouse random
  365. *
  366. ***************************************************************************/
  367. /*
  368. * IN: Nothing
  369. *
  370. * OUT: Pointer to dword wheel granularity.
  371. */
  372. #define IOCTL_MOUSE_GETWHEEL (IOCTL_FIRST + 17)
  373. /****************************************************************************
  374. *
  375. * New IOCTLs for DX8, stuck on the end to improve chances of cross
  376. * version compatibility.
  377. *
  378. ***************************************************************************/
  379. /*
  380. * IN: Nothing
  381. *
  382. * OUT: Nothing
  383. */
  384. #define IOCTL_JOY_CONFIGCHANGED (IOCTL_FIRST + 18)
  385. /*
  386. * IN: An instance handle to be pinged
  387. *
  388. * OUT: Instance handle
  389. *
  390. * This is used by the post dinput.dll versions of the DLL to avoid
  391. * unacquiring all instances of a device on a poll failure.
  392. * It is used by dinput.dll to implement the NoPollUnacquire app compat fix.
  393. */
  394. #define IOCTL_JOY_PING8 (IOCTL_FIRST + 19)
  395. /****************************************************************************
  396. *
  397. * End of IOCTL table
  398. *
  399. ***************************************************************************/
  400. #define IOCTL_MAX (IOCTL_FIRST + 20)
  401. /* XLATOFF */
  402. #ifdef __cplusplus
  403. };
  404. #endif
  405. /* XLATON */
  406. #endif /* __DINPUTV_INCLUDED__ */