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.

996 lines
27 KiB

  1. /****************************************************************************
  2. * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  3. * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  4. * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  5. * PURPOSE.
  6. *
  7. * Copyright (c) 1994 - 1998 Microsoft Corporation. All Rights Reserved.
  8. *
  9. * File: vjoyd.h
  10. * Content: include file for describing VJoyD mini-driver communications
  11. *
  12. *
  13. ***************************************************************************/
  14. #ifndef __VJOYD_INCLUDED__
  15. #define __VJOYD_INCLUDED__
  16. /*
  17. * define all types and macros necessary to include dinputd.h
  18. */
  19. #ifndef WIN32_LEAN_AND_MEAN
  20. #define WIN32_LEAN_AND_MEAN
  21. #endif
  22. #ifndef FAR
  23. #define FAR
  24. #endif
  25. #ifndef NEAR
  26. #define NEAR
  27. #endif
  28. #ifndef DWORD
  29. typedef ULONG DWORD;
  30. #endif
  31. typedef DWORD FAR *LPDWORD;
  32. #ifndef LPVOID
  33. typedef void FAR *LPVOID;
  34. #endif
  35. #ifndef PVOID
  36. typedef void FAR *PVOID;
  37. #endif
  38. typedef long LONG;
  39. typedef long FAR *LPLONG;
  40. typedef char FAR *LPSTR;
  41. #ifndef WCHAR
  42. typedef unsigned short WCHAR;
  43. typedef unsigned short FAR *PWCHAR;
  44. #endif
  45. #ifndef UNICODE_STRING
  46. typedef struct UNICODE_STRING { /* us */
  47. WORD Length;
  48. WORD MaximumLength;
  49. PWCHAR Buffer;
  50. } UNICODE_STRING, FAR *PUNICODE_STRING;
  51. #endif
  52. #define DIJ_RINGZERO
  53. #define _INC_MMSYSTEM
  54. /*
  55. * Make joyConfigChanged compile
  56. */
  57. #ifndef WINMMAPI
  58. #define WINMMAPI __declspec(dllimport)
  59. #endif
  60. #ifndef MMRESULT
  61. typedef UINT MMRESULT; /* error return code, 0 means no error */
  62. #endif
  63. #ifndef WINAPI
  64. #define WINAPI
  65. #endif
  66. #include <winerror.h>
  67. #include <dinput.h>
  68. #include <dinputd.h>
  69. #include <configmg.h>
  70. #include "vjoydapi.h"
  71. /*
  72. * Make sure HID types have been defined
  73. */
  74. #ifndef USAGE
  75. typedef USHORT USAGE;
  76. typedef USHORT FAR *PUSAGE;
  77. #endif
  78. #ifndef USAGE_AND_PAGE
  79. typedef struct USAGE_AND_PAGE {
  80. USAGE Usage;
  81. USAGE UsagePage;
  82. } USAGE_AND_PAGE;
  83. typedef struct USAGE_AND_PAGE FAR *PUSAGE_AND_PAGE;
  84. #endif
  85. /*
  86. * joystick ports
  87. */
  88. #define MIN_JOY_PORT 0x200
  89. #define MAX_JOY_PORT 0x20F
  90. #define DEFAULT_JOY_PORT 0x201
  91. /*
  92. * Poll types
  93. * passed in the type field to a Win95 interface poll callback
  94. */
  95. #define JOY_OEMPOLL_POLL1 0
  96. #define JOY_OEMPOLL_POLL2 1
  97. #define JOY_OEMPOLL_POLL3 2
  98. #define JOY_OEMPOLL_POLL4 3
  99. #define JOY_OEMPOLL_POLL5 4
  100. #define JOY_OEMPOLL_POLL6 5
  101. #define JOY_OEMPOLL_GETBUTTONS 6
  102. #define JOY_OEMPOLL_PASSDRIVERDATA 7
  103. /*
  104. * Axis numbers used for single axis (JOY_OEMPOLL_POLL1) polls
  105. */
  106. #define JOY_AXIS_X 0
  107. #define JOY_AXIS_Y 1
  108. #define JOY_AXIS_Z 2
  109. #define JOY_AXIS_R 3
  110. #define JOY_AXIS_U 4
  111. #define JOY_AXIS_V 5
  112. /*
  113. * joystick error return values
  114. */
  115. #define JOYERR_BASE 160
  116. #define JOYERR_NOERROR (0) /* no error */
  117. #define JOYERR_PARMS (JOYERR_BASE+5) /* bad parameters */
  118. #define JOYERR_NOCANDO (JOYERR_BASE+6) /* request not completed */
  119. #define JOYERR_UNPLUGGED (JOYERR_BASE+7) /* joystick is unplugged */
  120. /*
  121. * constants used with JOYINFO and JOYINFOEX structures and MM_JOY* messages
  122. */
  123. #define JOY_BUTTON1 0x0001
  124. #define JOY_BUTTON2 0x0002
  125. #define JOY_BUTTON3 0x0004
  126. #define JOY_BUTTON4 0x0008
  127. /*
  128. * constants used with JOYINFOEX structure
  129. */
  130. #define JOY_POVCENTERED (WORD) -1
  131. #define JOY_POVFORWARD 0
  132. #define JOY_POVRIGHT 9000
  133. #define JOY_POVBACKWARD 18000
  134. #define JOY_POVLEFT 27000
  135. #define POV_UNDEFINED (DWORD) -1
  136. /*
  137. * List of services available for calling by VxDs
  138. * Note, many of these are for internal use only.
  139. */
  140. #define VJOYD_Service Declare_Service
  141. #pragma warning (disable:4003) /* turn off not enough params warning */
  142. /*MACROS*/
  143. Begin_Service_Table(VJOYD)
  144. /*
  145. * Win95 Gold services
  146. */
  147. VJOYD_Service ( VJOYD_Register_Device_Driver, LOCAL )
  148. VJOYD_Service ( VJOYD_GetPosEx_Service, LOCAL )
  149. /*
  150. * DInput services (for internal use only)
  151. */
  152. VJOYD_Service ( VJOYD_GetInitParams_Service, LOCAL )
  153. VJOYD_Service ( VJOYD_Poll_Service, LOCAL )
  154. VJOYD_Service ( VJOYD_Escape_Service, LOCAL )
  155. VJOYD_Service ( VJOYD_CtrlMsg_Service, LOCAL )
  156. VJOYD_Service ( VJOYD_SetGain_Service, LOCAL )
  157. VJOYD_Service ( VJOYD_SendFFCommand_Service, LOCAL )
  158. VJOYD_Service ( VJOYD_GetFFState_Service, LOCAL )
  159. VJOYD_Service ( VJOYD_DownloadEffect_Service, LOCAL )
  160. VJOYD_Service ( VJOYD_DestroyEffect_Service, LOCAL )
  161. VJOYD_Service ( VJOYD_StartEffect_Service, LOCAL )
  162. VJOYD_Service ( VJOYD_StopEffect_Service, LOCAL )
  163. VJOYD_Service ( VJOYD_GetEffectStatus_Service, LOCAL )
  164. /*
  165. * Interrupt polling
  166. * Mini-drivers should call this if they are interrupt driven at the
  167. * time they are notified of a change.
  168. */
  169. VJOYD_Service ( VJOYD_DeviceUpdateNotify_Service, LOCAL )
  170. /*
  171. * Screen saver (internal only)
  172. */
  173. VJOYD_Service ( VJOYD_JoystickActivity_Service, LOCAL )
  174. /*
  175. * Registry access
  176. */
  177. VJOYD_Service ( VJOYD_OpenTypeKey_Service, LOCAL )
  178. VJOYD_Service ( VJOYD_OpenConfigKey_Service, LOCAL )
  179. /*
  180. * Gameport provider (not fully supported)
  181. */
  182. VJOYD_Service ( VJOYD_NewGameportDevNode, LOCAL )
  183. /*
  184. * Config Changed
  185. */
  186. VJOYD_Service ( VJOYD_ConfigChanged_Service, LOCAL )
  187. End_Service_Table(VJOYD)
  188. /*ENDMACROS*/
  189. #define VJOYD_Init_Order UNDEFINED_INIT_ORDER
  190. #pragma warning (default:4003) /* restore not enough params warning */
  191. #ifndef HRESULT
  192. typedef LONG HRESULT;
  193. #endif
  194. #define MAX_MSJSTICK (16)
  195. #define MAX_POLL MAX_MSJSTICK
  196. /*
  197. * VJoyD sends this system control message to a mini-driver when it needs
  198. * the mini-driver to register it's callbacks and properties.
  199. * A mini-driver that can be loaded by some mechanism other than by VJoyD
  200. * should perform it's registration only in response to this message rather
  201. * than in response to SYS_DYNAMIC_DEVICE_INIT or SYS_DYNAMIC_DEVICE_REINIT.
  202. *
  203. * alias BEGIN_RESERVED_PRIVATE_SYSTEM_CONTROL
  204. */
  205. #define VJOYD_REINIT_PRIVATE_SYSTEM_CONTROL 0x70000000
  206. #define JOY_OEMPOLLRC_OK 1
  207. #define JOY_OEMPOLLRC_FAIL 0
  208. /*
  209. * Error codes
  210. * These are custom names for standard HRESULTs
  211. */
  212. #define VJ_OK S_OK /* A complete success */
  213. #define VJ_FALSE S_FALSE /* A success but not without some difficulties */
  214. #define VJ_DEFAULT VJ_FALSE /* Mini-driver does not understand */
  215. #define VJ_INCOMPLETE VJ_FALSE /* Some requested poll data was not returned */
  216. #define VJERR_FAIL E_FAIL
  217. #define VJERR_NEED_DEVNODE VJERR_FAIL /* Need more resources */
  218. #define VJERR_BAD_DEVNODE VJERR_FAIL /* Last resources were insufficient */
  219. #define VJERR_INVALIDPARAM E_INVALIDARG
  220. #define VJERR_FAIL_HID 0x80070052 /* The device is HID, so fail VJoyD polls: MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_DUP_NAME) */
  221. #define VJERR_FAIL_OOM E_OUTOFMEMORY /* An out of memory condition cause a failure */
  222. #define VJERR_FAIL_DRVLOAD VJERR_FAIL /* mini driver failed to load, internal error */
  223. #define VJERR_FAIL_POWER VJERR_FAIL /* the power state of the device caused a failure */
  224. /*
  225. * Driver Config flags
  226. */
  227. /*
  228. * Interface attributes (result is combination of OEM flag and VJOYD)
  229. */
  230. #define VJDF_UNIT_ID 0x00000001L /* unit id is valid */
  231. #define VJDF_ISHID 0x00000002L /* This is a HID device, so refuse polls */
  232. #define VJDF_SENDSNOTIFY 0x00000004L /* Driver calls VJOYD_DeviceUpdateNotify_Service */
  233. #define VJDF_NEWIF 0x00000080L /* use new interface (will be set by VJOYD on registration if new i/f used) */
  234. #define VJDF_USAGES 0x00000010L /* usages are valid */
  235. #define VJDF_GENERICNAME 0x00000020L /* The lpszOEMName string is generic name, not a whole string */
  236. /*
  237. * Interface requirements
  238. */
  239. #define VJDF_NONVOLATILE 0x00000100L /* This value should not be deleted on boot */
  240. /*
  241. * Devnode requirement flags
  242. */
  243. #define VJDF_NODEVNODE 0x00010000L /* does not get its resources via CFG_MGR */
  244. #define VJDF_ISANALOGPORTDRIVER 0x00020000L /* it plugs into a standard gameport */
  245. #define VJDF_NOCHAINING 0x00040000L /* one devnode per device */
  246. /*
  247. * Polling flags
  248. * These flags are passed to and from DX5 interface mini-driver poll
  249. * callbacks.
  250. * The low WORD contains flags detailing which elements are being requested
  251. * or provided; whereas the high WORD contains flags detailing the attributes
  252. * of the data.
  253. */
  254. #define JOYPD_X 0x00000001
  255. #define JOYPD_Y 0x00000002
  256. #define JOYPD_Z 0x00000004
  257. #define JOYPD_R 0x00000008
  258. #define JOYPD_U 0x00000010
  259. #define JOYPD_V 0x00000020
  260. #define JOYPD_POV0 0x00000040
  261. #define JOYPD_POV1 0x00000080
  262. #define JOYPD_POV2 0x00000100
  263. #define JOYPD_POV3 0x00000200
  264. #define JOYPD_BTN0 0x00000400
  265. #define JOYPD_BTN1 0x00000800
  266. #define JOYPD_BTN2 0x00001000
  267. #define JOYPD_BTN3 0x00002000
  268. #define JOYPD_RESERVED0 0x00004000
  269. #define JOYPD_RESERVED1 0x00008000
  270. #define JOYPD_ELEMENT_MASK 0x0000FFFF
  271. #define JOYPD_POSITION 0x00010000
  272. #define JOYPD_VELOCITY 0x00020000
  273. #define JOYPD_ACCELERATION 0x00040000
  274. #define JOYPD_FORCE 0x00080000
  275. #define JOYPD_ATTRIB_MASK 0x000F0000
  276. #define MAX_JOYSTICKOEMVXDNAME 260 /* max oem vxd name length (including NULL) */
  277. #define POV_MIN 0
  278. #define POV_MAX 1
  279. /****************************************************************************
  280. *
  281. * @doc DDK |
  282. *
  283. * @struct JOYHWCAPS |
  284. *
  285. * The <t JOYHWCAPS> structure is defined only because previous versions of
  286. * this file defined it. There is no reason this should be needed.
  287. *
  288. ****************************************************************************/
  289. typedef struct JOYHWCAPS {
  290. DWORD dwMaxButtons;
  291. DWORD dwMaxAxes;
  292. DWORD dwNumAxes;
  293. char szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
  294. } JOYHWCAPS;
  295. typedef struct JOYHWCAPS FAR *LPJOYHWCAPS;
  296. /****************************************************************************
  297. *
  298. * @doc DDK |
  299. *
  300. * @struct JOYPOLLDATA |
  301. *
  302. * The <t JOYPOLLDATA> structure is used to collect sensor data
  303. * from a DX5 mini-driver.
  304. *
  305. * @field DWORD | dwX |
  306. *
  307. * The X axis value.
  308. *
  309. * @field DWORD | dwY |
  310. *
  311. * The X axis value.
  312. *
  313. * @field DWORD | dwZ |
  314. *
  315. * The X axis value.
  316. *
  317. * @field DWORD | dwR |
  318. *
  319. * The X axis value.
  320. *
  321. * @field DWORD | dwU |
  322. *
  323. * The X axis value.
  324. *
  325. * @field DWORD | dwV |
  326. *
  327. * The X axis value.
  328. *
  329. * @field DWORD | dwPOV0 |
  330. *
  331. * The first point of view value.
  332. *
  333. * @field DWORD | dwPOV1 |
  334. *
  335. * The second point of view value.
  336. *
  337. * @field DWORD | dwPOV2 |
  338. *
  339. * The third point of view value.
  340. *
  341. * @field DWORD | dwPOV3 |
  342. *
  343. * The fourth point of view value.
  344. *
  345. * @field DWORD | dwBTN0 |
  346. *
  347. * The first DWORD of button bits. (Buttons 1 to 32 )
  348. *
  349. * @field DWORD | dwBTN1 |
  350. *
  351. * The second DWORD of button bits. (Buttons 33 to 64 )
  352. *
  353. * @field DWORD | dwBTN2 |
  354. *
  355. * The third DWORD of button bits. (Buttons 65 to 96 )
  356. *
  357. * @field DWORD | dwBTN3 |
  358. *
  359. * The fourth DWORD of button bits. (Buttons 97 to 128 )
  360. *
  361. * @field DWORD | dwReserved0 |
  362. *
  363. * The first reserved DWORD.
  364. *
  365. * @field DWORD | dwReserved1 |
  366. *
  367. * The second reserved DWORD.
  368. *
  369. *
  370. ****************************************************************************/
  371. typedef struct VJPOLLDATA {
  372. DWORD dwX;
  373. DWORD dwY;
  374. DWORD dwZ;
  375. DWORD dwR;
  376. DWORD dwU;
  377. DWORD dwV;
  378. DWORD dwPOV0;
  379. DWORD dwPOV1;
  380. DWORD dwPOV2;
  381. DWORD dwPOV3;
  382. DWORD dwBTN0;
  383. DWORD dwBTN1;
  384. DWORD dwBTN2;
  385. DWORD dwBTN3;
  386. DWORD dwReserved0;
  387. DWORD dwReserved1;
  388. } VJPOLLDATA;
  389. typedef struct VJPOLLDATA FAR *LPVJPOLLDATA;
  390. /****************************************************************************
  391. *
  392. * @doc DDK |
  393. *
  394. * @struct JOYOEMPOLLDATA |
  395. *
  396. * The <t JOYOEMPOLLDATA> structure is used to collect sensor data
  397. * from a pre-DX5 mini-driver.
  398. *
  399. * @field DWORD | id |
  400. *
  401. * The id of the joystick to be polled.
  402. *
  403. * @field DWORD | do_other |
  404. *
  405. * If the poll type is JOY_OEMPOLL_POLL1, this is the axis to be
  406. * polled.
  407. * If the poll type is JOY_OEMPOLL_POLL3, this is zero if the poll
  408. * is X,Y,Z or non-zero if the poll is X,Y,R.
  409. * If the poll type is JOY_OEMPOLL_POLL5, this is zero if the poll
  410. * is X,Y,Z,R,U or non-zero if the poll is X,Y,Z,R,V.
  411. * If the poll type is JOY_OEMPOLL_PASSDRIVERDATA poll, this DWORD
  412. * is the value set in the dwReserved2 field by the caller.
  413. * Otherwise this values is undefined and should be ignored
  414. *
  415. * @field JOYPOS | jp |
  416. *
  417. * Values to hold the X,Y,Z,R,U,V values.
  418. * Note for a JOY_OEMPOLL_POLL1 poll type the requested axis value
  419. * should always be returned in jp.dwX.
  420. *
  421. * @field DWORD | dwPOV |
  422. *
  423. * The Point Of View value if not supported through button combos
  424. * or an axis value.
  425. * Note, should be left as POV_UNDEFINED if not used.
  426. *
  427. * @field DWORD | dwButtons |
  428. *
  429. * Bitmask of the button values.
  430. *
  431. * @field DWORD | dwButtonNumber |
  432. *
  433. * The one-based bit position of the lowest numbered button pressed.
  434. * Zero if no buttons are pressed.
  435. *
  436. *
  437. ****************************************************************************/
  438. typedef struct JOYOEMPOLLDATA {
  439. DWORD id;
  440. DWORD do_other;
  441. JOYPOS jp;
  442. DWORD dwPOV;
  443. DWORD dwButtons;
  444. DWORD dwButtonNumber;
  445. } JOYOEMPOLLDATA;
  446. typedef struct JOYOEMPOLLDATA FAR *LPJOYOEMPOLLDATA;
  447. /****************************************************************************
  448. *
  449. * @doc DDK |
  450. *
  451. * @struct JOYOEMHWCAPS |
  452. *
  453. * The <t JOYOEMHWCAPS> structure is used to pass driver capabilites
  454. *
  455. * @field DWORD | dwMaxButtons |
  456. *
  457. * The number of buttons supported by the device.
  458. *
  459. * @field DWORD | dwMaxAxes |
  460. *
  461. * The highest axis supported by the device.
  462. * For example a device with X, Y and R has 3 axes but the highest
  463. * one is axis 4 so dwMaxAxes is 4.
  464. *
  465. * @field DWORD | dwNumAxes |
  466. *
  467. * The number of axes supported by the device.
  468. * For example a device with X, Y and R has 3 so dwNumAxes is 3.
  469. *
  470. *
  471. ****************************************************************************/
  472. typedef struct JOYOEMHWCAPS {
  473. DWORD dwMaxButtons;
  474. DWORD dwMaxAxes;
  475. DWORD dwNumAxes;
  476. } JOYOEMHWCAPS;
  477. typedef struct JOYOEMHWCAPS FAR *LPJOYOEMHWCAPS;
  478. /****************************************************************************
  479. *
  480. * @doc DDK |
  481. *
  482. * @struct DID_INITPARAMS |
  483. *
  484. * The <t DID_INITPARAMS> structure is used to pass details of the
  485. * joystick being initialized to a particular id in DX5 drivers.
  486. *
  487. * @field DWORD | dwSize |
  488. *
  489. * Must be set to sizeof(<t DID_INITPARAMS>)
  490. *
  491. * @field DWORD | dwFlags |
  492. *
  493. * Flags associated with the call.
  494. *
  495. * It will be either:
  496. * VJIF_BEGIN_ACCESS if the id association is being made, or
  497. * VJIF_END_ACCESS if the id association is being broken.
  498. * Other flags may be defined in the future so all other values
  499. * should be refused.
  500. *
  501. * @field DWORD | dwUnitId |
  502. *
  503. * The id for which polling support is being requested.
  504. *
  505. * @field DWORD | dwDevnode |
  506. *
  507. * The Devnode containing hardware resources to use for this id.
  508. *
  509. * @field JOYREGHWSETTINGS | hws |
  510. *
  511. * The hardware settings flags applied to this device.
  512. *
  513. *
  514. ****************************************************************************/
  515. typedef struct DID_INITPARAMS {
  516. DWORD dwSize;
  517. DWORD dwFlags;
  518. DWORD dwUnitId;
  519. DWORD dwDevnode;
  520. JOYREGHWSETTINGS hws;
  521. } DID_INITPARAMS;
  522. typedef struct DID_INITPARAMS FAR *LPDID_INITPARAMS;
  523. /*
  524. * DX1 callbacks
  525. */
  526. typedef int (__stdcall *JOYOEMPOLLRTN)( int type, LPJOYOEMPOLLDATA pojd );
  527. typedef int (__stdcall *JOYOEMHWCAPSRTN)( int joyid, LPJOYOEMHWCAPS pohwcaps );
  528. typedef int (__stdcall *JOYOEMJOYIDRTN)( int joyid, BOOL inuse );
  529. /*
  530. * General callbacks
  531. */
  532. typedef HRESULT (__stdcall *JOYPOLLRTN)( DWORD dwDeviceID, LPDWORD lpdwMask, LPVJPOLLDATA lpPollData );
  533. typedef HRESULT (__stdcall *INITIALIZERTN)( DWORD dwDeviceID, LPDID_INITPARAMS lpInitParams );
  534. typedef HRESULT (__stdcall *ESCAPERTN)( DWORD dwDeviceID, DWORD dwEffectID, LPDIEFFESCAPE lpEscape );
  535. typedef HRESULT (__stdcall *CTRLMSGRTN)( DWORD dwDeviceID, DWORD dwMsgId, DWORD dwParam );
  536. /*
  537. * Force feedback callbacks
  538. */
  539. typedef HRESULT (__stdcall *SETGAINRTN)( DWORD dwDeviceID, DWORD dwGain );
  540. typedef HRESULT (__stdcall *SENDFFCOMMANDRTN)( DWORD dwDeviceID, DWORD dwState );
  541. typedef HRESULT (__stdcall *GETFFSTATERTN)( DWORD dwDeviceID, LPDIDEVICESTATE lpDeviceState );
  542. typedef HRESULT (__stdcall *DOWNLOADEFFECTRTN)( DWORD dwDeviceID, DWORD dwInternalEffectType, LPDWORD lpdwDnloadID, LPDIEFFECT lpEffect, DWORD dwFlags );
  543. typedef HRESULT (__stdcall *DESTROYEFFECTRTN)( DWORD dwDeviceID, DWORD dwDnloadID );
  544. typedef HRESULT (__stdcall *STARTEFFECTRTN)( DWORD dwDeviceID, DWORD dwDnloadID, DWORD dwMode, DWORD dwIterations );
  545. typedef HRESULT (__stdcall *STOPEFFECTRTN)( DWORD dwDeviceID, DWORD dwDnloadID );
  546. typedef HRESULT (__stdcall *GETEFFECTSTATUSRTN)( DWORD dwDeviceID, DWORD dwDnloadID, LPDWORD lpdwStatusCode );
  547. /*
  548. * Gameport Emulation callbacks
  549. */
  550. typedef HRESULT (__stdcall *JOYOEMGPEMULCTRL)( DWORD port, DWORD inuse );
  551. typedef DWORD JOYOEMGPEMULTRAP;
  552. typedef HRESULT (__stdcall *JOYOEMGPPROVRTN)( DWORD function, DWORD dwParam );
  553. /****************************************************************************
  554. *
  555. * @doc DDK |
  556. *
  557. * @struct VJPOLLREG |
  558. *
  559. * The <t VJPOLLREG> structure is used by a mini-driver to register polling
  560. * and other general purpose callbacks with VJoyD for DX5 interface mini-
  561. * drivers.
  562. *
  563. * @field DWORD | dwSize |
  564. *
  565. * Must be set to sizeof(<t VJPOLLREG>)
  566. *
  567. * @field JOYPOLLRTN | fpPoll |
  568. *
  569. * Poll callback. Used for all device polling.
  570. *
  571. * @field CMCONFIGHANDLER | fpCfg |
  572. *
  573. * Standard configuration manager callback.
  574. *
  575. * @field INITIALIZERTN | fpInitialize |
  576. *
  577. * Initialization callback. This callback replaces and extends the JoyId
  578. * callback used with Win95 interface mini-drivers.
  579. *
  580. * @field ESCAPERTN | fpEscape |
  581. *
  582. * Escape callback. May be sent to a device in response to an application
  583. * calling the Escape member.
  584. *
  585. * @field CTRLMSGRTN | fpCtrlMsg |
  586. *
  587. * Control message callback. Used to send notifications from VJoyD to mini-
  588. * drivers.
  589. *
  590. ****************************************************************************/
  591. typedef struct VJPOLLREG {
  592. DWORD dwSize;
  593. JOYPOLLRTN fpPoll;
  594. CMCONFIGHANDLER fpCfg;
  595. INITIALIZERTN fpInitialize;
  596. ESCAPERTN fpEscape;
  597. CTRLMSGRTN fpCtrlMsg;
  598. } VJPOLLREG;
  599. typedef struct VJPOLLREG FAR *LPVJPOLLREG;
  600. /****************************************************************************
  601. *
  602. * @doc DDK |
  603. *
  604. * @struct VJFORCEREG |
  605. *
  606. * The <t VJFORCEREG> structure is used by a mini-driver to register force
  607. * feedback related callbacks with VJoyD for DX5 interface.
  608. *
  609. * @field DWORD | dwSize |
  610. *
  611. * Must be set to sizeof(<t VJFORCEREG>)
  612. *
  613. * @field SETGAINRTN | fpSetFFGain |
  614. *
  615. * Set Force Feedback Gain callback.
  616. *
  617. * @field SENDFFCOMMANDRTN | fpSendFFCommand |
  618. *
  619. * Send Force Feedback Command callback.
  620. *
  621. * @field GETFFSTATERTN | fpGetFFState |
  622. *
  623. * Get Force Feedback state callback.
  624. *
  625. * @field DOWNLOADEFFECTRTN | fpDownloadEff |
  626. *
  627. * Download effect callback.
  628. *
  629. * @field DESTROYEFFECTRTN | fpDestroyEff |
  630. *
  631. * Destroy effect callback.
  632. *
  633. * @field STARTEFFECTRTN | fpStartEff |
  634. *
  635. * Start effect callback.
  636. *
  637. * @field STOPEFFECTRTN | fpStopEff |
  638. *
  639. * Stop effect callback.
  640. *
  641. * @field GETEFFECTSTATUSRTN | fpGetStatusEff |
  642. *
  643. * Get effect status callback.
  644. *
  645. *
  646. ****************************************************************************/
  647. typedef struct VJFORCEREG {
  648. DWORD dwSize;
  649. SETGAINRTN fpSetFFGain;
  650. SENDFFCOMMANDRTN fpSendFFCommand;
  651. GETFFSTATERTN fpGetFFState;
  652. DOWNLOADEFFECTRTN fpDownloadEff;
  653. DESTROYEFFECTRTN fpDestroyEff;
  654. STARTEFFECTRTN fpStartEff;
  655. STOPEFFECTRTN fpStopEff;
  656. GETEFFECTSTATUSRTN fpGetStatusEff;
  657. } VJFORCEREG;
  658. typedef struct VJFORCEREG FAR *LPVJFORCEREG;
  659. /****************************************************************************
  660. *
  661. * @doc DDK
  662. *
  663. * @struct VJDEVICEDESC |
  664. *
  665. * The <t VJDEVICEDESC > structure is used to describe a DX5 DDI
  666. * device. This structure has been extended since DX5. See the
  667. * VJDEVICEDESC_DX5 structure for the previous version.
  668. *
  669. * @field DWORD | dwSize |
  670. *
  671. * Must be set to sizeof(<t VJDEVICEDESC>).
  672. *
  673. * @field LPSTR | lpszOEMType |
  674. *
  675. * Points to a null terminated string containing the text used to
  676. * describe the device as stored in the OEMName entry in the
  677. * registry. Renamed in Win98 (was lpszOEMName), is unused for
  678. * DX5 drivers.
  679. *
  680. * @field DWORD | dwUnitId |
  681. *
  682. * Specifies the unit id of this device.
  683. *
  684. * @field LPJOYOEMHWCAPS | lpHWCaps |
  685. *
  686. * Points to a <t JOYOEMHWCAPS> structure which contains the device
  687. * hardware capabilities.
  688. *
  689. * @field LPJOYREGHWCONFIG | lpHWConfig |
  690. *
  691. * Points to a <t JOYREGHWCONFIG> structure which contains the
  692. * configuration and calibration data for the device. Is unused for
  693. * DX5 drivers.
  694. *
  695. * @field UNICODE_STRING | FileName |
  696. *
  697. * An optional filename associated with the device. This is used for
  698. * HID devices to allow them to be accessed directly through the HID
  699. * stack without the joyGetPosEx restrictions. Added Win98.
  700. *
  701. * @field USAGE_AND_PAGE | Usages |
  702. *
  703. * An array of HID usages to describe what HID axis description has
  704. * been used for each WinMM axis. Added Win98. The elements are:
  705. *
  706. * Usages[0] - X
  707. * Usages[1] - Y
  708. * Usages[2] - Z
  709. * Usages[3] - R
  710. * Usages[4] - U
  711. * Usages[5] - V
  712. * Usages[6] - POV0
  713. * Usages[7] - POV1
  714. * Usages[8] - POV2
  715. * Usages[9] - POV3
  716. *
  717. *
  718. * @field LPSTR | lpszOEMName |
  719. *
  720. * Points to a null terminated string containing a friendly name
  721. * for the device. Added Win98.
  722. *
  723. *
  724. ****************************************************************************/
  725. typedef struct VJDEVICEDESC {
  726. DWORD dwSize;
  727. LPSTR lpszOEMType;
  728. DWORD dwUnitId;
  729. LPJOYOEMHWCAPS lpHWCaps;
  730. LPJOYREGHWCONFIG lpHWConfig;
  731. UNICODE_STRING FileName;
  732. USAGE_AND_PAGE Usages[10];
  733. LPSTR lpszOEMName;
  734. } VJDEVICEDESC ;
  735. typedef struct VJDEVICEDESC FAR *LPVJDEVICEDESC;
  736. /****************************************************************************
  737. *
  738. * @doc DDK
  739. *
  740. * @struct VJDEVICEDESC_DX5 |
  741. *
  742. * The <t VJDEVICEDESC_DX5 > structure is used to describe a DX5 DDI
  743. * device. This is the DX5 version of the structure.
  744. *
  745. * @field DWORD | dwSize |
  746. *
  747. * Must be set to sizeof(<t VJDEVICEDESC_DX5>).
  748. *
  749. * @field LPSTR | lpszOEMName |
  750. *
  751. * This field is ignored.
  752. *
  753. * @field DWORD | dwUnitId |
  754. *
  755. * Specifies the unit id of this device.
  756. *
  757. * @field LPJOYOEMHWCAPS | lpHWCaps |
  758. *
  759. * Points to a <t JOYOEMHWCAPS> structure which contains the device
  760. * hardware capabilities.
  761. *
  762. * @field LPJOYREGHWCONFIG | lpHWConfig |
  763. *
  764. * This field is unused in DX5.
  765. *
  766. *
  767. ****************************************************************************/
  768. typedef struct VJDEVICEDESC_DX5 {
  769. DWORD dwSize;
  770. LPSTR lpszOEMName;
  771. DWORD dwUnitId;
  772. LPJOYOEMHWCAPS lpHWCaps;
  773. LPJOYREGHWCONFIG lpHWConfig;
  774. } VJDEVICEDESC_DX5;
  775. typedef struct VJDEVICEDESC_DX5 FAR *LPVJDEVICEDESC_DX5;
  776. /****************************************************************************
  777. *
  778. * @doc DDK
  779. *
  780. * @struct VJREGDRVINFO |
  781. *
  782. * The <t VJREGDRVINFO > structure is used to register a DX5 DDI
  783. * driver with VJoyD.
  784. *
  785. * @field DWORD | dwSize |
  786. *
  787. * The size of the structure.
  788. *
  789. * @field DWORD | dwFunction |
  790. *
  791. * The type of registration to be performed
  792. * It must be one of the <c VJRT_*> values.
  793. *
  794. * @field DWORD | dwFlags |
  795. *
  796. * Flags associated with this registration
  797. * It consists of one or more <c VJDF_*> flag values.
  798. *
  799. * @field LPSTR | lpszOEMCallout |
  800. *
  801. * The name of the driver associated with this registration,
  802. * for example "msanalog.vxd"
  803. *
  804. * @field DWORD | dwFirmwareRevision |
  805. *
  806. * Specifies the firmware revision of the device.
  807. * If the revision is unknown a value of zero should be used.
  808. *
  809. * @field DWORD | dwHardwareRevision |
  810. *
  811. * Specifies the hardware revision of the device.
  812. * If the revision is unknown a value of zero should be used.
  813. *
  814. * @field DWORD | dwDriverVersion |
  815. *
  816. * Specifies the version number of the device driver.
  817. * If the revision is unknown a value of zero should be used.
  818. *
  819. * @field LPVJDEVICEDESC | lpDeviceDesc |
  820. *
  821. * Optional pointer to a <t VJDEVICEDESC > structure
  822. * that describes the configuration properties of the device.
  823. * This allows drivers to supply the description of the device
  824. * rather than use the registry for this purpose.
  825. * If no description is available then the field should be
  826. * set to <c NULL>.
  827. *
  828. * @field LPVJPOLLREG | lpPollReg |
  829. *
  830. * Optional pointer to a <t VJPOLLREG > structure
  831. * that contains the most common driver callbacks.
  832. * Only a very strange driver would not need to register any
  833. * of these callbacks but if that was the case, then the field
  834. * should be set to <c NULL>.
  835. *
  836. * @field LPVJFORCEREG | lpForceReg |
  837. *
  838. * Optional pointer to a <t VJFORCEREG > structure
  839. * that contains all of the force feedback specific callbacks.
  840. * If the ring 0 driver does not support force feedback then
  841. * the field should be set to <c NULL>.
  842. *
  843. * @field DWORD | dwReserved |
  844. *
  845. * Reserved, must be set to zero.
  846. *
  847. ****************************************************************************/
  848. typedef struct VJREGDRVINFO {
  849. DWORD dwSize;
  850. DWORD dwFunction;
  851. DWORD dwFlags;
  852. LPSTR lpszOEMCallout;
  853. DWORD dwFirmwareRevision;
  854. DWORD dwHardwareRevision;
  855. DWORD dwDriverVersion;
  856. LPVJDEVICEDESC lpDeviceDesc;
  857. LPVJPOLLREG lpPollReg;
  858. LPVJFORCEREG lpForceReg;
  859. DWORD dwReserved;
  860. } VJREGDRVINFO;
  861. typedef struct VJREGDRVINFO FAR *LPVJREGDRVINFO;
  862. /****************************************************************************
  863. *
  864. * @doc DDK
  865. *
  866. * @struct VJCFGCHG |
  867. *
  868. * The <t VJCFGCHG > structure is passed in the dwParam of a CtrlMsg
  869. * callback when the dwMsg type is VJCM_CONFIGCHANGED.
  870. *
  871. * @field DWORD | dwSize |
  872. *
  873. * The size of the structure.
  874. *
  875. * @field DWORD | dwChangeType |
  876. *
  877. * The type of change which has been made
  878. * It must be one of the <c VJCMCT_*> values.
  879. * Currently the only supported value is VJCMCT_GENERAL.
  880. *
  881. * @field DWORD | dwTimeOut |
  882. *
  883. * The dwTimeOut value from the user data registry values.
  884. * This value is passed as a convenience to drivers which use it as
  885. * there are no other driver values in this structure.
  886. *
  887. ****************************************************************************/
  888. typedef struct VJCFGCHG {
  889. DWORD dwSize;
  890. DWORD dwChangeType;
  891. DWORD dwTimeOut;
  892. } VJCFGCHG;
  893. typedef struct VJCFGCHG FAR *LPVJCFGCHG;
  894. /*
  895. * Control messages
  896. */
  897. #define VJCM_PASSDRIVERDATA 1 /* dwParam = DWORD to pass to driver */
  898. #define VJCM_CONFIGCHANGED 2 /* dwParam = PVJCFGCHG pointer to config changed structure */
  899. /*
  900. * Config changed types
  901. */
  902. #define VJCMCT_GENERAL 0x00010000L
  903. #define VJCMCT_CONFIG 0x00020000L
  904. #define VJCMCT_TYPEDATA 0x00030000L
  905. #define VJCMCT_OEMDEFN 0x00040000L
  906. #define VJCMCT_GLOBAL 0x00050000L
  907. /*
  908. * Masks
  909. */
  910. #define VJCMCTM_MAJORMASK 0x00ff0000L
  911. #define VJCMCTM_MINORMASK 0x0000ffffL
  912. /*
  913. * Registration types
  914. */
  915. #define VJRT_LOADED 1 /* Driver has been loaded */
  916. #define VJRT_CHANGE 2 /* NOT IMPLEMENTED! Modify anything except driver and initialization parameters */
  917. #define VJRT_PLUG 3 /* New instance of a device, New in Win98 */
  918. #define VJRT_UNPLUG 4 /* Device instance is gone, New in Win98 */
  919. /*
  920. * Driver Initialize dwFlags
  921. */
  922. #define VJIF_BEGIN_ACCESS 0x00000001L
  923. #define VJIF_END_ACCESS 0x00000002L
  924. #endif