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.

382 lines
11 KiB

  1. /*
  2. ***************************************************************
  3. * mmcpl.h
  4. *
  5. * Header file for mm control applet.
  6. *
  7. *
  8. * History:
  9. *
  10. * January -by- VijR
  11. * Created.
  12. ***************************************************************
  13. */
  14. #ifndef MMCPL_H
  15. #define MMCPL_H
  16. #define _INC_OLE
  17. #ifndef STRICT
  18. #define STRICT
  19. #endif
  20. #pragma warning( disable: 4103)
  21. #include <windows.h> // also includes windowsx.h
  22. #include <shellapi.h> // for registration functions
  23. #include <windowsx.h>
  24. #include <ole2.h>
  25. #include <mmsystem.h>
  26. #include <setupapi.h>
  27. #include <shlobj.h> // Shell OLE interfaces
  28. #include <string.h>
  29. #ifndef INITGUID
  30. #include <shlobjp.h>
  31. #endif
  32. #include <commdlg.h>
  33. #include "rcids.h" // Resource declaration
  34. #define PUBLIC FAR PASCAL
  35. #define CPUBLIC FAR _cdecl
  36. #define PRIVATE NEAR PASCAL
  37. //#include "utils.h" // Common macros
  38. /* Temporarily here until someone defines these for 16 bit side again. */
  39. #ifndef ERROR_SUCCESS
  40. #define ERROR_SUCCESS 0L
  41. #endif
  42. /*
  43. ***************************************************************
  44. * Constants and Definitions
  45. ***************************************************************
  46. */
  47. #define MIDI TEXT("MIDI")
  48. #define ACM TEXT("ACM")
  49. #define MSACM TEXT("MSACM.")
  50. #define WAVE TEXT("Wave")
  51. #define MIDIMAP TEXT("MidiMapper")
  52. #define WAVEMAP TEXT("WaveMapper")
  53. #define AUX TEXT("Aux")
  54. #define MIXER TEXT("Mixer")
  55. #define JOYSTICK TEXT("Joystick")
  56. #define MCI TEXT("MCI")
  57. #define ICM TEXT("ICM")
  58. #define ICMSTR TEXT("VIDC.")
  59. #define ICMSTR2 TEXT("VIDS.")
  60. #define VIDCAP TEXT("MSVIDEO")
  61. #define AUDIO TEXT("Audio")
  62. #define CDAUDIO TEXT("CDAudio")
  63. #define VIDEO TEXT("Video")
  64. #define VOICE TEXT("Voice")
  65. #define VOLUME TEXT("Volume")
  66. #define MAXSTR 256 // maximum size of a string or filename
  67. #define SZCODE const TCHAR
  68. #define INTCODE const int
  69. #define WINDOWS_DEFAULTENTRY 1
  70. #define NONE_ENTRY 0
  71. #define MAXNAME 32 // Maximum name length
  72. #define MAXLNAME 64
  73. #define MAXMESSAGE 128 // Maximum resource string message
  74. #define MAXSTRINGLEN 256 // Maximum output string length
  75. #define MAXINTLEN 7 // Maximum interger string length
  76. #define MAXLONGLEN 11 // Maximum long string length
  77. #define MAXMSGLEN 512 // Maximum message length
  78. #define WAVE_ID 0
  79. #define MIDI_ID 1
  80. #define MIXER_ID 2
  81. #define AUX_ID 3
  82. #define MCI_ID 4
  83. #define ACM_ID 5
  84. #define ICM_ID 6
  85. #define VIDCAP_ID 7
  86. #define JOYSTICK_ID 8
  87. DEFINE_GUID(CLSID_mmsePropSheetHandler, 0x00022613L, 0x0000, 0x0000, 0xC0, 0x00, 0x00,
  88. 0x00, 0x00, 0x00, 0x00, 0x46);
  89. #define HWAVEOUT_MAPPER ((HWAVEOUT)IntToPtr(WAVE_MAPPER))
  90. #define HWAVEIN_MAPPER ((HWAVEIN)IntToPtr(WAVE_MAPPER))
  91. #define HMIDIOUT_MAPPER ((HMIDIOUT)IntToPtr(WAVE_MAPPER))
  92. #define HWAVEOUT_INDEX(i) ((HWAVEOUT)IntToPtr(i))
  93. #define HWAVEIN_INDEX(i) ((HWAVEIN)IntToPtr(i))
  94. #define HMIDIOUT_INDEX(i) ((HMIDIOUT)IntToPtr(i))
  95. #define HMIXER_INDEX(i) ((HMIXER)IntToPtr(i))
  96. #define HMIXEROBJ_INDEX(i) ((HMIXEROBJ)IntToPtr(i))
  97. /*
  98. ***************************************************************
  99. * Internal STRUCTS used by mm.cpl
  100. ***************************************************************
  101. */
  102. typedef struct _ClassNode
  103. {
  104. short iNode; //1 if class, 2 if device , 3-> ACM, 4->instrument
  105. TCHAR szClassName[64];
  106. TCHAR szClass[16];
  107. HICON hIcon;
  108. } CLASSNODE, * PCLASSNODE;
  109. typedef struct iResources
  110. {
  111. short iNode;
  112. TCHAR szFriendlyName[MAXSTR];
  113. TCHAR szDesc[MAXSTR];
  114. TCHAR szParam[64];
  115. TCHAR szFile[MAXSTR];
  116. TCHAR szDrvEntry[64];
  117. TCHAR szClass[16];
  118. HDRVR hDriver;
  119. DWORD dnDevNode;
  120. short fQueryable; // 0 -> can't, 1 -> can, -1 -> need to check
  121. short iClassID;
  122. int fStatus; //0 -> Disabled, 1-> Enabled and entry in reg, 2->Enabled but no entry in reg (i.e.old dev), 3->Enabled and ACTIVE, 4->inactive
  123. PCLASSNODE pcn;
  124. }IRESOURCE, *PIRESOURCE;
  125. typedef struct _Instrument
  126. {
  127. short iNode;
  128. TCHAR szFriendlyName[MAXSTR];
  129. TCHAR szInstr[64];
  130. PIRESOURCE pDev;
  131. }INSTRUMENT, * PINSTRUMENT;
  132. typedef struct event
  133. {
  134. short iNode; //1 if module 2 if event
  135. short fHasSound;
  136. LPTSTR pszEvent;
  137. LPTSTR pszEventLabel;
  138. LPTSTR pszPath;
  139. struct event *npNextEvent;
  140. } EVENT, *PEVENT;
  141. typedef struct module
  142. {
  143. short iNode; //1 if module 2 if event
  144. LPTSTR pszKey;
  145. LPTSTR pszLabel;
  146. BOOL fChange;
  147. PEVENT npList;
  148. } MODULE, *PMODULE;
  149. typedef struct _AudioDlgInfo
  150. {
  151. UINT uPrefIn;
  152. UINT uPrefOut;
  153. UINT uPrefMIDIOut;
  154. UINT cNumOutDevs;
  155. UINT cNumInDevs;
  156. UINT cNumMIDIOutDevs;
  157. BOOL fPrefOnly;
  158. } AUDIODLGINFO, * PAUDIODLGINFO;
  159. typedef struct
  160. {
  161. HDEVINFO hDevInfo;
  162. PSP_DEVINFO_DATA pDevInfoData;
  163. } ALLDEVINFO, *PALLDEVINFO;
  164. /*
  165. ***************************************************************
  166. * Globals and Strings used to loadstring resources at startup
  167. ***************************************************************
  168. */
  169. #ifdef __cplusplus
  170. extern "C" {
  171. #endif
  172. extern TCHAR gszNone[];
  173. extern TCHAR gszRemoveScheme[];
  174. extern TCHAR gszChangeScheme[];
  175. extern SZCODE gszWindowsHlp[];
  176. extern SZCODE gszNull[];
  177. extern SZCODE cszWavExt[];
  178. extern SZCODE cszMIDIExt[];
  179. extern SZCODE cszRMIExt[];
  180. extern SZCODE cszAVIExt[];
  181. extern SZCODE cszSlash[];
  182. extern SZCODE cszAUDIO[];
  183. extern SZCODE cszVIDEO[];
  184. extern SZCODE cszCDAUDIO[];
  185. extern SZCODE cszMIDI[];
  186. extern TCHAR gszDevEnabled[];
  187. extern TCHAR gszDevDisabled[];
  188. extern TCHAR gszGeneral[];
  189. extern HINSTANCE ghInstance;
  190. extern BOOL gfVoiceTab;
  191. extern HWND ghVocDlg;
  192. extern INT_PTR PASCAL GetVerDesc (LPCTSTR pstrFile, LPTSTR pstrDesc);
  193. extern BOOL PASCAL GetExeDesc (LPTSTR szFile, LPTSTR pszBuff, int cchBuff);
  194. extern BOOL PASCAL LoadDesc(LPCTSTR pstrFile, LPTSTR pstrDesc);
  195. extern void AddExt(LPTSTR pszFile, LPCTSTR cszExt);
  196. extern BOOL PASCAL ValidateRegistry(void);
  197. #define GEI_MODNAME 0x01
  198. #define GEI_DESCRIPTION 0x02
  199. #define GEI_FLAGS 0x03
  200. #define GEI_EXEHDR 0x04
  201. #define GEI_FAPI 0x05
  202. MMRESULT GetWaveID(UINT *puWaveID);
  203. void PASCAL ShowPropSheet(LPCTSTR pszTitle,
  204. DLGPROC pfnDialog,
  205. UINT idTemplate,
  206. HWND hWndParent,
  207. LPTSTR pszCaption,
  208. LPARAM lParam);
  209. void PASCAL ShowMidiPropSheet(LPPROPSHEETHEADER ppshExt, LPCTSTR pszTitle,
  210. HWND hWndParent,
  211. short iMidiPropType,
  212. LPTSTR pszCaption,
  213. HTREEITEM hti,
  214. LPARAM lParam1,
  215. LPARAM lParam2);
  216. void PASCAL ShowWithMidiDevPropSheet(LPCTSTR pszTitle,
  217. DLGPROC pfnDialog,
  218. UINT idTemplate,
  219. HWND hWndParent,
  220. LPTSTR pszCaption,
  221. HTREEITEM hti,
  222. LPARAM lParam, LPARAM lParamExt1, LPARAM lParamExt2);
  223. #define MT_WAVE 1
  224. #define MT_MIDI 2
  225. #define MT_AVI 3
  226. #define MT_ASF 4
  227. #define MT_ERROR 0
  228. BOOL mmpsh_ShowFileDetails(LPTSTR pszCaption, HWND hwndParent, LPTSTR pszFile, short iMediaType);
  229. int FAR PASCAL lstrncmpi(LPCTSTR lszKey,
  230. LPCTSTR lszClass,
  231. int iSize);
  232. INT_PTR mmse_MessageBox(HWND hwndP, LPTSTR szMsg, LPTSTR szTitle, UINT uStyle);
  233. void PASCAL GetPropSheet(LPCTSTR pszTitle,
  234. LPCTSTR pszClass,
  235. DLGPROC pfnDialog,
  236. UINT idTemplate,
  237. HWND hWndParent,
  238. HICON hClassIcon,
  239. LPPROPSHEETHEADER ppsh, HPROPSHEETPAGE * lphpsp);
  240. BOOL PASCAL ErrorBox (HWND, int, LPTSTR);
  241. int PASCAL DisplayMessage(HWND hDlg, int iResTitle, int iResMsg, UINT uStyle);
  242. BOOL ACMEnumCodecs(void);
  243. void ACMCleanUp(void);
  244. void ACMNodeChange(HWND hDlg);
  245. BOOL CALLBACK MMExtPropSheetCallback(DWORD dwFunc, DWORD_PTR dwParam1, DWORD_PTR dwParam2, DWORD_PTR dwInstance);
  246. typedef BOOL (CALLBACK FAR * LPFNMMEXTPROPSHEETCALLBACK)(DWORD dwFunc, DWORD_PTR dwParam1, DWORD_PTR dwParam2, DWORD_PTR dwInstance);
  247. //Following are functions currently supported by the callback functions:
  248. //dwInstance parameter which is passed to the external module when its entry point
  249. //is called MUST always be passed back along with all the functions.
  250. #define MM_EPS_GETNODEDESC 0x00000001
  251. //Gets the description displayed in the tree for the node for which the External Prop. Sheet is up.
  252. //For 'simple' property sheet this just returns a sheet Name
  253. //dwParam1 is a pointer to a string buffer in which the description is returned
  254. #define MM_EPS_GETNODEID 0x00000002
  255. //Gets the Reg. Key Path offset from the MediaResources key
  256. //For 'simple' property sheet this just returns a sheet class
  257. //dwParam1 is a pointer to a string buffer in which the Key Path is returned
  258. #define MM_EPS_ADDSHEET 0x00000003
  259. //Adds a property sheet for the current node in the tree.
  260. //dwParam1 = HPROPSHEETPAGE for the page being added.
  261. #define MM_EPS_TREECHANGE 0x00000004
  262. //Notifies the CPL that the tree styructure has change. On receiving this function
  263. //the CPL rebuilds the subtree at this level and all levels below it.
  264. #define MM_EPS_BLIND_TREECHANGE 0x00000005
  265. //Notification from MIDI sheet that something has changed in the MIDI subtree.
  266. //BLIND because the sheet was not launched from the Adv. Tab, so we dont know
  267. //what the heck he is talking about.
  268. BOOL CALLBACK AddSimpleMidiPages (LPTSTR pszTitle, LPFNMMEXTPROPSHEETCALLBACK lpfnAddPropSheetPage,LPARAM lParam);
  269. BOOL CALLBACK AddMidiPages (LPCTSTR pszTitle, LPFNMMEXTPROPSHEETCALLBACK lpfnAddPropSheetPage,LPARAM lParam);
  270. BOOL CALLBACK AddDevicePages (LPCTSTR pszTitle, LPFNMMEXTPROPSHEETCALLBACK lpfnAddPropSheetPage,LPARAM lParam);
  271. BOOL CALLBACK AddInstrumentPages (LPCTSTR pszTitle, LPFNMMEXTPROPSHEETCALLBACK lpfnAddPropSheetPage,LPARAM lParam);
  272. #ifdef FIX_BUG_15451
  273. void ShowDriverSettings (HWND hDlg, LPTSTR pszName);
  274. #endif // FIX_BUG_15451
  275. #ifdef __cplusplus
  276. } // extern "C"
  277. #endif
  278. #define MIDI_CLASS_PROP 1
  279. #define MIDI_DEVICE_PROP 2
  280. #define MIDI_INSTRUMENT_PROP 3
  281. #define WM_ACMMAP_ACM_NOTIFY (WM_USER + 100)
  282. /*
  283. ***************************************************************
  284. * DEBUG Definitions
  285. ***************************************************************
  286. */
  287. #ifdef ASSERT
  288. #undef ASSERT
  289. #endif
  290. #ifdef DEBUG
  291. #define STATIC
  292. #ifdef DEBUG_TRACE
  293. #define DPF_T dprintf
  294. #else
  295. #define DPF_T 1 ? (void)0 : (void)
  296. #endif
  297. void FAR cdecl dprintf(LPSTR szFormat, ...);
  298. #define DPF dprintf
  299. #define ddd dprintf
  300. #define ASSERT(f) \
  301. { \
  302. if (!(f)) \
  303. DPF("ERROR-ERROR#####: Assertion failed in %s on line %d @@@@@",__FILE__, __LINE__); \
  304. }
  305. #else
  306. #define STATIC static
  307. #define ASSERT(f)
  308. #define DPF 1 ? (void)0 : (void)
  309. #define DPF_T 1 ? (void)0 : (void)
  310. #endif
  311. #endif // MMCPL_H