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.

311 lines
13 KiB

  1. /*++ BUILD Version: 0001
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WMMEDIA.H
  8. * WOW32 16-bit MultiMedia API support
  9. *
  10. * History:
  11. * Created 21-Jan-1992 by Mike Tricker (MikeTri), after jeffpar
  12. * Changed 30-Apr-1992 by Mike Tricker (MikeTri) Added callback prototypes and structs
  13. * 30-Jul-1992 by Stephen Estrop (StephenE) Added MCCICommand Thunk stuff
  14. --*/
  15. #define MMGETOPTPTR(vp,cb,p) {p=NULL; if (HIWORD(FETCHDWORD(vp))) GETVDMPTR(vp,cb,p);}
  16. /*++
  17. Enumeration handler data for the six callback types:
  18. --*/
  19. typedef struct _TIMEDATA { /* timedata */
  20. VPPROC vpfnTimeFunc; // 16 bit enumeration function
  21. DWORD dwUserParam; // user param, if required
  22. DWORD dwFlags; // flags, ieTIME_ONESHOT or TIME_PERIODIC
  23. } TIMEDATA, *PTIMEDATA;
  24. /*
  25. * A couple of handy structures that probably ought to be elsewhere.
  26. */
  27. typedef struct _INSTANCEDATA {
  28. DWORD dwCallback; //Callback function or window handle
  29. DWORD dwCallbackInstance; //Instance data for callback function (only)
  30. DWORD dwFlags; //Flags
  31. } INSTANCEDATA, *PINSTANCEDATA;
  32. typedef struct _WAVEHDR32 {
  33. PWAVEHDR16 pWavehdr32; //32 bit address to 16 bit WAVEHDR
  34. PWAVEHDR16 pWavehdr16; //16 bit address to 16 bit WAVEHDR
  35. WAVEHDR Wavehdr; //32 bit address to 32 bit WAVEHDR
  36. } WAVEHDR32, *PWAVEHDR32;
  37. typedef struct _MIDIHDR32 {
  38. PMIDIHDR16 pMidihdr32; //32 bit address to 16 bit MIDIHDR
  39. PMIDIHDR16 pMidihdr16; //16 bit address to 16 bit MIDIHDR
  40. MIDIHDR Midihdr; //32 bit address to 32 bit MIDIHDR
  41. } MIDIHDR32, *PMIDIHDR32;
  42. /*++
  43. Function Prototypes:
  44. --*/
  45. ULONG FASTCALL WMM32CallProc32( PVDMFRAME pFrame );
  46. ULONG FASTCALL WMM32sndPlaySound(PVDMFRAME pFrame);
  47. ULONG FASTCALL WMM32mmsystemGetVersion(PVDMFRAME pFrame);
  48. ULONG FASTCALL WMM32OutputDebugStr(PVDMFRAME pFrame);
  49. ULONG FASTCALL WMM32DriverCallback(PVDMFRAME pFrame);
  50. ULONG FASTCALL WMM32joyGetNumDevs(PVDMFRAME pFrame);
  51. ULONG FASTCALL WMM32joyGetDevCaps(PVDMFRAME pFrame);
  52. ULONG FASTCALL WMM32joyGetPos(PVDMFRAME pFrame);
  53. ULONG FASTCALL WMM32joyGetThreshold(PVDMFRAME pFrame);
  54. ULONG FASTCALL WMM32joyReleaseCapture(PVDMFRAME pFrame);
  55. ULONG FASTCALL WMM32joySetCapture(PVDMFRAME pFrame);
  56. ULONG FASTCALL WMM32joySetThreshold(PVDMFRAME pFrame);
  57. ULONG FASTCALL WMM32joySetCalibration(PVDMFRAME pFrame);
  58. ULONG FASTCALL WMM32midiOutGetNumDevs(PVDMFRAME pFrame);
  59. ULONG FASTCALL WMM32midiOutGetDevCaps(PVDMFRAME pFrame);
  60. ULONG FASTCALL WMM32midiOutGetErrorText(PVDMFRAME pFrame);
  61. ULONG FASTCALL WMM32midiOutOpen(PVDMFRAME pFrame);
  62. ULONG FASTCALL WMM32midiOutClose(PVDMFRAME pFrame);
  63. ULONG FASTCALL WMM32midiOutPrepareHeader(PVDMFRAME pFrame);
  64. ULONG FASTCALL WMM32midiOutUnprepareHeader(PVDMFRAME pFrame);
  65. ULONG FASTCALL WMM32midiOutShortMsg(PVDMFRAME pFrame);
  66. ULONG FASTCALL WMM32midiOutLongMsg(PVDMFRAME pFrame);
  67. ULONG FASTCALL WMM32midiOutReset(PVDMFRAME pFrame);
  68. ULONG FASTCALL WMM32midiOutGetVolume(PVDMFRAME pFrame);
  69. ULONG FASTCALL WMM32midiOutSetVolume(PVDMFRAME pFrame);
  70. ULONG FASTCALL WMM32midiOutCachePatches(PVDMFRAME pFrame);
  71. ULONG FASTCALL WMM32midiOutCacheDrumPatches(PVDMFRAME pFrame);
  72. ULONG FASTCALL WMM32midiOutGetID(PVDMFRAME pFrame);
  73. ULONG FASTCALL WMM32midiOutMessage(PVDMFRAME pFrame);
  74. ULONG FASTCALL WMM32midiInGetNumDevs(PVDMFRAME pFrame);
  75. ULONG FASTCALL WMM32midiInGetDevCaps(PVDMFRAME pFrame);
  76. ULONG FASTCALL WMM32midiInGetErrorText(PVDMFRAME pFrame);
  77. ULONG FASTCALL WMM32midiInOpen(PVDMFRAME pFrame);
  78. ULONG FASTCALL WMM32midiInClose(PVDMFRAME pFrame);
  79. ULONG FASTCALL WMM32midiInPrepareHeader(PVDMFRAME pFrame);
  80. ULONG FASTCALL WMM32midiInUnprepareHeader(PVDMFRAME pFrame);
  81. ULONG FASTCALL WMM32midiInAddBuffer(PVDMFRAME pFrame);
  82. ULONG FASTCALL WMM32midiInStart(PVDMFRAME pFrame);
  83. ULONG FASTCALL WMM32midiInStop(PVDMFRAME pFrame);
  84. ULONG FASTCALL WMM32midiInReset(PVDMFRAME pFrame);
  85. ULONG FASTCALL WMM32midiInGetID(PVDMFRAME pFrame);
  86. ULONG FASTCALL WMM32midiInMessage(PVDMFRAME pFrame);
  87. ULONG FASTCALL WMM32auxGetNumDevs(PVDMFRAME pFrame);
  88. ULONG FASTCALL WMM32auxGetDevCaps(PVDMFRAME pFrame);
  89. ULONG FASTCALL WMM32auxGetVolume(PVDMFRAME pFrame);
  90. ULONG FASTCALL WMM32auxSetVolume(PVDMFRAME pFrame);
  91. ULONG FASTCALL WMM32auxOutMessage(PVDMFRAME pFrame);
  92. ULONG FASTCALL WMM32waveOutGetNumDevs(PVDMFRAME pFrame);
  93. ULONG FASTCALL WMM32waveOutGetDevCaps(PVDMFRAME pFrame);
  94. ULONG FASTCALL WMM32waveOutGetErrorText(PVDMFRAME pFrame);
  95. ULONG FASTCALL WMM32waveOutOpen(PVDMFRAME pFrame);
  96. ULONG FASTCALL WMM32waveOutClose(PVDMFRAME pFrame);
  97. ULONG FASTCALL WMM32waveOutPrepareHeader(PVDMFRAME pFrame);
  98. ULONG FASTCALL WMM32waveOutUnprepareHeader(PVDMFRAME pFrame);
  99. ULONG FASTCALL WMM32waveOutWrite(PVDMFRAME pFrame);
  100. ULONG FASTCALL WMM32waveOutPause(PVDMFRAME pFrame);
  101. ULONG FASTCALL WMM32waveOutRestart(PVDMFRAME pFrame);
  102. ULONG FASTCALL WMM32waveOutReset(PVDMFRAME pFrame);
  103. ULONG FASTCALL WMM32waveOutGetPosition(PVDMFRAME pFrame);
  104. ULONG FASTCALL WMM32waveOutGetPitch(PVDMFRAME pFrame);
  105. ULONG FASTCALL WMM32waveOutSetPitch(PVDMFRAME pFrame);
  106. ULONG FASTCALL WMM32waveOutGetVolume(PVDMFRAME pFrame);
  107. ULONG FASTCALL WMM32waveOutSetVolume(PVDMFRAME pFrame);
  108. ULONG FASTCALL WMM32waveOutGetPlaybackRate(PVDMFRAME pFrame);
  109. ULONG FASTCALL WMM32waveOutSetPlaybackRate(PVDMFRAME pFrame);
  110. ULONG FASTCALL WMM32waveOutBreakLoop(PVDMFRAME pFrame);
  111. ULONG FASTCALL WMM32waveOutGetID(PVDMFRAME pFrame);
  112. ULONG FASTCALL WMM32waveOutMessage(PVDMFRAME pFrame);
  113. ULONG FASTCALL WMM32waveInGetNumDevs(PVDMFRAME pFrame);
  114. ULONG FASTCALL WMM32waveInGetDevCaps(PVDMFRAME pFrame);
  115. ULONG FASTCALL WMM32waveInGetErrorText(PVDMFRAME pFrame);
  116. ULONG FASTCALL WMM32waveInOpen(PVDMFRAME pFrame);
  117. ULONG FASTCALL WMM32waveInClose(PVDMFRAME pFrame);
  118. ULONG FASTCALL WMM32waveInPrepareHeader(PVDMFRAME pFrame);
  119. ULONG FASTCALL WMM32waveInUnprepareHeader(PVDMFRAME pFrame);
  120. ULONG FASTCALL WMM32waveInAddBuffer(PVDMFRAME pFrame);
  121. ULONG FASTCALL WMM32waveInStart(PVDMFRAME pFrame);
  122. ULONG FASTCALL WMM32waveInStop(PVDMFRAME pFrame);
  123. ULONG FASTCALL WMM32waveInReset(PVDMFRAME pFrame);
  124. ULONG FASTCALL WMM32waveInGetPosition(PVDMFRAME pFrame);
  125. ULONG FASTCALL WMM32waveInGetID(PVDMFRAME pFrame);
  126. ULONG FASTCALL WMM32waveInMessage(PVDMFRAME pFrame);
  127. ULONG FASTCALL WMM32timeGetSystemTime(PVDMFRAME pFrame);
  128. ULONG FASTCALL WMM32timeGetTime(PVDMFRAME pFrame);
  129. VOID W32TimeFunc(UINT wID, UINT wMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
  130. ULONG FASTCALL WMM32timeSetEvent(PVDMFRAME pFrame);
  131. ULONG FASTCALL WMM32timeKillEvent(PVDMFRAME pFrame);
  132. ULONG FASTCALL WMM32timeGetDevCaps(PVDMFRAME pFrame);
  133. ULONG FASTCALL WMM32timeBeginPeriod(PVDMFRAME pFrame);
  134. ULONG FASTCALL WMM32timeEndPeriod(PVDMFRAME pFrame);
  135. ULONG FASTCALL WMM32mciSendCommand(PVDMFRAME pFrame);
  136. ULONG FASTCALL WMM32mciSendString(PVDMFRAME pFrame);
  137. ULONG FASTCALL WMM32mciGetDeviceID(PVDMFRAME pFrame);
  138. ULONG FASTCALL WMM32mciGetErrorString(PVDMFRAME pFrame);
  139. ULONG FASTCALL WMM32mciExecute(PVDMFRAME pFrame);
  140. ULONG FASTCALL WMM32mciGetDeviceIDFromElementID(PVDMFRAME pFrame);
  141. ULONG FASTCALL WMM32mciGetCreatorTask(PVDMFRAME pFrame);
  142. ULONG FASTCALL WMM32mciSetYieldProc(PVDMFRAME pFrame);
  143. ULONG FASTCALL WMM32mciGetYieldProc(PVDMFRAME pFrame);
  144. BOOL APIENTRY WOW32DriverCallback(
  145. DWORD dwCallback, DWORD dwFlags, WORD wID, WORD wMsg,
  146. DWORD dwUser, DWORD dw1, DWORD dw2 );
  147. UINT WMM32mciYieldProc( MCIDEVICEID wDeviceID, DWORD dwYieldData );
  148. VOID W32CommonDeviceOpen( HANDLE handle, UINT uMsg, DWORD dwInstance,
  149. DWORD dwParam1, DWORD dwParam2);
  150. ULONG FASTCALL WMM32NotifyCallbackData(PVDMFRAME pFrame);
  151. FARPROC Get_MultiMedia_ProcAddress( LPSTR lpstrProcName );
  152. #define GET_MULTIMEDIA_API( name, proc, error ) \
  153. if ( (proc) == NULL ) { \
  154. (proc) = Get_MultiMedia_ProcAddress( (name) ); \
  155. if ( (proc) == NULL ) { \
  156. RETURN( (error) ); \
  157. } \
  158. }
  159. #define MIN_WOW_TIME_PERIOD 0x10
  160. /* -----------------------------------------------------------------------
  161. *
  162. * MCI Command Thunks
  163. *
  164. * ----------------------------------------------------------------------- */
  165. /**************************************************************************\
  166. *
  167. * MCI Command Thunks function prototypes.
  168. *
  169. \**************************************************************************/
  170. INT ThunkMciCommand16( MCIDEVICEID OrigDevice, UINT OrigCommand, DWORD OrigFlags,
  171. DWORD OrigParms, PDWORD pNewParms, LPWSTR *lplpCommand,
  172. PUINT puTable );
  173. INT UnThunkMciCommand16( MCIDEVICEID devID, UINT OrigCommand, DWORD OrigFlags,
  174. DWORD OrigParms, DWORD NewParms, LPWSTR lpCommand,
  175. UINT uTable );
  176. DWORD AllocMciParmBlock( PDWORD pOrigFlags, DWORD OrigParms );
  177. UINT GetSizeOfParameter( LPWSTR lpCommand );
  178. /*************************************************************************\
  179. * Thunk Command Parms IN
  180. \*************************************************************************/
  181. INT ThunkCommandViaTable( LPWSTR lpCommand, DWORD OrigFlags, DWORD OrigParms,
  182. DWORD pNewParms );
  183. DWORD ThunkBreakCmd ( PDWORD pOrigFlags, DWORD OrigParms, DWORD pNewParms );
  184. DWORD ThunkSysInfoCmd( PDWORD pOrigFlags, DWORD OrigParms, DWORD pNewParms );
  185. DWORD ThunkOpenCmd ( PDWORD pOrigFlags, DWORD OrigParms, DWORD pNewParms );
  186. DWORD ThunkSetCmd ( MCIDEVICEID DeviceID, PDWORD pOrigFlags,
  187. DWORD OrigParms, DWORD pNewParms );
  188. DWORD ThunkWindowCmd ( MCIDEVICEID DeviceID, PDWORD pOrigFlags,
  189. DWORD OrigParms, DWORD pNewParms );
  190. DWORD ThunkSetVideoCmd( MCIDEVICEID DeviceID, PDWORD pOrigFlags,
  191. DWORD OrigParms, DWORD pNewParms );
  192. /*************************************************************************\
  193. * Thunk Command Parms OUT
  194. \*************************************************************************/
  195. INT UnThunkCommandViaTable( LPWSTR lpCommand, DWORD OrigFlags, DWORD OrigParms,
  196. DWORD pNewParms, BOOL fReturnValNotThunked );
  197. VOID UnThunkSysInfoCmd( DWORD OrigFlags, DWORD OrigParms, DWORD NewParms );
  198. VOID UnThunkOpenCmd( DWORD OrigFlags, DWORD OrigParms, DWORD NewParms );
  199. VOID UnThunkStatusCmd( MCIDEVICEID devID, DWORD OrigFlags,
  200. DWORD OrigParms, DWORD NewParms );
  201. #if DBG
  202. /* -----------------------------------------------------------------------
  203. *
  204. * MCI Command Thunks Debugging Functions and Macros
  205. *
  206. * ----------------------------------------------------------------------- */
  207. typedef struct {
  208. UINT uMsg;
  209. LPSTR lpstMsgName;
  210. } MCI_MESSAGE_NAMES;
  211. extern int mmDebugLevel;
  212. extern int mmTraceWave;
  213. extern int mmTraceMidi;
  214. extern MCI_MESSAGE_NAMES mciMessageNames[32];
  215. extern VOID wow32MciSetDebugLevel( VOID );
  216. extern VOID wow32MciDebugOutput( LPSTR lpstrFormatStr, ... );
  217. #define dprintf( _x_ ) wow32MciDebugOutput _x_
  218. #define dprintf1( _x_ ) if (mmDebugLevel >= 1) {wow32MciDebugOutput _x_ ;} else
  219. #define dprintf2( _x_ ) if (mmDebugLevel >= 2) {wow32MciDebugOutput _x_ ;} else
  220. #define dprintf3( _x_ ) if (mmDebugLevel >= 3) {wow32MciDebugOutput _x_ ;} else
  221. #define dprintf4( _x_ ) if (mmDebugLevel >= 4) {wow32MciDebugOutput _x_ ;} else
  222. #define dprintf5( _x_ ) if (mmDebugLevel >= 5) {wow32MciDebugOutput _x_ ;} else
  223. #define trace_wave( _x_ ) if (mmTraceWave) {wow32MciDebugOutput _x_ ;} else
  224. #define trace_midi( _x_ ) if (mmTraceMidi) {wow32MciDebugOutput _x_ ;} else
  225. #define trace_aux( _x_ ) if (mmTraceAux) {wow32MciDebugOutput _x_ ;} else
  226. #define trace_joy( _x_ ) if (mmTraceJoy) {wow32MciDebugOutput _x_ ;} else
  227. #else
  228. #define dprintf( _x_ )
  229. #define dprintf1( _x_ )
  230. #define dprintf2( _x_ )
  231. #define dprintf3( _x_ )
  232. #define dprintf4( _x_ )
  233. #define dprintf5( _x_ )
  234. #define trace_wave( _x_ )
  235. #define trace_midi( _x_ )
  236. #define trace_aux( _x_ )
  237. #define trace_joy( _x_ )
  238. #endif
  239. /* Stuff needed for MCI thunking. Defined in MEDIA\WINMM\MCI.H but here
  240. * until a common place can be found
  241. */
  242. extern BOOL WINAPI mciExecute (LPCSTR lpstrCommand);
  243. extern LPWSTR FindCommandItem (MCIDEVICEID wDeviceID, LPCWSTR lpstrType,
  244. LPCWSTR lpstrCommand, PUINT lpwMessage,
  245. PUINT lpwTable);
  246. extern UINT mciEatCommandEntry(LPCWSTR lpEntry, LPDWORD lpValue, PUINT lpID);
  247. extern UINT mciGetParamSize (DWORD dwValue, UINT wID);
  248. extern BOOL mciUnlockCommandTable (UINT wCommandTable);
  249. #define MCI_MAX_PARAM_SLOTS 20
  250. //
  251. // This typedef is used to remove a compiler warning caused by implementing
  252. // the dynamic linking of Multi-Media from WOW.
  253. //
  254. typedef LPWSTR (*FINDCMDITEM)(MCIDEVICEID wDeviceID, LPCWSTR lpstrType,
  255. LPCWSTR lpstrCommand, PUINT lpwMessage,
  256. PUINT lpwTable);