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.

1645 lines
36 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
  5. // TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR
  6. // A PARTICULAR PURPOSE.
  7. //
  8. // Copyright (C) 1993 - 1997 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. // lowlevel.c
  13. //
  14. // Description:
  15. //
  16. //
  17. // History:
  18. // 5/16/93
  19. //
  20. //==========================================================================;
  21. #include <windows.h>
  22. #include <windowsx.h>
  23. #include <mmsystem.h>
  24. #include <mmddk.h>
  25. //#include "msmixmgr.h"
  26. #include "appport.h"
  27. #include "mmcaps.h"
  28. #include "debug.h"
  29. //
  30. //
  31. //
  32. TCHAR gszDeviceFormatTitle[] = TEXT("Type\t8!Index\t5!Version\t7!Product Name");
  33. TCHAR gszDeviceFormatList[] = TEXT("%-9s\t%d\t%u.%.02u\t%-32s");
  34. //
  35. //
  36. //
  37. //
  38. TCHAR gszBogusCaps[] = TEXT("????");
  39. TCHAR gszTimerDevice[] = TEXT("Internal PC Timer");
  40. TCHAR gszDefaultMapper[] = TEXT("Default Mapper");
  41. #define MMCAPS_DEVTYPE_UNKNOWN 0
  42. #define MMCAPS_DEVTYPE_AUXILIARY 1
  43. #define MMCAPS_DEVTYPE_JOYSTICK 2
  44. #define MMCAPS_DEVTYPE_MIDIIN 3
  45. #define MMCAPS_DEVTYPE_MIDIOUT 4
  46. #define MMCAPS_DEVTYPE_MIXER 5
  47. #define MMCAPS_DEVTYPE_TIMER 6
  48. #define MMCAPS_DEVTYPE_WAVEIN 7
  49. #define MMCAPS_DEVTYPE_WAVEOUT 8
  50. PTSTR gaszDeviceType[] =
  51. {
  52. gszUnknown,
  53. TEXT("Auxiliary"),
  54. TEXT("Joystick"),
  55. TEXT("MIDI In"),
  56. TEXT("MIDI Out"),
  57. TEXT("Mixer"),
  58. TEXT("Timer"),
  59. TEXT("Wave In"),
  60. TEXT("Wave Out")
  61. };
  62. //
  63. // AUXCAPS
  64. //
  65. //
  66. //
  67. PTSTR gaszAuxCapsTechnology[] =
  68. {
  69. gszNotSpecified, //
  70. TEXT("CD-Audio"), // AUXCAPS_CDAUDIO
  71. TEXT("Auxiliary Input") // AUXCAPS_AUXIN
  72. };
  73. #define AUXCAPS_TECHNOLOGY_LAST AUXCAPS_AUXIN
  74. PTSTR gaszAuxCapsSupport[32] =
  75. {
  76. TEXT("Volume"), // Bit 0 AUXCAPS_VOLUME
  77. TEXT("L/R Volume"), // Bit 1 AUXCAPS_LRVOLUME
  78. NULL, // Bit 2
  79. NULL, // Bit 3
  80. NULL, // Bit 4
  81. NULL, // Bit 5
  82. NULL, // Bit 6
  83. NULL, // Bit 7
  84. NULL, // Bit 8
  85. NULL, // Bit 9
  86. NULL, // Bit 10
  87. NULL, // Bit 11
  88. NULL, // Bit 12
  89. NULL, // Bit 13
  90. NULL, // Bit 14
  91. NULL, // Bit 15
  92. NULL, // Bit 16
  93. NULL, // Bit 17
  94. NULL, // Bit 18
  95. NULL, // Bit 19
  96. NULL, // Bit 20
  97. NULL, // Bit 21
  98. NULL, // Bit 22
  99. NULL, // Bit 23
  100. NULL, // Bit 24
  101. NULL, // Bit 25
  102. NULL, // Bit 26
  103. NULL, // Bit 27
  104. NULL, // Bit 28
  105. NULL, // Bit 29
  106. NULL, // Bit 30
  107. NULL // Bit 31
  108. };
  109. //
  110. // MIDI[IN|OUT]CAPS
  111. //
  112. //
  113. //
  114. PTSTR gaszMidiOutCapsTechnology[] =
  115. {
  116. gszNotSpecified,
  117. TEXT("MIDI Port"), // MOD_MIDIPORT
  118. TEXT("Internal Synth"), // MOD_SYNTH
  119. TEXT("Internal Square Wave Synth"), // MOD_SQSYNTH
  120. TEXT("Internal FM Synth"), // MOD_FMSYNTH
  121. TEXT("MIDI Mapper") // MOD_MAPPER
  122. };
  123. #define MIDIOUTCAPS_TECHNOLOGY_LAST MOD_MAPPER
  124. PTSTR gaszMidiOutCapsSupport[32] =
  125. {
  126. TEXT("Volume"), // Bit 0 MIDICAPS_VOLUME
  127. TEXT("L/R Volume"), // Bit 1 MIDICAPS_LRVOLUME
  128. TEXT("Patch Caching"), // Bit 2 MIDICAPS_CACHE
  129. TEXT("Poly Message"), // Bit 3 MIDICAPS_POLYMSG (Win 4)
  130. NULL, // Bit 4
  131. NULL, // Bit 5
  132. NULL, // Bit 6
  133. NULL, // Bit 7
  134. NULL, // Bit 8
  135. NULL, // Bit 9
  136. NULL, // Bit 10
  137. NULL, // Bit 11
  138. NULL, // Bit 12
  139. NULL, // Bit 13
  140. NULL, // Bit 14
  141. NULL, // Bit 15
  142. NULL, // Bit 16
  143. NULL, // Bit 17
  144. NULL, // Bit 18
  145. NULL, // Bit 19
  146. NULL, // Bit 20
  147. NULL, // Bit 21
  148. NULL, // Bit 22
  149. NULL, // Bit 23
  150. NULL, // Bit 24
  151. NULL, // Bit 25
  152. NULL, // Bit 26
  153. NULL, // Bit 27
  154. NULL, // Bit 28
  155. NULL, // Bit 29
  156. NULL, // Bit 30
  157. NULL // Bit 31
  158. };
  159. //
  160. // MIXERCAPS
  161. //
  162. //
  163. //
  164. PTSTR gaszMixerCapsSupport[32] =
  165. {
  166. NULL, // Bit 0
  167. NULL, // Bit 1
  168. NULL, // Bit 2
  169. NULL, // Bit 3
  170. NULL, // Bit 4
  171. NULL, // Bit 5
  172. NULL, // Bit 6
  173. NULL, // Bit 7
  174. NULL, // Bit 8
  175. NULL, // Bit 9
  176. NULL, // Bit 10
  177. NULL, // Bit 11
  178. NULL, // Bit 12
  179. NULL, // Bit 13
  180. NULL, // Bit 14
  181. NULL, // Bit 15
  182. NULL, // Bit 16
  183. NULL, // Bit 17
  184. NULL, // Bit 18
  185. NULL, // Bit 19
  186. NULL, // Bit 20
  187. NULL, // Bit 21
  188. NULL, // Bit 22
  189. NULL, // Bit 23
  190. NULL, // Bit 24
  191. NULL, // Bit 25
  192. NULL, // Bit 26
  193. NULL, // Bit 27
  194. NULL, // Bit 28
  195. NULL, // Bit 29
  196. NULL, // Bit 30
  197. NULL // Bit 31
  198. };
  199. //
  200. // WAVE[IN|OUT]CAPS
  201. //
  202. //
  203. //
  204. PTSTR gaszWaveInOutCapsFormats[32] =
  205. {
  206. TEXT("8M11"), // Bit 0 WAVE_FORMAT_1M08
  207. TEXT("8S11"), // Bit 1 WAVE_FORMAT_1S08
  208. TEXT("16M11"), // Bit 2 WAVE_FORMAT_1M16
  209. TEXT("16S11"), // Bit 3 WAVE_FORMAT_1S16
  210. TEXT("8M22"), // Bit 4 WAVE_FORMAT_2M08
  211. TEXT("8S22"), // Bit 5 WAVE_FORMAT_2S08
  212. TEXT("16M22"), // Bit 6 WAVE_FORMAT_2M16
  213. TEXT("16S22"), // Bit 7 WAVE_FORMAT_2S16
  214. TEXT("8M44"), // Bit 8 WAVE_FORMAT_4M08
  215. TEXT("8S44"), // Bit 9 WAVE_FORMAT_4S08
  216. TEXT("16M44"), // Bit 10 WAVE_FORMAT_4M16
  217. TEXT("16S44"), // Bit 11 WAVE_FORMAT_4S16
  218. NULL, // Bit 12
  219. NULL, // Bit 13
  220. NULL, // Bit 14
  221. NULL, // Bit 15
  222. NULL, // Bit 16
  223. NULL, // Bit 17
  224. NULL, // Bit 18
  225. NULL, // Bit 19
  226. NULL, // Bit 20
  227. NULL, // Bit 21
  228. NULL, // Bit 22
  229. NULL, // Bit 23
  230. NULL, // Bit 24
  231. NULL, // Bit 25
  232. NULL, // Bit 26
  233. NULL, // Bit 27
  234. NULL, // Bit 28
  235. NULL, // Bit 29
  236. NULL, // Bit 30
  237. NULL // Bit 31
  238. };
  239. PTSTR gaszWaveOutCapsSupport[32] =
  240. {
  241. TEXT("Pitch"), // Bit 0 WAVECAPS_PITCH
  242. TEXT("Playback Rate"), // Bit 1 WAVECAPS_PLAYBACKRATE
  243. TEXT("Volume"), // Bit 2 WAVECAPS_VOLUME
  244. TEXT("L/R Volume"), // Bit 3 WAVECAPS_LRVOLUME
  245. TEXT("Sync"), // Bit 4 WAVECAPS_SYNC
  246. NULL, // Bit 5
  247. NULL, // Bit 6
  248. NULL, // Bit 7
  249. NULL, // Bit 8
  250. NULL, // Bit 9
  251. NULL, // Bit 10
  252. NULL, // Bit 11
  253. NULL, // Bit 12
  254. NULL, // Bit 13
  255. NULL, // Bit 14
  256. NULL, // Bit 15
  257. NULL, // Bit 16
  258. NULL, // Bit 17
  259. NULL, // Bit 18
  260. NULL, // Bit 19
  261. NULL, // Bit 20
  262. NULL, // Bit 21
  263. NULL, // Bit 22
  264. NULL, // Bit 23
  265. NULL, // Bit 24
  266. NULL, // Bit 25
  267. NULL, // Bit 26
  268. NULL, // Bit 27
  269. NULL, // Bit 28
  270. NULL, // Bit 29
  271. NULL, // Bit 30
  272. NULL // Bit 31
  273. };
  274. //==========================================================================;
  275. //
  276. //
  277. //
  278. //
  279. //==========================================================================;
  280. //--------------------------------------------------------------------------;
  281. //
  282. // WORD MyGetVersion
  283. //
  284. // Description:
  285. //
  286. //
  287. // Arguments:
  288. //
  289. // Return (WORD):
  290. //
  291. // History:
  292. // 12/17/98
  293. //
  294. //--------------------------------------------------------------------------;
  295. WORD MyGetVersion(void)
  296. {
  297. DWORD dw;
  298. WORD w;
  299. dw = GetVersion();
  300. w = (LOBYTE(LOWORD(dw)) << 8) | (HIBYTE(LOWORD(dw)) >> 8);
  301. return w;
  302. }
  303. //--------------------------------------------------------------------------;
  304. //
  305. // BOOL MMCapsDetailAuxiliary
  306. //
  307. // Description:
  308. //
  309. //
  310. // Arguments:
  311. // HWND hedit:
  312. //
  313. // int nDevId:
  314. //
  315. // Return (BOOL):
  316. //
  317. // History:
  318. // 05/11/93
  319. //
  320. //--------------------------------------------------------------------------;
  321. BOOL FNLOCAL MMCapsDetailAuxiliary
  322. (
  323. HWND hedit,
  324. int nDevId
  325. )
  326. {
  327. TCHAR ach[MMCAPS_MAX_STRING_MIDPID_CHARS];
  328. PSTR psz;
  329. MMRESULT mmr;
  330. AUXCAPS ac;
  331. UINT u;
  332. DWORD dw;
  333. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  334. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_AUXILIARY]);
  335. if (-1 == nDevId)
  336. AppMEditPrintF(hedit, " Index (Id): %d (Mapper)\r\n", nDevId);
  337. else
  338. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  339. //
  340. //
  341. //
  342. mmr = auxGetDevCaps(nDevId, &ac, sizeof(ac));
  343. if (MMSYSERR_NOERROR != mmr)
  344. {
  345. _fmemset(&ac, 0, sizeof(ac));
  346. if (-1 != nDevId)
  347. {
  348. lstrcpy(ac.szPname, gszBogusCaps);
  349. }
  350. else
  351. {
  352. if (0 != auxGetNumDevs())
  353. {
  354. ac.wMid = MM_MICROSOFT;
  355. ac.vDriverVersion = (MMVERSION)MyGetVersion();
  356. lstrcpy(ac.szPname, gszDefaultMapper);
  357. mmr = MMSYSERR_NOERROR;
  358. }
  359. }
  360. }
  361. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)ac.szPname);
  362. if (MMSYSERR_NOERROR != mmr)
  363. return (TRUE);
  364. //
  365. //
  366. //
  367. //
  368. MMCapsMidAndPid(ac.wMid, ach, 0, NULL);
  369. AppMEditPrintF(hedit, " Manufacturer Id: %s\r\n", (LPSTR)ach);
  370. MMCapsMidAndPid(ac.wMid, NULL, ac.wPid, ach);
  371. AppMEditPrintF(hedit, " Product Id: %s\r\n", (LPSTR)ach);
  372. AppMEditPrintF(hedit, " Driver Version: %u.%.02u\r\n",
  373. (ac.vDriverVersion >> 8), (BYTE)ac.vDriverVersion);
  374. if (ac.wTechnology > AUXCAPS_TECHNOLOGY_LAST)
  375. {
  376. wsprintf(ach, "[%u], Unknown", ac.wTechnology);
  377. psz = ach;
  378. }
  379. else
  380. {
  381. psz = gaszAuxCapsTechnology[ac.wTechnology];
  382. }
  383. AppMEditPrintF(hedit, " Technology: %s\r\n", (LPSTR)psz);
  384. //
  385. //
  386. //
  387. //
  388. AppMEditPrintF(hedit, " Standard Support: [%.08lXh]", ac.dwSupport);
  389. for (u = 0, dw = ac.dwSupport; dw; u++)
  390. {
  391. if ((BYTE)dw & (BYTE)1)
  392. {
  393. psz = gaszAuxCapsSupport[u];
  394. if (NULL == psz)
  395. {
  396. wsprintf(ach, "Unknown%u", u);
  397. psz = ach;
  398. }
  399. AppMEditPrintF(hedit, ", %s", (LPSTR)psz);
  400. }
  401. dw >>= 1;
  402. }
  403. AppMEditPrintF(hedit, "\r\n");
  404. return (TRUE);
  405. } // MMCapsDetailAuxiliary()
  406. //--------------------------------------------------------------------------;
  407. //
  408. // BOOL MMCapsDetailJoystick
  409. //
  410. // Description:
  411. //
  412. //
  413. // Arguments:
  414. // HWND hedit:
  415. //
  416. // int nDevId:
  417. //
  418. // Return (BOOL):
  419. //
  420. // History:
  421. // 05/11/93
  422. //
  423. //--------------------------------------------------------------------------;
  424. BOOL FNLOCAL MMCapsDetailJoystick
  425. (
  426. HWND hedit,
  427. int nDevId
  428. )
  429. {
  430. TCHAR ach[MMCAPS_MAX_STRING_MIDPID_CHARS];
  431. MMRESULT mmr;
  432. JOYCAPS jc;
  433. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  434. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_JOYSTICK]);
  435. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  436. //
  437. //
  438. //
  439. mmr = joyGetDevCaps(nDevId, &jc, sizeof(jc));
  440. if (MMSYSERR_NOERROR != mmr)
  441. {
  442. lstrcpy(jc.szPname, gszBogusCaps);
  443. }
  444. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)jc.szPname);
  445. if (MMSYSERR_NOERROR != mmr)
  446. return (TRUE);
  447. //
  448. //
  449. //
  450. //
  451. MMCapsMidAndPid(jc.wMid, ach, 0, NULL);
  452. AppMEditPrintF(hedit, " Manufacturer Id: %s\r\n", (LPSTR)ach);
  453. MMCapsMidAndPid(jc.wMid, NULL, jc.wPid, ach);
  454. AppMEditPrintF(hedit, " Product Id: %s\r\n", (LPSTR)ach);
  455. AppMEditPrintF(hedit, " Driver Version: (sigh)\r\n");
  456. AppMEditPrintF(hedit, " Buttons: %u\r\n", jc.wNumButtons);
  457. AppMEditPrintF(hedit, " Minimum X Pos: %u\r\n", jc.wXmin);
  458. AppMEditPrintF(hedit, " Maximum X Pos: %u\r\n", jc.wXmax);
  459. AppMEditPrintF(hedit, " Minimum Y Pos: %u\r\n", jc.wYmin);
  460. AppMEditPrintF(hedit, " Maximum Y Pos: %u\r\n", jc.wYmax);
  461. AppMEditPrintF(hedit, " Minimum Z Pos: %u\r\n", jc.wZmin);
  462. AppMEditPrintF(hedit, " Maximum Z Pos: %u\r\n", jc.wZmax);
  463. AppMEditPrintF(hedit, " Minimum Period: %u\r\n", jc.wPeriodMin);
  464. AppMEditPrintF(hedit, " Maximum Period: %u\r\n", jc.wPeriodMax);
  465. return (TRUE);
  466. } // MMCapsDetailJoystick()
  467. //--------------------------------------------------------------------------;
  468. //
  469. // BOOL MMCapsDetailMidiIn
  470. //
  471. // Description:
  472. //
  473. //
  474. // Arguments:
  475. // HWND hedit:
  476. //
  477. // int nDevId:
  478. //
  479. // Return (BOOL):
  480. //
  481. // History:
  482. // 05/11/93
  483. //
  484. //--------------------------------------------------------------------------;
  485. BOOL FNLOCAL MMCapsDetailMidiIn
  486. (
  487. HWND hedit,
  488. int nDevId
  489. )
  490. {
  491. TCHAR ach[MMCAPS_MAX_STRING_MIDPID_CHARS];
  492. MMRESULT mmr;
  493. MIDIINCAPS mic;
  494. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  495. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_MIDIIN]);
  496. if (-1 == nDevId)
  497. AppMEditPrintF(hedit, " Index (Id): %d (Mapper)\r\n", nDevId);
  498. else
  499. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  500. //
  501. //
  502. //
  503. mmr = midiInGetDevCaps(nDevId, &mic, sizeof(mic));
  504. if (MMSYSERR_NOERROR != mmr)
  505. {
  506. _fmemset(&mic, 0, sizeof(mic));
  507. if (-1 != nDevId)
  508. {
  509. lstrcpy(mic.szPname, gszBogusCaps);
  510. }
  511. else
  512. {
  513. if (0 != midiInGetNumDevs())
  514. {
  515. mic.wMid = MM_MICROSOFT;
  516. mic.vDriverVersion = (MMVERSION)MyGetVersion();
  517. lstrcpy(mic.szPname, gszDefaultMapper);
  518. mmr = MMSYSERR_NOERROR;
  519. }
  520. }
  521. }
  522. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)mic.szPname);
  523. if (MMSYSERR_NOERROR != mmr)
  524. return (TRUE);
  525. //
  526. //
  527. //
  528. //
  529. MMCapsMidAndPid(mic.wMid, ach, 0, NULL);
  530. AppMEditPrintF(hedit, " Manufacturer Id: %s\r\n", (LPSTR)ach);
  531. MMCapsMidAndPid(mic.wMid, NULL, mic.wPid, ach);
  532. AppMEditPrintF(hedit, " Product Id: %s\r\n", (LPSTR)ach);
  533. AppMEditPrintF(hedit, " Driver Version: %u.%.02u\r\n",
  534. (mic.vDriverVersion >> 8), (BYTE)mic.vDriverVersion);
  535. return (TRUE);
  536. } // MMCapsDetailMidiIn()
  537. //--------------------------------------------------------------------------;
  538. //
  539. // BOOL MMCapsDetailMidiOut
  540. //
  541. // Description:
  542. //
  543. //
  544. // Arguments:
  545. // HWND hedit:
  546. //
  547. // int nDevId:
  548. //
  549. // Return (BOOL):
  550. //
  551. // History:
  552. // 05/11/93
  553. //
  554. //--------------------------------------------------------------------------;
  555. BOOL FNLOCAL MMCapsDetailMidiOut
  556. (
  557. HWND hedit,
  558. int nDevId
  559. )
  560. {
  561. TCHAR ach[MMCAPS_MAX_STRING_MIDPID_CHARS];
  562. PSTR psz;
  563. MMRESULT mmr;
  564. MIDIOUTCAPS moc;
  565. UINT u;
  566. DWORD dw;
  567. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  568. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_MIDIOUT]);
  569. if (-1 == nDevId) {
  570. AppMEditPrintF(hedit, " Index (Id): %d (Mapper)\r\n", nDevId);
  571. } else {
  572. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  573. }
  574. //
  575. //
  576. //
  577. mmr = midiOutGetDevCaps(nDevId, &moc, sizeof(moc));
  578. if (MMSYSERR_NOERROR != mmr)
  579. {
  580. _fmemset(&moc, 0, sizeof(moc));
  581. if (-1 != nDevId)
  582. {
  583. lstrcpy(moc.szPname, gszBogusCaps);
  584. }
  585. else
  586. {
  587. if (0 != midiOutGetNumDevs())
  588. {
  589. moc.wMid = MM_MICROSOFT;
  590. moc.vDriverVersion = (MMVERSION)MyGetVersion();
  591. lstrcpy(moc.szPname, gszDefaultMapper);
  592. mmr = MMSYSERR_NOERROR;
  593. }
  594. }
  595. }
  596. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)moc.szPname);
  597. if (MMSYSERR_NOERROR != mmr)
  598. return (TRUE);
  599. //
  600. //
  601. //
  602. //
  603. MMCapsMidAndPid(moc.wMid, ach, 0, NULL);
  604. AppMEditPrintF(hedit, " Manufacturer Id: %s\r\n", (LPSTR)ach);
  605. MMCapsMidAndPid(moc.wMid, NULL, moc.wPid, ach);
  606. AppMEditPrintF(hedit, " Product Id: %s\r\n", (LPSTR)ach);
  607. AppMEditPrintF(hedit, " Driver Version: %u.%.02u\r\n",
  608. (moc.vDriverVersion >> 8), (BYTE)moc.vDriverVersion);
  609. if (moc.wTechnology > MIDIOUTCAPS_TECHNOLOGY_LAST)
  610. {
  611. wsprintf(ach, "[%u], Unknown", moc.wTechnology);
  612. psz = ach;
  613. }
  614. else
  615. {
  616. psz = gaszMidiOutCapsTechnology[moc.wTechnology];
  617. }
  618. AppMEditPrintF(hedit, " Technology: %s\r\n", (LPSTR)psz);
  619. AppMEditPrintF(hedit, " Voices (Patches): %u (if internal synth)\r\n", moc.wVoices);
  620. AppMEditPrintF(hedit, " Polyphony: %u (if internal synth)\r\n", moc.wNotes);
  621. AppMEditPrintF(hedit, " Channel Mask: %.04Xh (if internal synth)\r\n", moc.wChannelMask);
  622. //
  623. //
  624. //
  625. //
  626. AppMEditPrintF(hedit, " Standard Support: [%.08lXh]", moc.dwSupport);
  627. for (u = 0, dw = moc.dwSupport; dw; u++)
  628. {
  629. if ((BYTE)dw & (BYTE)1)
  630. {
  631. psz = gaszMidiOutCapsSupport[u];
  632. if (NULL == psz)
  633. {
  634. wsprintf(ach, "Unknown%u", u);
  635. psz = ach;
  636. }
  637. AppMEditPrintF(hedit, ", %s", (LPSTR)psz);
  638. }
  639. dw >>= 1;
  640. }
  641. AppMEditPrintF(hedit, "\r\n");
  642. return (TRUE);
  643. } // MMCapsDetailMidiOut()
  644. //--------------------------------------------------------------------------;
  645. //
  646. // BOOL MMCapsDetailMixer
  647. //
  648. // Description:
  649. //
  650. //
  651. // Arguments:
  652. // HWND hedit:
  653. //
  654. // int nDevId:
  655. //
  656. // Return (BOOL):
  657. //
  658. // History:
  659. // 05/11/93
  660. //
  661. //--------------------------------------------------------------------------;
  662. BOOL FNLOCAL MMCapsDetailMixer
  663. (
  664. HWND hedit,
  665. int nDevId
  666. )
  667. {
  668. TCHAR ach[MMCAPS_MAX_STRING_MIDPID_CHARS];
  669. PSTR psz;
  670. MMRESULT mmr;
  671. MIXERCAPS mxc;
  672. UINT u;
  673. DWORD dw;
  674. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  675. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_MIXER]);
  676. #ifdef MIXER_MAPPER
  677. if (-1 == nDevId)
  678. AppMEditPrintF(hedit, " Index (Id): %d (Mapper)\r\n", nDevId);
  679. else
  680. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  681. #else
  682. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  683. #endif
  684. //
  685. //
  686. //
  687. mmr = mixerGetDevCaps(nDevId, &mxc, sizeof(mxc));
  688. if (MMSYSERR_NOERROR != mmr)
  689. {
  690. _fmemset(&mxc, 0, sizeof(mxc));
  691. if (-1 != nDevId)
  692. {
  693. lstrcpy(mxc.szPname, gszBogusCaps);
  694. }
  695. else
  696. {
  697. if (0 != mixerGetNumDevs())
  698. {
  699. mxc.wMid = MM_MICROSOFT;
  700. mxc.vDriverVersion = (MMVERSION)MyGetVersion();
  701. lstrcpy(mxc.szPname, gszDefaultMapper);
  702. mmr = MMSYSERR_NOERROR;
  703. }
  704. }
  705. }
  706. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)mxc.szPname);
  707. if (MMSYSERR_NOERROR != mmr)
  708. return (TRUE);
  709. //
  710. //
  711. //
  712. //
  713. MMCapsMidAndPid(mxc.wMid, ach, 0, NULL);
  714. AppMEditPrintF(hedit, " Manufacturer Id: %s\r\n", (LPSTR)ach);
  715. MMCapsMidAndPid(mxc.wMid, NULL, mxc.wPid, ach);
  716. AppMEditPrintF(hedit, " Product Id: %s\r\n", (LPSTR)ach);
  717. AppMEditPrintF(hedit, " Driver Version: %u.%.02u\r\n",
  718. (mxc.vDriverVersion >> 8), (BYTE)mxc.vDriverVersion);
  719. AppMEditPrintF(hedit, " Destinations: %u\r\n", mxc.cDestinations);
  720. //
  721. //
  722. //
  723. //
  724. AppMEditPrintF(hedit, " Standard Support: [%.08lXh]", mxc.fdwSupport);
  725. for (u = 0, dw = mxc.fdwSupport; dw; u++)
  726. {
  727. if ((BYTE)dw & (BYTE)1)
  728. {
  729. psz = gaszMixerCapsSupport[u];
  730. if (NULL == psz)
  731. {
  732. wsprintf(ach, "Unknown%u", u);
  733. psz = ach;
  734. }
  735. AppMEditPrintF(hedit, ", %s", (LPSTR)psz);
  736. }
  737. dw >>= 1;
  738. }
  739. AppMEditPrintF(hedit, "\r\n");
  740. return (TRUE);
  741. } // MMCapsDetailMixer()
  742. //--------------------------------------------------------------------------;
  743. //
  744. // BOOL MMCapsDetailTimer
  745. //
  746. // Description:
  747. //
  748. //
  749. // Arguments:
  750. // HWND hedit:
  751. //
  752. // int nDevId:
  753. //
  754. // Return (BOOL):
  755. //
  756. // History:
  757. // 05/11/93
  758. //
  759. //--------------------------------------------------------------------------;
  760. BOOL FNLOCAL MMCapsDetailTimer
  761. (
  762. HWND hedit,
  763. int nDevId
  764. )
  765. {
  766. MMRESULT mmr;
  767. TIMECAPS tc;
  768. MMVERSION uMMSysVer;
  769. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  770. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_TIMER]);
  771. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  772. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)gszTimerDevice);
  773. mmr = timeGetDevCaps(&tc, sizeof(tc));
  774. if (MMSYSERR_NOERROR != mmr)
  775. return (TRUE);
  776. //
  777. //
  778. //
  779. //
  780. uMMSysVer = (MMVERSION)MyGetVersion();
  781. AppMEditPrintF(hedit, " Driver Version: %u.%.02u\r\n",
  782. (uMMSysVer >> 8), (BYTE)uMMSysVer);
  783. AppMEditPrintF(hedit, " Minimum Period: %u\r\n", tc.wPeriodMin);
  784. AppMEditPrintF(hedit, " Maximum Period: %u\r\n", tc.wPeriodMax);
  785. return (TRUE);
  786. } // MMCapsDetailTimer()
  787. //--------------------------------------------------------------------------;
  788. //
  789. // BOOL MMCapsDetailWaveIn
  790. //
  791. // Description:
  792. //
  793. //
  794. // Arguments:
  795. // HWND hedit:
  796. //
  797. // int nDevId:
  798. //
  799. // Return (BOOL):
  800. //
  801. // History:
  802. // 05/11/93
  803. //
  804. //--------------------------------------------------------------------------;
  805. BOOL FNLOCAL MMCapsDetailWaveIn
  806. (
  807. HWND hedit,
  808. int nDevId
  809. )
  810. {
  811. TCHAR ach[MMCAPS_MAX_STRING_MIDPID_CHARS];
  812. PSTR psz;
  813. MMRESULT mmr;
  814. WAVEINCAPS wic;
  815. UINT u;
  816. DWORD dw;
  817. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  818. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_WAVEIN]);
  819. if (-1 == nDevId)
  820. AppMEditPrintF(hedit, " Index (Id): %d (Mapper)\r\n", nDevId);
  821. else
  822. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  823. //
  824. //
  825. //
  826. mmr = waveInGetDevCaps(nDevId, &wic, sizeof(wic));
  827. if (MMSYSERR_NOERROR != mmr)
  828. {
  829. _fmemset(&wic, 0, sizeof(wic));
  830. if (-1 != nDevId)
  831. {
  832. lstrcpy(wic.szPname, gszBogusCaps);
  833. }
  834. else
  835. {
  836. if (0 != waveInGetNumDevs())
  837. {
  838. wic.wMid = MM_MICROSOFT;
  839. wic.vDriverVersion = (MMVERSION)MyGetVersion();
  840. lstrcpy(wic.szPname, gszDefaultMapper);
  841. mmr = MMSYSERR_NOERROR;
  842. }
  843. }
  844. }
  845. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)wic.szPname);
  846. if (MMSYSERR_NOERROR != mmr)
  847. return (TRUE);
  848. //
  849. //
  850. //
  851. //
  852. MMCapsMidAndPid(wic.wMid, ach, 0, NULL);
  853. AppMEditPrintF(hedit, " Manufacturer Id: %s\r\n", (LPSTR)ach);
  854. MMCapsMidAndPid(wic.wMid, NULL, wic.wPid, ach);
  855. AppMEditPrintF(hedit, " Product Id: %s\r\n", (LPSTR)ach);
  856. AppMEditPrintF(hedit, " Driver Version: %u.%.02u\r\n",
  857. (wic.vDriverVersion >> 8), (BYTE)wic.vDriverVersion);
  858. AppMEditPrintF(hedit, " Channels: %u\r\n", wic.wChannels);
  859. //
  860. //
  861. //
  862. //
  863. AppMEditPrintF(hedit, " Standard Formats: [%.08lXh]", wic.dwFormats);
  864. for (u = 0, dw = wic.dwFormats; dw; u++)
  865. {
  866. if ((BYTE)dw & (BYTE)1)
  867. {
  868. psz = gaszWaveInOutCapsFormats[u];
  869. if (NULL == psz)
  870. {
  871. wsprintf(ach, "Unknown%u", u);
  872. psz = ach;
  873. }
  874. AppMEditPrintF(hedit, ", %s", (LPSTR)psz);
  875. }
  876. dw >>= 1;
  877. }
  878. AppMEditPrintF(hedit, "\r\n");
  879. return (TRUE);
  880. } // MMCapsDetailWaveIn()
  881. //--------------------------------------------------------------------------;
  882. //
  883. // BOOL MMCapsDetailWaveOut
  884. //
  885. // Description:
  886. //
  887. //
  888. // Arguments:
  889. // HWND hedit:
  890. //
  891. // int nDevId:
  892. //
  893. // Return (BOOL):
  894. //
  895. // History:
  896. // 05/11/93
  897. //
  898. //--------------------------------------------------------------------------;
  899. BOOL FNLOCAL MMCapsDetailWaveOut
  900. (
  901. HWND hedit,
  902. int nDevId
  903. )
  904. {
  905. TCHAR ach[MMCAPS_MAX_STRING_MIDPID_CHARS];
  906. PSTR psz;
  907. MMRESULT mmr;
  908. WAVEOUTCAPS woc;
  909. UINT u;
  910. DWORD dw;
  911. AppMEditPrintF(hedit, " Device Type: %s\r\n",
  912. (LPSTR)gaszDeviceType[MMCAPS_DEVTYPE_WAVEOUT]);
  913. if (-1 == nDevId)
  914. AppMEditPrintF(hedit, " Index (Id): %d (Mapper)\r\n", nDevId);
  915. else
  916. AppMEditPrintF(hedit, " Index (Id): %d\r\n", nDevId);
  917. //
  918. //
  919. //
  920. mmr = waveOutGetDevCaps(nDevId, &woc, sizeof(woc));
  921. if (MMSYSERR_NOERROR != mmr)
  922. {
  923. _fmemset(&woc, 0, sizeof(woc));
  924. if (-1 != nDevId)
  925. {
  926. lstrcpy(woc.szPname, gszBogusCaps);
  927. }
  928. else
  929. {
  930. if (0 != waveOutGetNumDevs())
  931. {
  932. woc.wMid = MM_MICROSOFT;
  933. woc.vDriverVersion = (MMVERSION)MyGetVersion();
  934. lstrcpy(woc.szPname, gszDefaultMapper);
  935. mmr = MMSYSERR_NOERROR;
  936. }
  937. }
  938. }
  939. AppMEditPrintF(hedit, " Product Name: %s\r\n", (LPSTR)woc.szPname);
  940. if (MMSYSERR_NOERROR != mmr)
  941. return (TRUE);
  942. //
  943. //
  944. //
  945. //
  946. MMCapsMidAndPid(woc.wMid, ach, 0, NULL);
  947. AppMEditPrintF(hedit, " Manufacturer Id: %s\r\n", (LPSTR)ach);
  948. MMCapsMidAndPid(woc.wMid, NULL, woc.wPid, ach);
  949. AppMEditPrintF(hedit, " Product Id: %s\r\n", (LPSTR)ach);
  950. AppMEditPrintF(hedit, " Driver Version: %u.%.02u\r\n",
  951. (woc.vDriverVersion >> 8), (BYTE)woc.vDriverVersion);
  952. AppMEditPrintF(hedit, " Channels: %u\r\n", woc.wChannels);
  953. //
  954. //
  955. //
  956. //
  957. AppMEditPrintF(hedit, " Standard Formats: [%.08lXh]", woc.dwFormats);
  958. for (u = 0, dw = woc.dwFormats; dw; u++)
  959. {
  960. if ((BYTE)dw & (BYTE)1)
  961. {
  962. psz = gaszWaveInOutCapsFormats[u];
  963. if (NULL == psz)
  964. {
  965. wsprintf(ach, "Unknown%u", u);
  966. psz = ach;
  967. }
  968. AppMEditPrintF(hedit, ", %s", (LPSTR)psz);
  969. }
  970. dw >>= 1;
  971. }
  972. AppMEditPrintF(hedit, "\r\n");
  973. //
  974. //
  975. //
  976. //
  977. AppMEditPrintF(hedit, " Standard Support: [%.08lXh]", woc.dwSupport);
  978. for (u = 0, dw = woc.dwSupport; dw; u++)
  979. {
  980. if ((BYTE)dw & (BYTE)1)
  981. {
  982. psz = gaszWaveOutCapsSupport[u];
  983. if (NULL == psz)
  984. {
  985. wsprintf(ach, "Unknown%u", u);
  986. psz = ach;
  987. }
  988. AppMEditPrintF(hedit, ", %s", (LPSTR)psz);
  989. }
  990. dw >>= 1;
  991. }
  992. AppMEditPrintF(hedit, "\r\n");
  993. return (TRUE);
  994. } // MMCapsDetailWaveOut()
  995. //==========================================================================;
  996. //
  997. //
  998. //
  999. //
  1000. //==========================================================================;
  1001. //--------------------------------------------------------------------------;
  1002. //
  1003. // BOOL MMCapsDetailLowLevel
  1004. //
  1005. // Description:
  1006. //
  1007. //
  1008. // Arguments:
  1009. // HWND hedit:
  1010. //
  1011. // LPARAM lParam:
  1012. //
  1013. // Return (BOOL):
  1014. //
  1015. // History:
  1016. // 05/16/93
  1017. //
  1018. //--------------------------------------------------------------------------;
  1019. BOOL FNGLOBAL MMCapsDetailLowLevel
  1020. (
  1021. HWND hedit,
  1022. LPARAM lParam
  1023. )
  1024. {
  1025. int nDevId;
  1026. UINT uDevType;
  1027. //
  1028. // HIWORD(lParam): MMCAPS_DEVTYPE_*
  1029. // LOWORD(lParam): Device index (id)
  1030. //
  1031. nDevId = (int)(short)LOWORD(lParam);
  1032. uDevType = HIWORD(lParam);
  1033. //
  1034. //
  1035. //
  1036. //
  1037. switch (uDevType)
  1038. {
  1039. case MMCAPS_DEVTYPE_AUXILIARY:
  1040. MMCapsDetailAuxiliary(hedit, nDevId);
  1041. break;
  1042. case MMCAPS_DEVTYPE_JOYSTICK:
  1043. MMCapsDetailJoystick(hedit, nDevId);
  1044. break;
  1045. case MMCAPS_DEVTYPE_MIDIIN:
  1046. MMCapsDetailMidiIn(hedit, nDevId);
  1047. break;
  1048. case MMCAPS_DEVTYPE_MIDIOUT:
  1049. MMCapsDetailMidiOut(hedit, nDevId);
  1050. break;
  1051. case MMCAPS_DEVTYPE_MIXER:
  1052. MMCapsDetailMixer(hedit, nDevId);
  1053. break;
  1054. case MMCAPS_DEVTYPE_TIMER:
  1055. MMCapsDetailTimer(hedit, nDevId);
  1056. break;
  1057. case MMCAPS_DEVTYPE_WAVEIN:
  1058. MMCapsDetailWaveIn(hedit, nDevId);
  1059. break;
  1060. case MMCAPS_DEVTYPE_WAVEOUT:
  1061. MMCapsDetailWaveOut(hedit, nDevId);
  1062. break;
  1063. }
  1064. //
  1065. //
  1066. //
  1067. return (TRUE);
  1068. } // MMCapsDetailLowLevel()
  1069. //--------------------------------------------------------------------------;
  1070. //
  1071. // BOOL MMCapsEnumerateLowLevel
  1072. //
  1073. // Description:
  1074. //
  1075. //
  1076. // Arguments:
  1077. // PZYZTABBEDLISTBOX ptlb:
  1078. //
  1079. // BOOL fComplete:
  1080. //
  1081. // Return (BOOL):
  1082. //
  1083. // History:
  1084. // 05/18/93
  1085. //
  1086. //--------------------------------------------------------------------------;
  1087. BOOL FNGLOBAL MMCapsEnumerateLowLevel
  1088. (
  1089. PZYZTABBEDLISTBOX ptlb,
  1090. BOOL fComplete
  1091. )
  1092. {
  1093. TCHAR ach[128];
  1094. MMRESULT mmr;
  1095. int n;
  1096. int nDevs;
  1097. int nPrefDev;
  1098. DWORD dwPrefFlags;
  1099. int nIndex;
  1100. LPARAM lParam;
  1101. UINT uDevType;
  1102. MMVERSION uMMSysVer;
  1103. HWND hlb;
  1104. //
  1105. //
  1106. //
  1107. //
  1108. //
  1109. if (fComplete)
  1110. {
  1111. TlbSetTitleAndTabs(ptlb, gszDeviceFormatTitle, FALSE);
  1112. }
  1113. hlb = ptlb->hlb;
  1114. uMMSysVer = (MMVERSION)MyGetVersion();
  1115. //
  1116. //
  1117. //
  1118. nDevs = auxGetNumDevs();
  1119. for (n = -1; n < nDevs; n++)
  1120. {
  1121. AUXCAPS ac;
  1122. mmr = auxGetDevCaps(n, &ac, sizeof(ac));
  1123. if (MMSYSERR_NOERROR != mmr)
  1124. {
  1125. if (-1 != n)
  1126. {
  1127. ac.vDriverVersion = 0;
  1128. lstrcpy(ac.szPname, gszBogusCaps);
  1129. }
  1130. else
  1131. {
  1132. if (0 == nDevs)
  1133. break;
  1134. ac.vDriverVersion = uMMSysVer;
  1135. lstrcpy(ac.szPname, gszDefaultMapper);
  1136. }
  1137. }
  1138. //
  1139. //
  1140. //
  1141. uDevType = MMCAPS_DEVTYPE_AUXILIARY;
  1142. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1143. n, (ac.vDriverVersion >> 8), (BYTE)ac.vDriverVersion,
  1144. (LPSTR)ac.szPname);
  1145. nIndex = ListBox_AddString(hlb, ach);
  1146. lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
  1147. ListBox_SetItemData(hlb, nIndex, lParam);
  1148. }
  1149. //
  1150. //
  1151. //
  1152. //
  1153. //
  1154. #ifndef WIN32
  1155. nDevs = mixerGetNumDevs();
  1156. #ifdef MIXER_MAPPER
  1157. for (n = -1; n < nDevs; n++)
  1158. #else
  1159. for (n = 0; n < nDevs; n++)
  1160. #endif
  1161. {
  1162. MIXERCAPS mxc;
  1163. mmr = mixerGetDevCaps(n, &mxc, sizeof(mxc));
  1164. if (MMSYSERR_NOERROR != mmr)
  1165. {
  1166. if (-1 != n)
  1167. {
  1168. mxc.vDriverVersion = 0;
  1169. lstrcpy(mxc.szPname, gszBogusCaps);
  1170. }
  1171. else
  1172. {
  1173. if (0 == nDevs)
  1174. break;
  1175. mxc.vDriverVersion = uMMSysVer;
  1176. lstrcpy(mxc.szPname, gszDefaultMapper);
  1177. }
  1178. }
  1179. //
  1180. //
  1181. //
  1182. uDevType = MMCAPS_DEVTYPE_MIXER;
  1183. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1184. n, (mxc.vDriverVersion >> 8), (BYTE)mxc.vDriverVersion,
  1185. (LPSTR)mxc.szPname);
  1186. nIndex = ListBox_AddString(hlb, ach);
  1187. lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
  1188. ListBox_SetItemData(hlb, nIndex, lParam);
  1189. }
  1190. #endif
  1191. //
  1192. //
  1193. //
  1194. nDevs = midiInGetNumDevs();
  1195. for (n = 0; n < nDevs; n++)
  1196. {
  1197. MIDIINCAPS mic;
  1198. mmr = midiInGetDevCaps(n, &mic, sizeof(mic));
  1199. if (MMSYSERR_NOERROR != mmr)
  1200. {
  1201. if (-1 != n)
  1202. {
  1203. mic.vDriverVersion = 0;
  1204. lstrcpy(mic.szPname, gszBogusCaps);
  1205. }
  1206. else
  1207. {
  1208. if (0 == nDevs)
  1209. break;
  1210. mic.vDriverVersion = uMMSysVer;
  1211. lstrcpy(mic.szPname, gszDefaultMapper);
  1212. }
  1213. }
  1214. //
  1215. //
  1216. //
  1217. uDevType = MMCAPS_DEVTYPE_MIDIIN;
  1218. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1219. n, (mic.vDriverVersion >> 8), (BYTE)mic.vDriverVersion,
  1220. (LPSTR)mic.szPname);
  1221. nIndex = ListBox_AddString(hlb, ach);
  1222. lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
  1223. ListBox_SetItemData(hlb, nIndex, lParam);
  1224. }
  1225. //
  1226. //
  1227. //
  1228. mmr = midiOutMessage((HMIDIOUT)MIDI_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&nPrefDev, (DWORD_PTR)&dwPrefFlags);
  1229. if (MMSYSERR_NOERROR != mmr) nPrefDev = -2;
  1230. nDevs = midiOutGetNumDevs();
  1231. for (n = -1; n < nDevs; n++)
  1232. {
  1233. MIDIOUTCAPS moc;
  1234. mmr = midiOutGetDevCaps(n, &moc, sizeof(moc));
  1235. if (MMSYSERR_NOERROR != mmr)
  1236. {
  1237. if (-1 != n)
  1238. {
  1239. moc.vDriverVersion = 0;
  1240. lstrcpy(moc.szPname, gszBogusCaps);
  1241. }
  1242. else
  1243. {
  1244. if (0 == nDevs)
  1245. break;
  1246. moc.vDriverVersion = uMMSysVer;
  1247. lstrcpy(moc.szPname, gszDefaultMapper);
  1248. }
  1249. }
  1250. //
  1251. //
  1252. //
  1253. uDevType = MMCAPS_DEVTYPE_MIDIOUT;
  1254. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1255. n, (moc.vDriverVersion >> 8), (BYTE)moc.vDriverVersion,
  1256. (LPSTR)moc.szPname);
  1257. if (n != -1 && n == nPrefDev) {
  1258. if (dwPrefFlags & DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY) {
  1259. strcat(ach, TEXT("(**)"));
  1260. } else {
  1261. strcat(ach, TEXT("(*)"));
  1262. }
  1263. }
  1264. nIndex = ListBox_AddString(hlb, ach);
  1265. lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
  1266. ListBox_SetItemData(hlb, nIndex, lParam);
  1267. }
  1268. //
  1269. //
  1270. //
  1271. mmr = waveInMessage((HWAVEIN)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&nPrefDev, (DWORD_PTR)&dwPrefFlags);
  1272. if (MMSYSERR_NOERROR != mmr) nPrefDev = -2;
  1273. nDevs = waveInGetNumDevs();
  1274. for (n = -1; n < nDevs; n++)
  1275. {
  1276. WAVEINCAPS wic;
  1277. mmr = waveInGetDevCaps(n, &wic, sizeof(wic));
  1278. if (MMSYSERR_NOERROR != mmr)
  1279. {
  1280. if (-1 != n)
  1281. {
  1282. wic.vDriverVersion = 0;
  1283. lstrcpy(wic.szPname, gszBogusCaps);
  1284. }
  1285. else
  1286. {
  1287. if (0 == nDevs)
  1288. break;
  1289. wic.vDriverVersion = uMMSysVer;
  1290. lstrcpy(wic.szPname, gszDefaultMapper);
  1291. }
  1292. }
  1293. //
  1294. //
  1295. //
  1296. uDevType = MMCAPS_DEVTYPE_WAVEIN;
  1297. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1298. n, (wic.vDriverVersion >> 8), (BYTE)wic.vDriverVersion,
  1299. (LPSTR)wic.szPname);
  1300. if (n != -1 && n == nPrefDev) {
  1301. if (dwPrefFlags & DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY) {
  1302. strcat(ach, TEXT("(**)"));
  1303. } else {
  1304. strcat(ach, TEXT("(*)"));
  1305. }
  1306. }
  1307. nIndex = ListBox_AddString(hlb, ach);
  1308. lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
  1309. ListBox_SetItemData(hlb, nIndex, lParam);
  1310. }
  1311. //
  1312. //
  1313. //
  1314. mmr = waveOutMessage((HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&nPrefDev, (DWORD_PTR)&dwPrefFlags);
  1315. if (MMSYSERR_NOERROR != mmr) nPrefDev = -2;
  1316. nDevs = waveOutGetNumDevs();
  1317. for (n = -1; n < nDevs; n++)
  1318. {
  1319. WAVEOUTCAPS woc;
  1320. mmr = waveOutGetDevCaps(n, &woc, sizeof(woc));
  1321. if (MMSYSERR_NOERROR != mmr)
  1322. {
  1323. if (-1 != n)
  1324. {
  1325. woc.vDriverVersion = 0;
  1326. lstrcpy(woc.szPname, gszBogusCaps);
  1327. }
  1328. else
  1329. {
  1330. if (0 == nDevs)
  1331. break;
  1332. woc.vDriverVersion = uMMSysVer;
  1333. lstrcpy(woc.szPname, gszDefaultMapper);
  1334. }
  1335. }
  1336. //
  1337. //
  1338. //
  1339. uDevType = MMCAPS_DEVTYPE_WAVEOUT;
  1340. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1341. n, (woc.vDriverVersion >> 8), (BYTE)woc.vDriverVersion,
  1342. (LPSTR)woc.szPname);
  1343. if (n != -1 && n == nPrefDev) {
  1344. if (dwPrefFlags & DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY) {
  1345. strcat(ach, TEXT("(**)"));
  1346. } else {
  1347. strcat(ach, TEXT("(*)"));
  1348. }
  1349. }
  1350. nIndex = ListBox_AddString(hlb, ach);
  1351. lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
  1352. ListBox_SetItemData(hlb, nIndex, lParam);
  1353. }
  1354. //
  1355. //
  1356. //
  1357. {
  1358. TIMECAPS tc;
  1359. mmr = timeGetDevCaps(&tc, sizeof(tc));
  1360. if (MMSYSERR_NOERROR == mmr)
  1361. {
  1362. //
  1363. //
  1364. //
  1365. uDevType = MMCAPS_DEVTYPE_TIMER;
  1366. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1367. 0, (uMMSysVer >> 8), (BYTE)uMMSysVer,
  1368. (LPSTR)gszTimerDevice);
  1369. nIndex = ListBox_AddString(hlb, ach);
  1370. lParam = MAKELPARAM(0, (WORD)uDevType);
  1371. ListBox_SetItemData(hlb, nIndex, lParam);
  1372. }
  1373. }
  1374. //
  1375. //
  1376. //
  1377. nDevs = joyGetNumDevs();
  1378. for (n = 0; n < nDevs; n++)
  1379. {
  1380. JOYCAPS jc;
  1381. mmr = joyGetDevCaps(n, &jc, sizeof(jc));
  1382. if (MMSYSERR_NOERROR != mmr)
  1383. {
  1384. lstrcpy(jc.szPname, gszBogusCaps);
  1385. }
  1386. //
  1387. //
  1388. //
  1389. uDevType = MMCAPS_DEVTYPE_JOYSTICK;
  1390. wsprintf(ach, gszDeviceFormatList, (LPSTR)gaszDeviceType[uDevType],
  1391. n, 0, 0, (LPSTR)jc.szPname);
  1392. nIndex = ListBox_AddString(hlb, ach);
  1393. lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
  1394. ListBox_SetItemData(hlb, nIndex, lParam);
  1395. }
  1396. //
  1397. //
  1398. //
  1399. return (TRUE);
  1400. } // MMCapsEnumerateLowLevel()