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.

368 lines
8.8 KiB

  1. //==========================================================================;
  2. //
  3. // mixmgri.h
  4. //
  5. // Copyright (C) 1992-1993 Microsoft Corporation. All Rights Reserved.
  6. //
  7. // Description:
  8. // This header file contains INTERNAL Mixer Manager defines and stuff.
  9. //
  10. // History:
  11. // 6/27/93 cjp [curtisp]
  12. //
  13. //==========================================================================;
  14. #ifndef _INC_MIXMGRI
  15. #define _INC_MIXMGRI // #defined if file has been included
  16. #ifndef RC_INVOKED
  17. #pragma pack(1) // assume byte packing throughout
  18. #endif
  19. #ifndef EXTERN_C
  20. #ifdef __cplusplus
  21. #define EXTERN_C extern "C"
  22. #else
  23. #define EXTERN_C extern
  24. #endif
  25. #endif
  26. #ifdef __cplusplus
  27. extern "C" // assume C declarations for C++
  28. {
  29. #endif
  30. #ifdef DEBUG
  31. #define RDEBUG
  32. #endif
  33. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  34. //
  35. //
  36. //
  37. //
  38. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  39. //
  40. //
  41. //
  42. //
  43. #ifndef FIELD_OFFSET
  44. #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field))
  45. #endif
  46. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  47. //
  48. //
  49. //
  50. //
  51. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  52. //
  53. // WARNING DANGER WARNING DANGER WARNING DANGER WARNING DANGER WARNING
  54. //
  55. // if you change the order of the following defines, you must also fix
  56. // gapszMxMgrFunctions[] in idrvinit.c!
  57. //
  58. // WARNING DANGER WARNING DANGER WARNING DANGER WARNING DANGER WARNING
  59. //
  60. enum {
  61. MXMGRTHUNK_GETNUMDEVS = 0,
  62. #ifdef WIN32
  63. MXMGRTHUNK_GETDEVCAPSA ,
  64. MXMGRTHUNK_GETDEVCAPS ,
  65. #else
  66. MXMGRTHUNK_GETDEVCAPS ,
  67. #endif // WIN32
  68. MXMGRTHUNK_GETID ,
  69. MXMGRTHUNK_OPEN ,
  70. MXMGRTHUNK_CLOSE ,
  71. MXMGRTHUNK_MESSAGE ,
  72. #ifdef WIN32
  73. MXMGRTHUNK_GETLINEINFOA ,
  74. MXMGRTHUNK_GETLINEINFO ,
  75. MXMGRTHUNK_GETLINECONTROLSA ,
  76. MXMGRTHUNK_GETLINECONTROLS ,
  77. MXMGRTHUNK_GETCONTROLDETAILSA ,
  78. MXMGRTHUNK_GETCONTROLDETAILS ,
  79. #else
  80. MXMGRTHUNK_GETLINEINFO ,
  81. MXMGRTHUNK_GETLINECONTROLS ,
  82. MXMGRTHUNK_GETCONTROLDETAILS ,
  83. #endif // WIN32
  84. MXMGRTHUNK_SETCONTROLDETAILS ,
  85. MXMGRTHUNK_MAX_FUNCTIONS
  86. };
  87. extern FARPROC gafnMxMgrFunctions[];
  88. //
  89. //
  90. //
  91. //
  92. UINT FNGLOBAL IMixerGetNumDevs
  93. (
  94. void
  95. );
  96. MMRESULT FNGLOBAL IMixerGetDevCaps
  97. (
  98. UINT uMxId,
  99. LPMIXERCAPS pmxcaps,
  100. UINT cbmxcaps
  101. );
  102. #ifdef WIN32
  103. MMRESULT FNGLOBAL IMixerGetDevCapsA
  104. (
  105. UINT uMxId,
  106. LPMIXERCAPSA pmxcaps,
  107. UINT cbmxcaps
  108. );
  109. #endif // WIN32
  110. MMRESULT FNGLOBAL IMixerGetID
  111. (
  112. HMIXEROBJ hmxobj,
  113. UINT FAR *puMxId,
  114. LPMIXERLINE pmxl,
  115. DWORD fdwId
  116. );
  117. MMRESULT FNGLOBAL IMixerOpen
  118. (
  119. LPHMIXER phmx,
  120. UINT uMxId,
  121. DWORD dwCallback,
  122. DWORD dwInstance,
  123. DWORD fdwOpen
  124. );
  125. MMRESULT FNGLOBAL IMixerClose
  126. (
  127. HMIXER hmx
  128. );
  129. DWORD FNGLOBAL IMixerMessage
  130. (
  131. HMIXER hmx,
  132. UINT uMsg,
  133. DWORD dwParam1,
  134. DWORD dwParam2
  135. );
  136. MMRESULT FNGLOBAL IMixerGetLineInfo
  137. (
  138. HMIXEROBJ hmxobj,
  139. LPMIXERLINE pmxl,
  140. DWORD fdwInfo
  141. );
  142. MMRESULT FNGLOBAL IMixerGetLineControls
  143. (
  144. HMIXEROBJ hmxobj,
  145. LPMIXERLINECONTROLS pmxlc,
  146. DWORD fdwControls
  147. );
  148. MMRESULT FNGLOBAL IMixerGetControlDetails
  149. (
  150. HMIXEROBJ hmxobj,
  151. LPMIXERCONTROLDETAILS pmxcd,
  152. DWORD fdwDetails
  153. );
  154. #ifdef WIN32
  155. MMRESULT FNGLOBAL IMixerGetLineInfoA
  156. (
  157. HMIXEROBJ hmxobj,
  158. LPMIXERLINEA pmxl,
  159. DWORD fdwInfo
  160. );
  161. MMRESULT FNGLOBAL IMixerGetLineControlsA
  162. (
  163. HMIXEROBJ hmxobj,
  164. LPMIXERLINECONTROLSA pmxlc,
  165. DWORD fdwControls
  166. );
  167. MMRESULT FNGLOBAL IMixerGetControlDetailsA
  168. (
  169. HMIXEROBJ hmxobj,
  170. LPMIXERCONTROLDETAILS pmxcd,
  171. DWORD fdwDetails
  172. );
  173. #endif // WIN32
  174. MMRESULT FNGLOBAL IMixerSetControlDetails
  175. (
  176. HMIXEROBJ hmxobj,
  177. LPMIXERCONTROLDETAILS pmxcd,
  178. DWORD fdwDetails
  179. );
  180. //
  181. //
  182. //
  183. //
  184. //
  185. BOOL FNGLOBAL IMixerUnloadDrivers
  186. (
  187. HDRVR hdrvr
  188. );
  189. BOOL FNGLOBAL IMixerLoadDrivers
  190. (
  191. HDRVR hdrvr
  192. );
  193. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  194. //
  195. // -= Handles =-
  196. //
  197. //
  198. //
  199. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  200. //
  201. // No multi-thread synchronization for 16-bit
  202. //
  203. #define ENTER_MM_HANDLE(x) TRUE
  204. #define LEAVE_MM_HANDLE(x)
  205. #define MIXMGR_ENTER
  206. #define MIXMGR_LEAVE
  207. //
  208. // typedef for mxdMessage
  209. //
  210. typedef DWORD (CALLBACK *DRIVERMSGPROC)
  211. (
  212. UINT uId,
  213. UINT uMsg,
  214. DWORD dwInstance,
  215. DWORD dwParam1,
  216. DWORD dwParam2
  217. );
  218. EXTERN_C DWORD FNWCALLBACK mxdMessageHack
  219. (
  220. UINT uDevId,
  221. UINT uMsg,
  222. DWORD dwUser,
  223. DWORD dwParam1,
  224. DWORD dwParam2
  225. );
  226. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  227. //
  228. // -= Parameter Validation =-
  229. //
  230. //
  231. //
  232. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  233. //
  234. // No error logging for Win32
  235. //
  236. #ifdef WIN32
  237. #define LogParamError(a, b, c)
  238. #endif // WIN32
  239. //
  240. //
  241. //
  242. BOOL FNGLOBAL ValidateReadPointer(const void FAR* p, DWORD len);
  243. BOOL FNGLOBAL ValidateWritePointer(const void FAR* p, DWORD len);
  244. BOOL FNGLOBAL ValidateDriverCallback(DWORD dwCallback, UINT uFlags);
  245. BOOL FNGLOBAL ValidateCallback(FARPROC lpfnCallback);
  246. BOOL FNGLOBAL ValidateString(LPCSTR lsz, UINT cbMaxLen);
  247. //
  248. // unless we decide differently, ALWAYS do parameter validation--even
  249. // in retail. this is the 'safest' thing we can do. note that we still
  250. // LOG parameter errors in retail (see prmvalXX).
  251. //
  252. #if 1
  253. #define V_HANDLE(h, t, r) { if (!ValidateHandle(h, t)) return (r); }
  254. #define V_RPOINTER(p, l, r) { if (!ValidateReadPointer((p), (l))) return (r); }
  255. #define V_WPOINTER(p, l, r) { if (!ValidateWritePointer((p), (l))) return (r); }
  256. #define V_DCALLBACK(d, w, r) { if (!ValidateDriverCallback((d), (w))) return (r); }
  257. #define V_CALLBACK(f, r) { if (!ValidateCallback(f)) return (r); }
  258. #define V_STRING(s, l, r) { if (!ValidateString(s,l)) return (r); }
  259. #define V_DFLAGS(t, b, f, r) { if ((t) & ~(b)) {LogParamError(ERR_BAD_DFLAGS, (FARPROC)(f), (LPVOID)(DWORD)(t)); return (r); }}
  260. #define V_FLAGS(t, b, f, r) { if ((t) & ~(b)) {LogParamError(ERR_BAD_FLAGS, (FARPROC)(f), (LPVOID)(DWORD)(t)); return (r); }}
  261. #else
  262. #define V_HANDLE(h, t, r) { if (!(h)) return (r); }
  263. #define V_RPOINTER(p, l, r) { if (!(p)) return (r); }
  264. #define V_WPOINTER(p, l, r) { if (!(p)) return (r); }
  265. #define V_DCALLBACK(d, w, r) 0
  266. #define V_CALLBACK(f, r) { if (!(f)) return (r); }
  267. #define V_STRING(s, l, r) { if (!(s)) return (r); }
  268. #define V_DFLAGS(t, b, f, r) { if ((t) & ~(b)) return (r); }
  269. #define V_FLAGS(t, b, f, r) { if ((t) & ~(b)) return (r); }
  270. #endif
  271. //
  272. // the DV_xxxx macros are for INTERNAL DEBUG builds--aid to debugging.
  273. // we do 'loose' parameter validation in retail and retail debug builds.
  274. //
  275. #ifdef DEBUG
  276. #define DV_HANDLE(h, t, r) V_HANDLE(h, t, r)
  277. #define DV_RPOINTER(p, l, r) V_RPOINTER(p, l, r)
  278. #define DV_WPOINTER(p, l, r) V_WPOINTER(p, l, r)
  279. #define DV_DCALLBACK(d, w, r) V_DCALLBACK(d, w, r)
  280. #define DV_CALLBACK(f, r) V_CALLBACK(f, r)
  281. #define DV_STRING(s, l, r) V_STRING(s, l, r)
  282. #define DV_DFLAGS(t, b, f, r) V_DFLAGS(t, b, f, r)
  283. #define DV_FLAGS(t, b, f, r) V_FLAGS(t, b, f, r)
  284. #else
  285. #define DV_HANDLE(h, t, r) { if (!(h)) return (r); }
  286. #define DV_RPOINTER(p, l, r) { if (!(p)) return (r); }
  287. #define DV_WPOINTER(p, l, r) { if (!(p)) return (r); }
  288. #define DV_DCALLBACK(d, w, r) 0
  289. #define DV_CALLBACK(f, r) { if (!(f)) return (r); }
  290. #define DV_STRING(s, l, r) { if (!(s)) return (r); }
  291. #define DV_DFLAGS(t, b, f, r) { if ((t) & ~(b)) return (r); }
  292. #define DV_FLAGS(t, b, f, r) { if ((t) & ~(b)) return (r); }
  293. #endif
  294. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  295. //
  296. //
  297. //
  298. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  299. #ifndef RC_INVOKED
  300. #pragma pack() // revert to default packing
  301. #endif
  302. #ifdef __cplusplus
  303. } // end of extern "C" {
  304. #endif
  305. #endif // _INC_MIXMGRI