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.

919 lines
28 KiB

  1. #define STRICT
  2. #include <windows.h>
  3. #include <commctrl.h>
  4. #ifdef DBG
  5. #define DEBUG
  6. #endif
  7. #define IDT_DATA 1 /* Timer for data acquisition */
  8. #define msData 100 /* Time interval for polled acquisition */
  9. #define IDD_MAIN 1
  10. #define IDC_MAIN_GETSTAT 16
  11. #define IDC_MAIN_CREATE 17
  12. #define IDC_MAIN_CPL 18
  13. #define IDC_MAIN_REFRESH 19
  14. #define IDC_MAIN_FIND 20
  15. #define IDC_MAIN_OLE 32
  16. #define IDC_MAIN_DI 33
  17. #define IDC_MAIN_DIA 34
  18. #define IDC_MAIN_DIW 35
  19. #define IDC_MAIN_DEVICES 36
  20. /*
  21. * The precise numerical values are important.
  22. *
  23. * Bottom bit must be set on unicode interfaces.
  24. * Dev_DoDevice assumes that the first two interfaces
  25. * are IDirectInputDeviceA and IDirectInputDeviceW, respectively.
  26. *
  27. * c_rgriid must parallel this table.
  28. */
  29. #define DIDC_MAIN_DIDA 0
  30. #define DIDC_MAIN_DIDW 1
  31. #define DIDC_MAIN_DID2A 2
  32. #define DIDC_MAIN_DID2W 3
  33. #define DIDC_MAIN_DIDJC 4
  34. #define DIDC_MAIN_ITFMAC 4
  35. #define DIDC_MAIN_ITFMAX 5
  36. /*
  37. * Warning! IsUnicodeDidc must return exactly 0 or 1
  38. * because CreateDI relies on it.
  39. */
  40. #define IsUnicodeDidc(didc) ((didc) & 1)
  41. #define IsFFDidc(didc) ((didc) == 2 || (didc) == 3)
  42. #define IDC_MAIN_ITF 48
  43. #define IDC_MAIN_DIDA (IDC_MAIN_ITF + DIDC_MAIN_DIDA)
  44. #define IDC_MAIN_DIDW (IDC_MAIN_ITF + DIDC_MAIN_DIDW)
  45. #define IDC_MAIN_DID2A (IDC_MAIN_ITF + DIDC_MAIN_DID2A)
  46. #define IDC_MAIN_DID2W (IDC_MAIN_ITF + DIDC_MAIN_DID2W)
  47. #define IDC_MAIN_DIDJC (IDC_MAIN_ITF + DIDC_MAIN_DIDJC)
  48. #define IDC_MAIN_ITFMAC (IDC_MAIN_ITF + DIDC_MAIN_ITFMAC)
  49. #define IDC_MAIN_ITFMAX (IDC_MAIN_ITF + DIDC_MAIN_ITFMAX)
  50. #define IDD_DEV 2
  51. #define IDC_DEV_PASSIVE 16
  52. #define IDC_DEV_PASSIVE_FOREGROUND 17
  53. #define IDC_DEV_ACTIVE_BACKGROUND 18
  54. #define IDC_DEV_ACTIVE 19
  55. #define IDC_DEV_NOWINKEY 31
  56. #define IDC_DEV_MOUSE 20
  57. #define IDC_DEV_KEYBOARD 21
  58. #define IDC_DEV_JOYSTICK 22
  59. #define IDC_DEV_DEVICE 23
  60. #define IDC_DEV_POLLED 24
  61. #define IDC_DEV_EVENT 25
  62. #define IDC_DEV_ABS 26
  63. #define IDC_DEV_REL 27
  64. #define IDC_DEV_CAL 28
  65. #define IDC_DEV_BUFSIZE 29
  66. #define IDC_DEV_BUFSIZEUD 30
  67. #define IDD_CAPS 3
  68. #define IDC_CAPS_LIST 16
  69. #define IDC_CAPS_VALUE 17
  70. #define IDC_CAPS_REFRESH 31
  71. #define IDC_CAPS_CPL 32
  72. #define IDD_ENUMOBJ 4
  73. #define IDC_ENUMOBJ_AXES 16
  74. #define IDC_ENUMOBJ_BUTTONS 17
  75. #define IDC_ENUMOBJ_POVS 18
  76. #define IDC_ENUMOBJ_ALL 19
  77. #define IDC_ENUMOBJ_LIST 20
  78. #define IDC_ENUMOBJ_PROP 21
  79. #define IDD_ENUMEFF 5
  80. #define IDC_ENUMEFF_LIST 16
  81. #define IDD_ACQ 6
  82. #define IDC_ACQ_STATE 16
  83. #define IDC_ACQ_DATA 17
  84. #define IDC_ACQ_UNACQ 18
  85. #define IDD_OBJPROP 16
  86. #define IDC_PROP_LIST 16
  87. #define IDC_PROP_VALUE 17
  88. #define IDC_PROP_CAL_L 30
  89. #define IDC_PROP_CAL_C 31
  90. #define IDC_PROP_CAL_H 32
  91. #define IDD_CPL 17
  92. #define IDC_CPL_CLASSES 16
  93. #define IDC_CPL_ADD 17
  94. #define IDC_CPL_TYPES 18
  95. #define IDC_CPL_CONFIGS 19
  96. #define IDC_CPL_USERVALUES 20
  97. #define IDC_CPL_ADDJOYSTICK 21
  98. #define IDC_CPL_DELJOYSTICK 22
  99. #define IDD_JOYTYPE 18
  100. #define IDC_TYPE_CHECKLIST 16
  101. #define IDC_TYPE_NUMBUTTONS 17
  102. #define IDD_JOYUV 19
  103. #define IDC_JOYUV_AXIS 16
  104. #define IDC_JOYUV_MIN 17
  105. #define IDC_JOYUV_CENTER 18
  106. #define IDC_JOYUV_MAX 19
  107. #define IDC_JOYUV_DEADZONE 20
  108. #define IDC_JOYUV_CALLOUT 21
  109. #define IDC_JOYUV_EMULATOR 22
  110. #define IDD_FIND 20
  111. #define IDC_FIND_NAME 16
  112. #define IDC_FIND_GUID 17
  113. #define IDC_FIND_FIND 18
  114. #define IDD_ENUMDEV 21
  115. /*
  116. * These must be in the same order as DIDEVTYPE_*.
  117. */
  118. #define IDC_ENUMDEV_ALL 16
  119. #define IDC_ENUMDEV_GEN 17
  120. #define IDC_ENUMDEV_MSE 18
  121. #define IDC_ENUMDEV_KBD 19
  122. #define IDC_ENUMDEV_JOY 20
  123. #define IDC_ENUMDEV_LAST 20
  124. #define IDC_ENUMDEV_ATT 32
  125. #define IDC_ENUMDEV_FF 33
  126. #define IDC_ENUMDEV_HID 34
  127. #define IDC_ENUMDEV_ALIAS 35
  128. #define IDC_ENUMDEV_PHANTOM 36
  129. #define IDD_EFFPROP 32
  130. #define IDC_EPROP_GUID 16
  131. #define IDC_EPROP_TYPE 17
  132. #define IDC_EPROP_FLAGS 18
  133. #define IDC_EPROP_STATICPARM 19
  134. #define IDC_EPROP_DYNAMICPARM 20
  135. #define IDD_VAL_BOOL 64
  136. #define IDC_VBOOL_YES 16
  137. #define IDC_VBOOL_NO 17
  138. #define IDC_VBOOL_APPLY 18
  139. #define IDD_VAL_EDIT 65
  140. #define IDC_VEDIT_EDIT 16
  141. #define IDC_VEDIT_APPLY 17
  142. #define IDD_VAL_INT 66
  143. #define IDC_VINT_EDIT 16
  144. #define IDC_VINT_UD 17
  145. #define IDC_VINT_DEC 18
  146. #define IDC_VINT_HEX 19
  147. #define IDC_VINT_APPLY 20
  148. #define IDD_VAL_RANGE 67
  149. #define IDC_VRANGE_MIN 16
  150. #define IDC_VRANGE_MINUD 17
  151. #define IDC_VRANGE_MAX 18
  152. #define IDC_VRANGE_MAXUD 19
  153. #define IDC_VRANGE_DEC 20
  154. #define IDC_VRANGE_HEX 21
  155. #define IDC_VRANGE_APPLY 22
  156. #define IDD_VAL_CAL 68
  157. #define IDC_VCAL_MIN 16
  158. #define IDC_VCAL_MINUD 17
  159. #define IDC_VCAL_CTR 18
  160. #define IDC_VCAL_CTRUD 19
  161. #define IDC_VCAL_MAX 20
  162. #define IDC_VCAL_MAXUD 21
  163. #define IDC_VCAL_DEC 22
  164. #define IDC_VCAL_HEX 23
  165. #define IDC_VCAL_APPLY 24
  166. #define IDS_ERR_CREATEOBJ 16
  167. #define IDS_ERR_COOPERATIVITY 17
  168. #define IDS_ERR_CREATEDEV 18
  169. #define IDS_ERR_SETEVENTNOT 19
  170. #define IDS_ERR_DATAFORMAT 20
  171. #define IDS_ERR_ACQUIRE 21
  172. #define IDS_ERR_BUFFERSIZE 22
  173. #define IDS_ERR_RUNCPL 23
  174. #define IDS_ERR_GETOBJINFO 24
  175. #define IDS_ERR_AXISMODE 25
  176. #define IDS_ERR_HRESULT 27
  177. #define IDS_ERR_COINIT 29
  178. #define IDS_ERR_QICONFIG 30
  179. #define IDS_ERR_ADDNEWHARDWARE 31
  180. #define IDS_ERR_CALMODE 32
  181. #define IDS_SPACEPARENHID 124
  182. #define IDS_INVALID 125
  183. #define IDS_CAPS_YES 126
  184. #define IDS_CAPS_NO 127
  185. #define IDS_TYPEARRAY 0x0100 /* 0x0100 .. 0x01FF */
  186. /*efine IDS_DEVICE_TYPEARRAY ... */
  187. #define IDS_MOUSE_TYPEARRAY 0x0300 /* 0x0300 .. 0x03FF */
  188. #define IDS_KEYBOARD_TYPEARRAY 0x0400 /* 0x0400 .. 0x04FF */
  189. #define IDS_JOYSTICK_TYPEARRAY 0x0500 /* 0x0500 .. 0x05FF */
  190. #define IDS_ATTACHED 0x0600
  191. #define IDS_POLLEDDEVICE 0x0601
  192. #define IDS_EMULATED 0x0602
  193. #define IDS_FORCEFEEDBACK 0x0603
  194. #define IDS_FFATTACK 0x0604
  195. #define IDS_FFFADE 0x0605
  196. #define IDS_SATURATION 0x0606
  197. #define IDS_POSNEGCOEFFICIENTS 0x0607
  198. #define IDS_POSNEGSATURATION 0x0608
  199. #define IDS_POLLEDDATAFORMAT 0x0609
  200. #define IDS_ALIASDEVICE 0x060A
  201. #define IDS_PHANTOMDEVICE 0x060B
  202. #define IDS_CLASS_KBD 0x0700
  203. #define IDS_CLASS_MEDIA 0x0701
  204. #define IDS_CLASS_MOUSE 0x0702
  205. #define IDS_CLASS_HID 0x0703
  206. #define IDS_HWS_HASZ 0x0800
  207. #define IDS_HWS_HASPOV 0x0801
  208. #define IDS_HWS_POVISBUTTONCOMBOS 0x0802
  209. #define IDS_HWS_POVISPOLL 0x0803
  210. #define IDS_HWS_ISYOKE 0x0804
  211. #define IDS_HWS_ISGAMEPAD 0x0805
  212. #define IDS_HWS_ISCARCTRL 0x0806
  213. #define IDS_HWS_XISJ1Y 0x0807
  214. #define IDS_HWS_XISJ2X 0x0808
  215. #define IDS_HWS_XISJ2Y 0x0809
  216. #define IDS_HWS_YISJ1X 0x080A
  217. #define IDS_HWS_YISJ2X 0x080B
  218. #define IDS_HWS_YISJ2Y 0x080C
  219. #define IDS_HWS_ZISJ1X 0x080D
  220. #define IDS_HWS_ZISJ1Y 0x080E
  221. #define IDS_HWS_ZISJ2X 0x080F
  222. #define IDS_HWS_POVISJ1X 0x0810
  223. #define IDS_HWS_POVISJ1Y 0x0811
  224. #define IDS_HWS_POVISJ2X 0x0812
  225. #define IDS_HWS_HASR 0x0813
  226. #define IDS_HWS_RISJ1X 0x0814
  227. #define IDS_HWS_RISJ1Y 0x0815
  228. #define IDS_HWS_RISJ2Y 0x0816
  229. #define IDS_HWS_HASU 0x0817
  230. #define IDS_HWS_HASV 0x0818
  231. #define IDS_EFFECT_TYPEARRAY 0x0900 /* 0x0900 .. 0x09FF */
  232. #define IDS_PROP_TYPE 0x0A00
  233. #define IDS_PROP_OFS 0x0A01
  234. #define IDS_PROP_OBJTYPE 0x0A02
  235. #define IDS_PROP_GRANULARITY 0x0A03
  236. #define IDS_PROP_FFMAXFORCE 0x0A04
  237. #define IDS_PROP_FFFORCERESOLUTION 0x0A05
  238. #define IDS_PROP_COLLECTIONNUMBER 0x0A06
  239. #define IDS_PROP_DESIGNATORINDEX 0x0A07
  240. #define IDS_PROP_USAGEPAGE 0x0A08
  241. #define IDS_PROP_USAGE 0x0A09
  242. #define IDS_PROP_FFACTUATOR 0x0A0A
  243. #define IDS_PROP_FFEFFECTTRIGGER 0x0A0B
  244. #define IDS_PROP_ASPECT 0x0A0C
  245. #define IDS_PROP_POLLED 0x0A0D
  246. #define IDS_PROP_DEADZONE 0x0A0E
  247. #define IDS_PROP_SATURATION 0x0A0F
  248. #define IDS_PROP_RANGE 0x0A10
  249. #define IDS_PROP_CALIBRATIONMODE 0x0A11
  250. #define IDS_PROP_CAL 0x0A12
  251. #define IDS_PROP_REPORTID 0x0A13
  252. #define IDS_PROP_ENABLEREPORTID 0x0A14
  253. #define IDS_PROP_SCANCODE 0x0A15
  254. #define IDS_PROP_KEYNAME 0x0A16
  255. #define IDS_PROP_ASPECTS 0x0AF0
  256. #define IDS_AXIS_MIN 0x0B00
  257. #define IDS_AXIS_X 0x0B00
  258. #define IDS_AXIS_Y 0x0B01
  259. #define IDS_AXIS_Z 0x0B02
  260. #define IDS_AXIS_R 0x0B03
  261. #define IDS_AXIS_U 0x0B04
  262. #define IDS_AXIS_V 0x0B05
  263. #define IDS_AXIS_MAX 0x0B06
  264. #define IDS_CAPS_TYPE 0x0C00
  265. #define IDS_CAPS_SUBTYPE 0x0C01
  266. #define IDS_CAPS_HID 0x0C02
  267. #define IDS_CAPS_AXES 0x0C03
  268. #define IDS_CAPS_BUTTONS 0x0C04
  269. #define IDS_CAPS_POVS 0x0C05
  270. #define IDS_CAPS_FFSAMPLEPERIOD 0x0C06
  271. #define IDS_CAPS_FFMINTIMERESOLUTION 0x0C07
  272. #define IDS_CAPS_FIRMWAREREVISION 0x0C08
  273. #define IDS_CAPS_HARDWAREREVISION 0x0C09
  274. #define IDS_CAPS_FFDRIVERVERSION 0x0C0A
  275. #define IDS_CAPS_GUIDINSTANCE 0x0C0E
  276. #define IDS_CAPS_GUIDPRODUCT 0x0C0F
  277. #define IDS_CAPS_DEVTYPE 0x0C10
  278. #define IDS_CAPS_INSTANCENAME 0x0C11
  279. #define IDS_CAPS_PRODUCTNAME 0x0C12
  280. #define IDS_CAPS_GUIDFFDRIVER 0x0C13
  281. #define IDS_CAPS_USAGEPAGE 0x0C14
  282. #define IDS_CAPS_USAGE 0x0C15
  283. #define IDS_CAPS_CLASSGUID 0x0C16
  284. #define IDS_CAPS_PATH 0x0C17
  285. #define IDS_CAPS_INSTPROP 0x0C18
  286. #define IDS_CAPS_MFGPROP 0x0C19
  287. #define IDS_CAPS_PORTNAME 0x0C1A
  288. #define IDS_CAPS_PORTID 0x0C1B
  289. #define IDS_CAPS_JOYSTICKID 0x0C1C
  290. #define IDS_CAPS_GUIDMAPPER 0x0C1D
  291. #define IDS_CAPS_VID 0x0C1E
  292. #define IDS_CAPS_PID 0x0C1F
  293. #define IDS_GETSTAT_OK 0x0D00
  294. #define IDS_GETSTAT_NOTATTACHED 0x0D01
  295. #define IDS_GETSTAT_ERROR 0x0D02
  296. #define IDB_CHECK 1
  297. #ifndef RC_INVOKED
  298. #include <prsht.h>
  299. #include <windowsx.h>
  300. #include <ole2.h>
  301. #define DIRECTINPUT_VERSION 0x700
  302. #include <dinput.h>
  303. /***************************************************************************
  304. *
  305. * Abbreviations....
  306. *
  307. * Give shorter names to things we talk about frequently.
  308. *
  309. ***************************************************************************/
  310. typedef LPUNKNOWN PUNK;
  311. typedef LPVOID PV, *PPV;
  312. typedef CONST VOID *PCV;
  313. typedef REFIID RIID;
  314. typedef const BYTE *PCBYTE;
  315. typedef const GUID *PCGUID;
  316. /*****************************************************************************
  317. *
  318. * Baggage
  319. *
  320. * Stuff I carry everywhere.
  321. *
  322. *****************************************************************************/
  323. #define INTERNAL NTAPI /* Called only within a translation unit */
  324. #define EXTERNAL NTAPI /* Called from other translation units */
  325. #define INLINE static __inline
  326. #define BEGIN_CONST_DATA data_seg(".text", "CODE")
  327. #define END_CONST_DATA data_seg(".data", "DATA")
  328. /*
  329. * Arithmetic on pointers.
  330. */
  331. #define pvSubPvCb(pv, cb) ((PV)((PBYTE)pv - (cb)))
  332. #define pvAddPvCb(pv, cb) ((PV)((PBYTE)pv + (cb)))
  333. #define cbSubPvPv(p1, p2) ((PBYTE)(p1) - (PBYTE)(p2))
  334. /*
  335. * Convert an object (X) to a count of bytes (cb).
  336. */
  337. #define cbX(X) sizeof(X)
  338. /*
  339. * Convert an array name (A) to a generic count (c).
  340. */
  341. #define cA(a) (cbX(a)/cbX(a[0]))
  342. /*
  343. * Zero an arbitrary object.
  344. */
  345. #define ZeroX(x) ZeroMemory(&(x), cbX(x))
  346. /*
  347. * land -- Logical and. Evaluate the first. If the first is zero,
  348. * then return zero. Otherwise, return the second.
  349. */
  350. #define fLandFF(f1, f2) ((f1) ? (f2) : 0)
  351. /*
  352. * lor -- Logical or. Evaluate the first. If the first is nonzero,
  353. * return it. Otherwise, return the second.
  354. *
  355. * Unfortunately, due to the *weirdness* of the C language, this can
  356. * be implemented only with a GNU extension. In the non-GNU case,
  357. * we return 1 if the first is nonzero.
  358. */
  359. #if defined(__GNUC__)
  360. #define fLorFF(f1, f2) ((f1) ?: (f2))
  361. #else
  362. #define fLorFF(f1, f2) ((f1) ? 1 : (f2))
  363. #endif
  364. /*
  365. * limp - logical implication. True unless the first is nonzero and
  366. * the second is zero.
  367. */
  368. #define fLimpFF(f1, f2) (!(f1) || (f2))
  369. /*
  370. * leqv - logical equivalence. True if both are zero or both are nonzero.
  371. */
  372. #define fLeqvFF(f1, f2) (!(f1) == !(f2))
  373. /*
  374. * Words to keep preprocessor happy.
  375. */
  376. #define comma ,
  377. #define empty
  378. /*
  379. * Atomically exchange one value for another.
  380. */
  381. #define pvExchangePpvPv(ppv, pv) \
  382. (PV)InterlockedExchange((PLONG)(ppv), (LONG)(pv))
  383. /*
  384. * Creating HRESULTs from a USHORT or from a LASTERROR.
  385. */
  386. #define hresUs(us) MAKE_HRESULT(SEVERITY_SUCCESS, 0, (USHORT)(us))
  387. #define hresLe(le) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, (USHORT)(le))
  388. /*
  389. * Access the window long as a pointer.
  390. */
  391. #define GetDialogPtr(hdlg) (PVOID)GetWindowLongPtr(hdlg, DWLP_USER)
  392. #define SetDialogPtr(hdlg, pv) SetWindowLongPtr(hdlg, DWLP_USER, (LPARAM)(pv))
  393. /*
  394. * Does the fWide flag match the preferred character set?
  395. */
  396. #ifdef UNICODE
  397. #define fTchar(fWide) fWide
  398. #else
  399. #define fTchar(fWide) !(fWide)
  400. #endif
  401. /*****************************************************************************
  402. *
  403. * Globals
  404. *
  405. *****************************************************************************/
  406. extern HINSTANCE g_hinst;
  407. extern HCURSOR g_hcurWait;
  408. extern HCURSOR g_hcurStarting;
  409. extern DWORD g_dwDIVer;
  410. #ifdef DEBUG
  411. extern TCHAR g_tszInvalid[128];
  412. #endif
  413. extern DWORD g_dwEnumType;
  414. extern DWORD g_dwEnumFlags;
  415. #define SetWaitCursor() SetCursor(g_hcurWait)
  416. /*****************************************************************************
  417. *
  418. * diqary.c - Dynamic arrays
  419. *
  420. *****************************************************************************/
  421. typedef struct DARY {
  422. PV rgx;
  423. int cx;
  424. int cxMax;
  425. } DARY, *PDARY;
  426. PV INLINE
  427. Dary_GetPtrCbx(PDARY pdary, int ix, int cbX)
  428. {
  429. return pvAddPvCb(pdary->rgx, ix * cbX);
  430. }
  431. #define Dary_GetPtr(pdary, ix, X) Dary_GetPtrCbx(pdary, ix, cbX(X))
  432. int EXTERNAL Dary_AppendCbx(PDARY pdary, PCV pvX, int cbX);
  433. #define Dary_Append(pdary, pv) Dary_AppendCbx(pdary, pv, cbX(*(pv)))
  434. void INLINE
  435. Dary_Term(PDARY pdary)
  436. {
  437. if (pdary->rgx) {
  438. LocalFree(pdary->rgx);
  439. }
  440. }
  441. /*****************************************************************************
  442. *
  443. * diqchk.c
  444. *
  445. *****************************************************************************/
  446. INT_PTR EXTERNAL Checklist_Init(void);
  447. void EXTERNAL Checklist_Term(void);
  448. void EXTERNAL Checklist_OnInitDialog(HWND hwnd, BOOL fReadOnly);
  449. int EXTERNAL Checklist_AddString(HWND hwnd, UINT ids, BOOL fCheck);
  450. void EXTERNAL Checklist_InitFinish(HWND hwnd);
  451. void EXTERNAL Checklist_OnDestroy(HWND hwnd);
  452. typedef struct CHECKLISTFLAG {
  453. DWORD flMask;
  454. UINT ids;
  455. } CHECKLISTFLAG, *PCHECKLISTFLAG;
  456. void EXTERNAL Checklist_InitFlags(HWND hdlg, int idc,
  457. DWORD fl, PCHECKLISTFLAG rgclf, UINT cclf);
  458. /*****************************************************************************
  459. *
  460. * diqvlist.c
  461. *
  462. *****************************************************************************/
  463. typedef HRESULT (CALLBACK *EDITUPDATEPROC)
  464. (LPCTSTR ptszValue, PV pvRef1, PV pvRef2);
  465. typedef HRESULT (CALLBACK *PROPUPDATEPROC)
  466. (LPDIPROPHEADER pdiph, PV pvRef1, PV pvRef2);
  467. #define CCHMAXINT 64
  468. //#define Vlist_OnInitDialog(hwnd)
  469. void EXTERNAL Vlist_OnInitDialog(HWND hwndList);
  470. void EXTERNAL Vlist_AddHexValue(HWND hwnd, UINT ids, DWORD dwValue);
  471. void EXTERNAL Vlist_AddIntValue(HWND hwnd, UINT ids, DWORD dwValue);
  472. void EXTERNAL Vlist_AddBoolValue(HWND hwnd, UINT ids, DWORD dwValue);
  473. void EXTERNAL Vlist_AddValue(HWND hwnd, UINT ids, LPCTSTR ptszValue);
  474. void EXTERNAL Vlist_AddValueRW(HWND hwnd, UINT ids, LPCTSTR ptszValue,
  475. EDITUPDATEPROC Update, PV pvRef1, PV pvRef2);
  476. void EXTERNAL Vlist_AddNumValueRW(HWND hwnd, UINT ids,
  477. LPDIPROPDWORD pdipdw, int iMin, int iMax, int iRadix,
  478. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  479. void EXTERNAL
  480. Vlist_AddBoolValueRW(HWND hwnd, UINT ids, LPDIPROPDWORD pdipdw,
  481. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  482. void EXTERNAL
  483. Vlist_AddRangeValueRW(HWND hwnd, UINT ids,
  484. LPDIPROPRANGE pdiprg, int iRadix,
  485. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  486. void EXTERNAL
  487. Vlist_AddCalValueRW(HWND hwnd, UINT ids,
  488. LPDIPROPCAL pdical, int iRadix,
  489. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  490. void EXTERNAL
  491. Vlist_AddFlags(HWND hwnd, DWORD fl, PCHECKLISTFLAG rgclf, UINT cclf);
  492. void EXTERNAL Vlist_OnSelChange(HWND hwnd);
  493. void EXTERNAL Vlist_OnDestroy(HWND hwnd);
  494. /*****************************************************************************
  495. *
  496. * VLISTITEM
  497. *
  498. * This goes at the beginning of every vlist item goofy thing.
  499. *
  500. *****************************************************************************/
  501. typedef struct VLISTITEM {
  502. const struct VLISTVTBL *pvtbl;
  503. } VLISTITEM, *PVLISTITEM;
  504. /*
  505. * This is the actual VTBL.
  506. */
  507. typedef struct VLISTVTBL {
  508. /*
  509. * The dialog is about to be shown. Set the control
  510. * values accordingly.
  511. */
  512. STDMETHOD_(void, PreDisplay)(HWND, PV);
  513. /*
  514. * Destroy cleans up whatever needs to be cleaned up.
  515. * It does not free the PVLISTITEM itself; the caller
  516. * will do that.
  517. */
  518. STDMETHOD_(void, Destroy)(PV);
  519. /*
  520. * The dialog box to create.
  521. */
  522. UINT idd;
  523. DLGPROC dp;
  524. } VLISTVTBL;
  525. typedef const VLISTVTBL *PVLISTVTBL;
  526. PVLISTITEM EXTERNAL
  527. VBool_Create(LPDIPROPDWORD pdipdw, PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  528. PVLISTITEM EXTERNAL
  529. VEdit_Create(LPCTSTR ptsz, EDITUPDATEPROC Update, PV pvRef1, PV pvRef2);
  530. PVLISTITEM EXTERNAL
  531. VInt_Create(LPDIPROPDWORD pdipdw, int iMin, int iMax, int iRadix,
  532. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  533. PVLISTITEM EXTERNAL
  534. VRange_Create(LPDIPROPRANGE pdiprg, int iRadix,
  535. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  536. PVLISTITEM EXTERNAL
  537. VCal_Create(LPDIPROPCAL pdical, int iRadix,
  538. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  539. void EXTERNAL UpDown_SetRange(HWND hwndUD, int min, int max);
  540. void EXTERNAL UpDown_SetPos(HWND hwndUD, int iRadix, int iValue);
  541. BOOL EXTERNAL UpDown_GetPos(HWND hwndUD, LPINT pi);
  542. /*****************************************************************************
  543. *
  544. * diquick.c
  545. *
  546. *****************************************************************************/
  547. UINT EXTERNAL GetCheckedRadioButton(HWND hdlg, UINT idFirst, UINT idLast);
  548. int EXTERNAL SemimodalDialogBoxParam(UINT, HWND, DLGPROC, LPARAM);
  549. int EXTERNAL SemimodalPropertySheet(HWND hwndOwner, LPPROPSHEETHEADER ppsh);
  550. int __cdecl MessageBoxV(HWND hdlg, UINT ids, ...);
  551. int EXTERNAL ThreadFailHres(HWND hdlg, UINT ids, HRESULT hres);
  552. void EXTERNAL RecalcCursor(HWND hdlg);
  553. STDMETHODIMP CreateDI(BOOL fOle, UINT flCreate, PV ppvOut);
  554. /*
  555. * CDIFL_UNICODE must be 1 because we steal the return values from
  556. * IsDlgButtonChecked() and IsUnicodeDidc().
  557. *
  558. * If you change the values of any of these flags, make sure also to
  559. * update the table in CreateDI().
  560. */
  561. #define CDIFL_UNICODE 0x0001
  562. #define CDIFL_DI2 0x0002
  563. STDMETHODIMP GetDwordProperty(IDirectInputDevice *pdid, PCGUID, LPDWORD pdw);
  564. STDMETHODIMP SetDwordProperty(IDirectInputDevice *pdid, PCGUID, DWORD dw);
  565. typedef struct DEVDLGINFO *PDEVDLGINFO;
  566. void EXTERNAL ConvertString(BOOL, LPCVOID, LPTSTR, UINT);
  567. void EXTERNAL UnconvertString(BOOL, LPCTSTR, LPVOID, UINT);
  568. void EXTERNAL ConvertDoi(PDEVDLGINFO, LPDIDEVICEOBJECTINSTANCE, LPCVOID);
  569. HRESULT EXTERNAL GetObjectInfo(PDEVDLGINFO, LPDIDEVICEOBJECTINSTANCE,
  570. DWORD, DWORD);
  571. void EXTERNAL ConvertDdi(PDEVDLGINFO, LPDIDEVICEINSTANCE, LPCVOID);
  572. HRESULT EXTERNAL GetDeviceInfo(PDEVDLGINFO, LPDIDEVICEINSTANCE);
  573. void EXTERNAL ConvertEffi(PDEVDLGINFO, LPDIEFFECTINFO, LPCVOID);
  574. HRESULT EXTERNAL GetEffectInfo(PDEVDLGINFO, LPDIEFFECTINFO, REFGUID);
  575. void EXTERNAL StringFromGuid(LPTSTR ptsz, REFGUID rclsid);
  576. /*
  577. * Note that GUID names do not need to be localized.
  578. */
  579. typedef struct GUIDMAP {
  580. REFGUID rguid;
  581. LPCTSTR ptsz;
  582. } GUIDMAP, *PGUIDMAP;
  583. LPCTSTR EXTERNAL MapGUID(REFGUID rguid, LPTSTR ptszBuf);
  584. /*****************************************************************************
  585. *
  586. * diqmain.c
  587. *
  588. *****************************************************************************/
  589. extern GUID GUID_Uninit;
  590. INT_PTR CALLBACK Diq_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  591. /*
  592. * A worker thread has finished its startup.
  593. */
  594. #define WM_THREADSTARTED WM_APP
  595. /*
  596. * A semi-modal dialog box has exited.
  597. */
  598. #define WM_CHILDEXIT (WM_APP+1)
  599. /*
  600. * You are idle.
  601. */
  602. #define WM_SELFENTERIDLE (WM_APP+2)
  603. /*
  604. * Property used to record read-only-ness of a checklist.
  605. */
  606. #define propReadOnly MAKEINTRESOURCE(WM_APP)
  607. /*****************************************************************************
  608. *
  609. * diqcpl.c
  610. *
  611. *****************************************************************************/
  612. INT_PTR EXTERNAL Cpl_Create(HWND hdlg, BOOL fOle, UINT fl);
  613. /*****************************************************************************
  614. *
  615. * diqfind.c
  616. *
  617. *****************************************************************************/
  618. INT_PTR EXTERNAL Find_Create(HWND hdlg, BOOL fOle, UINT flCreate);
  619. /*****************************************************************************
  620. *
  621. * diqedev.c
  622. *
  623. *****************************************************************************/
  624. INT_PTR EXTERNAL DEnum_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  625. /*****************************************************************************
  626. *
  627. * diqhack.c
  628. *
  629. *****************************************************************************/
  630. INT_PTR INTERNAL Diq_HackPropertySheets(HWND hdlg);
  631. /*****************************************************************************
  632. *
  633. * diqdev.c
  634. *
  635. *****************************************************************************/
  636. INT_PTR EXTERNAL Dev_Create(HWND hdlg, BOOL fOle, UINT flCreate,
  637. PCGUID pguidInstance, LPCTSTR ptszDesc,
  638. UINT didcItf);
  639. /*****************************************************************************
  640. *
  641. * diqacq.c
  642. *
  643. * Acquisition vtbl
  644. *
  645. *****************************************************************************/
  646. typedef struct ACQVTBL {
  647. STDMETHOD(UpdateStatus)(PDEVDLGINFO pddi, LPTSTR ptszBuf);
  648. STDMETHOD(SetDataFormat)(PDEVDLGINFO pddi);
  649. STDMETHOD_(void, Destroy)(PDEVDLGINFO pddi);
  650. LPCDIDATAFORMAT pdf;
  651. } ACQVTBL, *PACQVTBL;
  652. STDMETHODIMP Common_AcqSetDataFormat(PDEVDLGINFO pddi);
  653. STDMETHODIMP_(void) Common_AcqDestroy(PDEVDLGINFO pddi);
  654. extern ACQVTBL c_acqvtblDevMouse;
  655. extern ACQVTBL c_acqvtblDevMouse2;
  656. extern ACQVTBL c_acqvtblDevKbd;
  657. extern ACQVTBL c_acqvtblDevJoy;
  658. extern ACQVTBL c_acqvtblDev;
  659. INT_PTR CALLBACK Mode_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  660. INT_PTR CALLBACK Caps_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  661. INT_PTR CALLBACK EObj_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  662. INT_PTR CALLBACK EEff_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  663. INT_PTR CALLBACK Acq_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  664. INT_PTR CALLBACK Prop_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  665. #define EACH_PROPSHEET(f) \
  666. f(IDD_DEV, Mode_DlgProc), \
  667. f(IDD_CAPS, Caps_DlgProc), \
  668. f(IDD_ENUMOBJ, EObj_DlgProc), \
  669. f(IDD_ENUMEFF, EEff_DlgProc), \
  670. f(IDD_ACQ, Acq_DlgProc), \
  671. /*****************************************************************************
  672. *
  673. * Device dialog instance data
  674. *
  675. * Instance data for device dialog box.
  676. *
  677. * The first batch of information describes how the object should be
  678. * created.
  679. *
  680. * The second batch of information keeps track of the object once
  681. * we've got it.
  682. *
  683. * A pointer to this structure is the lParam of the property sheet
  684. * page.
  685. *
  686. *
  687. *****************************************************************************/
  688. typedef struct DEVDLGINFO {
  689. HWND hdlgOwner; /* Owner window */
  690. BOOL fOle; /* Should we create via OLE? */
  691. UINT flCreate; /* Flags */
  692. PCGUID pguidInstance; /* Device instance to use */
  693. LPCTSTR ptszDesc; /* Name of device */
  694. UINT didcItf; /* Interface to create on the device */
  695. PACQVTBL pvtbl;
  696. IDirectInputDevice *pdid; /* The thing we created */
  697. IDirectInputDevice2 *pdid2; /* If DX5 */
  698. /* Updated by the Mode page */
  699. DWORD discl; /* Cooperative level */
  700. DWORD disclLastTry; /* Last cooperative level the user clicked on */
  701. BOOL fPoll; /* Use polling mode */
  702. BOOL fAbs; /* Abs or Rel mode? */
  703. /* Maintained by the Data page */
  704. HANDLE hevt; /* If in event-driven mode */
  705. BOOL fAcquired; /* Is the device acquired? */
  706. HWND hwndState; /* Handle of state control */
  707. HWND hwndData; /* Handle of data control */
  708. int celtData; /* Number of items in the data control */
  709. int celtDataMax; /* Max number of items in the data control */
  710. WNDPROC wpListbox; /* Previous listbox window procedure */
  711. /* Maintained by the AcqVtbl */
  712. LPVOID pvAcq; /* For ACQVTBL use */
  713. /* Maintained by the Effect page */
  714. DARY daryGuid; /* Array of enumerated effect GUIDs */
  715. } DEVDLGINFO;
  716. /*****************************************************************************
  717. *
  718. * diqtype.c - joystick type info
  719. *
  720. *****************************************************************************/
  721. INT_PTR EXTERNAL
  722. Type_Create(HWND hdlg, struct IDirectInputJoyConfig *pdjc, LPCWSTR pwszType);
  723. /*****************************************************************************
  724. *
  725. * diquv - joystick user values
  726. *
  727. *****************************************************************************/
  728. INT_PTR EXTERNAL
  729. Uv_Create(HWND hdlg, struct IDirectInputJoyConfig *pdjc);
  730. /*****************************************************************************
  731. *
  732. * diqeprop.c - efect properties
  733. *
  734. *****************************************************************************/
  735. INT_PTR EXTERNAL
  736. EffProp_Create(HWND hdlg, PDEVDLGINFO pddi, REFGUID rguidEff);
  737. #endif