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.

920 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_CAPS_TYPENAME 0x0C20
  294. #define IDS_GETSTAT_OK 0x0D00
  295. #define IDS_GETSTAT_NOTATTACHED 0x0D01
  296. #define IDS_GETSTAT_ERROR 0x0D02
  297. #define IDB_CHECK 1
  298. #ifndef RC_INVOKED
  299. #include <prsht.h>
  300. #include <windowsx.h>
  301. #include <ole2.h>
  302. //BUGBUG: Need to add Dx8 features to diquick
  303. //#define DIRECTINPUT_VERSION 0x700
  304. #include <dinput.h>
  305. /***************************************************************************
  306. *
  307. * Abbreviations....
  308. *
  309. * Give shorter names to things we talk about frequently.
  310. *
  311. ***************************************************************************/
  312. typedef LPUNKNOWN PUNK;
  313. typedef LPVOID PV, *PPV;
  314. typedef CONST VOID *PCV;
  315. typedef REFIID RIID;
  316. typedef const BYTE *PCBYTE;
  317. typedef const GUID *PCGUID;
  318. /*****************************************************************************
  319. *
  320. * Baggage
  321. *
  322. * Stuff I carry everywhere.
  323. *
  324. *****************************************************************************/
  325. #define INTERNAL NTAPI /* Called only within a translation unit */
  326. #define EXTERNAL NTAPI /* Called from other translation units */
  327. #define INLINE static __inline
  328. #define BEGIN_CONST_DATA data_seg(".text", "CODE")
  329. #define END_CONST_DATA data_seg(".data", "DATA")
  330. /*
  331. * Arithmetic on pointers.
  332. */
  333. #define pvSubPvCb(pv, cb) ((PV)((PBYTE)pv - (cb)))
  334. #define pvAddPvCb(pv, cb) ((PV)((PBYTE)pv + (cb)))
  335. #define cbSubPvPv(p1, p2) ((PBYTE)(p1) - (PBYTE)(p2))
  336. /*
  337. * Convert an object (X) to a count of bytes (cb).
  338. */
  339. #define cbX(X) sizeof(X)
  340. /*
  341. * Convert an array name (A) to a generic count (c).
  342. */
  343. #define cA(a) (cbX(a)/cbX(a[0]))
  344. /*
  345. * Zero an arbitrary object.
  346. */
  347. #define ZeroX(x) ZeroMemory(&(x), cbX(x))
  348. /*
  349. * land -- Logical and. Evaluate the first. If the first is zero,
  350. * then return zero. Otherwise, return the second.
  351. */
  352. #define fLandFF(f1, f2) ((f1) ? (f2) : 0)
  353. /*
  354. * lor -- Logical or. Evaluate the first. If the first is nonzero,
  355. * return it. Otherwise, return the second.
  356. *
  357. * Unfortunately, due to the *weridness* of the C language, this can
  358. * be implemented only with a GNU extension. In the non-GNU case,
  359. * we return 1 if the first is nonzero.
  360. */
  361. #if defined(__GNUC__)
  362. #define fLorFF(f1, f2) ((f1) ?: (f2))
  363. #else
  364. #define fLorFF(f1, f2) ((f1) ? 1 : (f2))
  365. #endif
  366. /*
  367. * limp - logical implication. True unless the first is nonzero and
  368. * the second is zero.
  369. */
  370. #define fLimpFF(f1, f2) (!(f1) || (f2))
  371. /*
  372. * leqv - logical equivalence. True if both are zero or both are nonzero.
  373. */
  374. #define fLeqvFF(f1, f2) (!(f1) == !(f2))
  375. /*
  376. * Words to keep preprocessor happy.
  377. */
  378. #define comma ,
  379. #define empty
  380. /*
  381. * Atomically exchange one value for another.
  382. */
  383. #define pvExchangePpvPv(ppv, pv) \
  384. (PV)InterlockedExchange((PLONG)(ppv), (LONG)(pv))
  385. /*
  386. * Creating HRESULTs from a USHORT or from a LASTERROR.
  387. */
  388. #define hresUs(us) MAKE_HRESULT(SEVERITY_SUCCESS, 0, (USHORT)(us))
  389. #define hresLe(le) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, (USHORT)(le))
  390. /*
  391. * Access the window long as a pointer.
  392. */
  393. #define GetDialogPtr(hdlg) (PVOID)GetWindowLongPtr(hdlg, DWLP_USER)
  394. #define SetDialogPtr(hdlg, pv) SetWindowLongPtr(hdlg, DWLP_USER, (LPARAM)(pv))
  395. /*
  396. * Does the fWide flag match the preferred character set?
  397. */
  398. #ifdef UNICODE
  399. #define fTchar(fWide) fWide
  400. #else
  401. #define fTchar(fWide) !(fWide)
  402. #endif
  403. /*****************************************************************************
  404. *
  405. * Globals
  406. *
  407. *****************************************************************************/
  408. extern HINSTANCE g_hinst;
  409. extern HCURSOR g_hcurWait;
  410. extern HCURSOR g_hcurStarting;
  411. extern DWORD g_dwDIVer;
  412. #ifdef DEBUG
  413. extern TCHAR g_tszInvalid[128];
  414. #endif
  415. extern DWORD g_dwEnumType;
  416. extern DWORD g_dwEnumFlags;
  417. #define SetWaitCursor() SetCursor(g_hcurWait)
  418. /*****************************************************************************
  419. *
  420. * diqary.c - Dynamic arrays
  421. *
  422. *****************************************************************************/
  423. typedef struct DARY {
  424. PV rgx;
  425. int cx;
  426. int cxMax;
  427. } DARY, *PDARY;
  428. PV INLINE
  429. Dary_GetPtrCbx(PDARY pdary, int ix, int cbX)
  430. {
  431. return pvAddPvCb(pdary->rgx, ix * cbX);
  432. }
  433. #define Dary_GetPtr(pdary, ix, X) Dary_GetPtrCbx(pdary, ix, cbX(X))
  434. int EXTERNAL Dary_AppendCbx(PDARY pdary, PCV pvX, int cbX);
  435. #define Dary_Append(pdary, pv) Dary_AppendCbx(pdary, pv, cbX(*(pv)))
  436. void INLINE
  437. Dary_Term(PDARY pdary)
  438. {
  439. if (pdary->rgx) {
  440. LocalFree(pdary->rgx);
  441. }
  442. }
  443. /*****************************************************************************
  444. *
  445. * diqchk.c
  446. *
  447. *****************************************************************************/
  448. INT_PTR EXTERNAL Checklist_Init(void);
  449. void EXTERNAL Checklist_Term(void);
  450. void EXTERNAL Checklist_OnInitDialog(HWND hwnd, BOOL fReadOnly);
  451. int EXTERNAL Checklist_AddString(HWND hwnd, UINT ids, BOOL fCheck);
  452. void EXTERNAL Checklist_InitFinish(HWND hwnd);
  453. void EXTERNAL Checklist_OnDestroy(HWND hwnd);
  454. typedef struct CHECKLISTFLAG {
  455. DWORD flMask;
  456. UINT ids;
  457. } CHECKLISTFLAG, *PCHECKLISTFLAG;
  458. void EXTERNAL Checklist_InitFlags(HWND hdlg, int idc,
  459. DWORD fl, PCHECKLISTFLAG rgclf, UINT cclf);
  460. /*****************************************************************************
  461. *
  462. * diqvlist.c
  463. *
  464. *****************************************************************************/
  465. typedef HRESULT (CALLBACK *EDITUPDATEPROC)
  466. (LPCTSTR ptszValue, PV pvRef1, PV pvRef2);
  467. typedef HRESULT (CALLBACK *PROPUPDATEPROC)
  468. (LPDIPROPHEADER pdiph, PV pvRef1, PV pvRef2);
  469. #define CCHMAXINT 64
  470. //#define Vlist_OnInitDialog(hwnd)
  471. void EXTERNAL Vlist_OnInitDialog(HWND hwndList);
  472. void EXTERNAL Vlist_AddHexValue(HWND hwnd, UINT ids, DWORD dwValue);
  473. void EXTERNAL Vlist_AddIntValue(HWND hwnd, UINT ids, DWORD dwValue);
  474. void EXTERNAL Vlist_AddBoolValue(HWND hwnd, UINT ids, DWORD dwValue);
  475. void EXTERNAL Vlist_AddValue(HWND hwnd, UINT ids, LPCTSTR ptszValue);
  476. void EXTERNAL Vlist_AddValueRW(HWND hwnd, UINT ids, LPCTSTR ptszValue,
  477. EDITUPDATEPROC Update, PV pvRef1, PV pvRef2);
  478. void EXTERNAL Vlist_AddNumValueRW(HWND hwnd, UINT ids,
  479. LPDIPROPDWORD pdipdw, int iMin, int iMax, int iRadix,
  480. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  481. void EXTERNAL
  482. Vlist_AddBoolValueRW(HWND hwnd, UINT ids, LPDIPROPDWORD pdipdw,
  483. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  484. void EXTERNAL
  485. Vlist_AddRangeValueRW(HWND hwnd, UINT ids,
  486. LPDIPROPRANGE pdiprg, int iRadix,
  487. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  488. void EXTERNAL
  489. Vlist_AddCalValueRW(HWND hwnd, UINT ids,
  490. LPDIPROPCAL pdical, int iRadix,
  491. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  492. void EXTERNAL
  493. Vlist_AddFlags(HWND hwnd, DWORD fl, PCHECKLISTFLAG rgclf, UINT cclf);
  494. void EXTERNAL Vlist_OnSelChange(HWND hwnd);
  495. void EXTERNAL Vlist_OnDestroy(HWND hwnd);
  496. /*****************************************************************************
  497. *
  498. * VLISTITEM
  499. *
  500. * This goes at the beginning of every vlist item goofy thing.
  501. *
  502. *****************************************************************************/
  503. typedef struct VLISTITEM {
  504. const struct VLISTVTBL *pvtbl;
  505. } VLISTITEM, *PVLISTITEM;
  506. /*
  507. * This is the actual VTBL.
  508. */
  509. typedef struct VLISTVTBL {
  510. /*
  511. * The dialog is about to be shown. Set the control
  512. * values accordingly.
  513. */
  514. STDMETHOD_(void, PreDisplay)(HWND, PV);
  515. /*
  516. * Destroy cleans up whatever needs to be cleaned up.
  517. * It does not free the PVLISTITEM itself; the caller
  518. * will do that.
  519. */
  520. STDMETHOD_(void, Destroy)(PV);
  521. /*
  522. * The dialog box to create.
  523. */
  524. UINT idd;
  525. DLGPROC dp;
  526. } VLISTVTBL;
  527. typedef const VLISTVTBL *PVLISTVTBL;
  528. PVLISTITEM EXTERNAL
  529. VBool_Create(LPDIPROPDWORD pdipdw, PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  530. PVLISTITEM EXTERNAL
  531. VEdit_Create(LPCTSTR ptsz, EDITUPDATEPROC Update, PV pvRef1, PV pvRef2);
  532. PVLISTITEM EXTERNAL
  533. VInt_Create(LPDIPROPDWORD pdipdw, int iMin, int iMax, int iRadix,
  534. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  535. PVLISTITEM EXTERNAL
  536. VRange_Create(LPDIPROPRANGE pdiprg, int iRadix,
  537. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  538. PVLISTITEM EXTERNAL
  539. VCal_Create(LPDIPROPCAL pdical, int iRadix,
  540. PROPUPDATEPROC Update, PV pvRef1, PV pvRef2);
  541. void EXTERNAL UpDown_SetRange(HWND hwndUD, int min, int max);
  542. void EXTERNAL UpDown_SetPos(HWND hwndUD, int iRadix, int iValue);
  543. BOOL EXTERNAL UpDown_GetPos(HWND hwndUD, LPINT pi);
  544. /*****************************************************************************
  545. *
  546. * diquick.c
  547. *
  548. *****************************************************************************/
  549. UINT EXTERNAL GetCheckedRadioButton(HWND hdlg, UINT idFirst, UINT idLast);
  550. int EXTERNAL SemimodalDialogBoxParam(UINT, HWND, DLGPROC, LPARAM);
  551. int EXTERNAL SemimodalPropertySheet(HWND hwndOwner, LPPROPSHEETHEADER ppsh);
  552. int __cdecl MessageBoxV(HWND hdlg, UINT ids, ...);
  553. int EXTERNAL ThreadFailHres(HWND hdlg, UINT ids, HRESULT hres);
  554. void EXTERNAL RecalcCursor(HWND hdlg);
  555. STDMETHODIMP CreateDI(BOOL fOle, UINT flCreate, PV ppvOut);
  556. /*
  557. * CDIFL_UNICODE must be 1 because we steal the return values from
  558. * IsDlgButtonChecked() and IsUnicodeDidc().
  559. *
  560. * If you change the values of any of these flags, make sure also to
  561. * update the table in CreateDI().
  562. */
  563. #define CDIFL_UNICODE 0x0001
  564. #define CDIFL_DI2 0x0002
  565. STDMETHODIMP GetDwordProperty(IDirectInputDevice8 *pdid, PCGUID, LPDWORD pdw);
  566. STDMETHODIMP SetDwordProperty(IDirectInputDevice8 *pdid, PCGUID, DWORD dw);
  567. typedef struct DEVDLGINFO *PDEVDLGINFO;
  568. void EXTERNAL ConvertString(BOOL, LPCVOID, LPTSTR, UINT);
  569. void EXTERNAL UnconvertString(BOOL, LPCTSTR, LPVOID, UINT);
  570. void EXTERNAL ConvertDoi(PDEVDLGINFO, LPDIDEVICEOBJECTINSTANCE, LPCVOID);
  571. HRESULT EXTERNAL GetObjectInfo(PDEVDLGINFO, LPDIDEVICEOBJECTINSTANCE,
  572. DWORD, DWORD);
  573. void EXTERNAL ConvertDdi(PDEVDLGINFO, LPDIDEVICEINSTANCE, LPCVOID);
  574. HRESULT EXTERNAL GetDeviceInfo(PDEVDLGINFO, LPDIDEVICEINSTANCE);
  575. void EXTERNAL ConvertEffi(PDEVDLGINFO, LPDIEFFECTINFO, LPCVOID);
  576. HRESULT EXTERNAL GetEffectInfo(PDEVDLGINFO, LPDIEFFECTINFO, REFGUID);
  577. void EXTERNAL StringFromGuid(LPTSTR ptsz, REFGUID rclsid);
  578. /*
  579. * Note that GUID names do not need to be localized.
  580. */
  581. typedef struct GUIDMAP {
  582. REFGUID rguid;
  583. LPCTSTR ptsz;
  584. } GUIDMAP, *PGUIDMAP;
  585. LPCTSTR EXTERNAL MapGUID(REFGUID rguid, LPTSTR ptszBuf);
  586. /*****************************************************************************
  587. *
  588. * diqmain.c
  589. *
  590. *****************************************************************************/
  591. extern GUID GUID_Uninit;
  592. INT_PTR CALLBACK Diq_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  593. /*
  594. * A worker thread has finished its startup.
  595. */
  596. #define WM_THREADSTARTED WM_APP
  597. /*
  598. * A semi-modal dialog box has exited.
  599. */
  600. #define WM_CHILDEXIT (WM_APP+1)
  601. /*
  602. * You are idle.
  603. */
  604. #define WM_SELFENTERIDLE (WM_APP+2)
  605. /*
  606. * Property used to record read-only-ness of a checklist.
  607. */
  608. #define propReadOnly MAKEINTRESOURCE(WM_APP)
  609. /*****************************************************************************
  610. *
  611. * diqcpl.c
  612. *
  613. *****************************************************************************/
  614. INT_PTR EXTERNAL Cpl_Create(HWND hdlg, BOOL fOle, UINT fl);
  615. /*****************************************************************************
  616. *
  617. * diqfind.c
  618. *
  619. *****************************************************************************/
  620. INT_PTR EXTERNAL Find_Create(HWND hdlg, BOOL fOle, UINT flCreate);
  621. /*****************************************************************************
  622. *
  623. * diqedev.c
  624. *
  625. *****************************************************************************/
  626. INT_PTR EXTERNAL DEnum_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  627. /*****************************************************************************
  628. *
  629. * diqhack.c
  630. *
  631. *****************************************************************************/
  632. INT_PTR INTERNAL Diq_HackPropertySheets(HWND hdlg);
  633. /*****************************************************************************
  634. *
  635. * diqdev.c
  636. *
  637. *****************************************************************************/
  638. INT_PTR EXTERNAL Dev_Create(HWND hdlg, BOOL fOle, UINT flCreate,
  639. PCGUID pguidInstance, LPCTSTR ptszDesc,
  640. UINT didcItf);
  641. /*****************************************************************************
  642. *
  643. * diqacq.c
  644. *
  645. * Acquisition vtbl
  646. *
  647. *****************************************************************************/
  648. typedef struct ACQVTBL {
  649. STDMETHOD(UpdateStatus)(PDEVDLGINFO pddi, LPTSTR ptszBuf);
  650. STDMETHOD(SetDataFormat)(PDEVDLGINFO pddi);
  651. STDMETHOD_(void, Destroy)(PDEVDLGINFO pddi);
  652. LPCDIDATAFORMAT pdf;
  653. } ACQVTBL, *PACQVTBL;
  654. STDMETHODIMP Common_AcqSetDataFormat(PDEVDLGINFO pddi);
  655. STDMETHODIMP_(void) Common_AcqDestroy(PDEVDLGINFO pddi);
  656. extern ACQVTBL c_acqvtblDevMouse;
  657. extern ACQVTBL c_acqvtblDevMouse2;
  658. extern ACQVTBL c_acqvtblDevKbd;
  659. extern ACQVTBL c_acqvtblDevJoy;
  660. extern ACQVTBL c_acqvtblDev;
  661. INT_PTR CALLBACK Mode_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  662. INT_PTR CALLBACK Caps_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  663. INT_PTR CALLBACK EObj_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  664. INT_PTR CALLBACK EEff_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  665. INT_PTR CALLBACK Acq_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  666. INT_PTR CALLBACK Prop_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp);
  667. #define EACH_PROPSHEET(f) \
  668. f(IDD_DEV, Mode_DlgProc), \
  669. f(IDD_CAPS, Caps_DlgProc), \
  670. f(IDD_ENUMOBJ, EObj_DlgProc), \
  671. f(IDD_ENUMEFF, EEff_DlgProc), \
  672. f(IDD_ACQ, Acq_DlgProc), \
  673. /*****************************************************************************
  674. *
  675. * Device dialog instance data
  676. *
  677. * Instance data for device dialog box.
  678. *
  679. * The first batch of information describes how the object should be
  680. * created.
  681. *
  682. * The second batch of information keeps track of the object once
  683. * we've got it.
  684. *
  685. * A pointer to this structure is the lParam of the property sheet
  686. * page.
  687. *
  688. *
  689. *****************************************************************************/
  690. typedef struct DEVDLGINFO {
  691. HWND hdlgOwner; /* Owner window */
  692. BOOL fOle; /* Should we create via OLE? */
  693. UINT flCreate; /* Flags */
  694. PCGUID pguidInstance; /* Device instance to use */
  695. LPCTSTR ptszDesc; /* Name of device */
  696. UINT didcItf; /* Interface to create on the device */
  697. PACQVTBL pvtbl;
  698. IDirectInputDevice8 *pdid; /* The thing we created */
  699. /* Updated by the Mode page */
  700. DWORD discl; /* Cooperative level */
  701. DWORD disclLastTry; /* Last cooperative level the user clicked on */
  702. BOOL fPoll; /* Use polling mode */
  703. BOOL fAbs; /* Abs or Rel mode? */
  704. /* Maintained by the Data page */
  705. HANDLE hevt; /* If in event-driven mode */
  706. BOOL fAcquired; /* Is the device acquired? */
  707. HWND hwndState; /* Handle of state control */
  708. HWND hwndData; /* Handle of data control */
  709. int celtData; /* Number of items in the data control */
  710. int celtDataMax; /* Max number of items in the data control */
  711. WNDPROC wpListbox; /* Previous listbox window procedure */
  712. /* Maintained by the AcqVtbl */
  713. LPVOID pvAcq; /* For ACQVTBL use */
  714. /* Maintained by the Effect page */
  715. DARY daryGuid; /* Array of enumerated effect GUIDs */
  716. } DEVDLGINFO;
  717. /*****************************************************************************
  718. *
  719. * diqtype.c - joystick type info
  720. *
  721. *****************************************************************************/
  722. INT_PTR EXTERNAL
  723. Type_Create(HWND hdlg, struct IDirectInputJoyConfig *pdjc, LPCWSTR pwszType);
  724. /*****************************************************************************
  725. *
  726. * diquv - joystick user values
  727. *
  728. *****************************************************************************/
  729. INT_PTR EXTERNAL
  730. Uv_Create(HWND hdlg, struct IDirectInputJoyConfig *pdjc);
  731. /*****************************************************************************
  732. *
  733. * diqeprop.c - efect properties
  734. *
  735. *****************************************************************************/
  736. INT_PTR EXTERNAL
  737. EffProp_Create(HWND hdlg, PDEVDLGINFO pddi, REFGUID rguidEff);
  738. #endif