Source code of Windows XP (NT5)
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.

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