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.

217 lines
10 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:mmsystem.h -- Include file for Multimedia API's
  4. * If defined, the following flags inhibit inclusion
  5. * of the indicated items:
  6. *
  7. * MMNOSOUND Sound support
  8. * MMNOWAVE Waveform support
  9. *
  10. */
  11. #ifndef _INC_MMIO
  12. #define _INC_MMIO // to prevent multiple inclusion of mmsystem.h
  13. #include "pshpack1.h" // Assume byte packing throughout
  14. #ifdef __cplusplus
  15. extern "C" { // Assume C declarations for C++
  16. #endif // __cplusplus
  17. #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
  18. ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
  19. ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
  20. #define mmioFOURCC(ch0, ch1, ch2, ch3) MAKEFOURCC(ch0, ch1, ch2, ch3)
  21. extern HANDLE hHeap;
  22. //extern PHNDL pHandleList;
  23. extern CRITICAL_SECTION HandleListCritSec;
  24. #ifndef MMNOMMIO
  25. /****************************************************************************
  26. Multimedia File I/O support
  27. ****************************************************************************/
  28. /* MMIO error return values */
  29. #define MMIOERR_BASE 256
  30. #define MMIOERR_FILENOTFOUND (MMIOERR_BASE + 1) /* file not found */
  31. #define MMIOERR_OUTOFMEMORY (MMIOERR_BASE + 2) /* out of memory */
  32. #define MMIOERR_CANNOTOPEN (MMIOERR_BASE + 3) /* cannot open */
  33. #define MMIOERR_CANNOTCLOSE (MMIOERR_BASE + 4) /* cannot close */
  34. #define MMIOERR_CANNOTREAD (MMIOERR_BASE + 5) /* cannot read */
  35. #define MMIOERR_CANNOTWRITE (MMIOERR_BASE + 6) /* cannot write */
  36. #define MMIOERR_CANNOTSEEK (MMIOERR_BASE + 7) /* cannot seek */
  37. #define MMIOERR_CANNOTEXPAND (MMIOERR_BASE + 8) /* cannot expand file */
  38. #define MMIOERR_CHUNKNOTFOUND (MMIOERR_BASE + 9) /* chunk not found */
  39. #define MMIOERR_UNBUFFERED (MMIOERR_BASE + 10) /* */
  40. #define MMIOERR_PATHNOTFOUND (MMIOERR_BASE + 11) /* path incorrect */
  41. #define MMIOERR_ACCESSDENIED (MMIOERR_BASE + 12) /* file was protected */
  42. #define MMIOERR_SHARINGVIOLATION (MMIOERR_BASE + 13) /* file in use */
  43. #define MMIOERR_NETWORKERROR (MMIOERR_BASE + 14) /* network not responding */
  44. #define MMIOERR_TOOMANYOPENFILES (MMIOERR_BASE + 15) /* no more file handles */
  45. #define MMIOERR_INVALIDFILE (MMIOERR_BASE + 16) /* default error file error */
  46. /* MMIO constants */
  47. #define CFSEPCHAR '+' /* compound file name separator char. */
  48. /* MMIO data types */
  49. typedef LPSTR HPSTR; /* a huge str pointer (old) */
  50. typedef DWORD FOURCC; /* a four character code */
  51. //DECLARE_HANDLE(HMMIO); /* a handle to an open file */
  52. typedef LRESULT (CALLBACK MMIOPROC)(LPSTR lpmmioinfo, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
  53. typedef MMIOPROC FAR *LPMMIOPROC;
  54. /* general MMIO information data structure */
  55. typedef struct _MMIOINFO
  56. {
  57. /* general fields */
  58. DWORD dwFlags; /* general status flags */
  59. FOURCC fccIOProc; /* pointer to I/O procedure */
  60. LPMMIOPROC pIOProc; /* pointer to I/O procedure */
  61. UINT wErrorRet; /* place for error to be returned */
  62. HTASK htask; /* alternate local task */
  63. /* fields maintained by MMIO functions during buffered I/O */
  64. LONG cchBuffer; /* size of I/O buffer (or 0L) */
  65. LPSTR pchBuffer; /* start of I/O buffer (or NULL) */
  66. LPSTR pchNext; /* pointer to next byte to read/write */
  67. LPSTR pchEndRead; /* pointer to last valid byte to read */
  68. LPSTR pchEndWrite; /* pointer to last byte to write */
  69. LONG lBufOffset; /* disk offset of start of buffer */
  70. /* fields maintained by I/O procedure */
  71. LONG lDiskOffset; /* disk offset of next read or write */
  72. DWORD adwInfo[3]; /* data specific to type of MMIOPROC */
  73. /* other fields maintained by MMIO */
  74. DWORD dwReserved1; /* reserved for MMIO use */
  75. DWORD dwReserved2; /* reserved for MMIO use */
  76. HMMIO hmmio; /* handle to open file */
  77. } MMIOINFO, *PMMIOINFO, NEAR *NPMMIOINFO, FAR *LPMMIOINFO;
  78. typedef const MMIOINFO FAR *LPCMMIOINFO;
  79. /* RIFF chunk information data structure */
  80. typedef struct _MMCKINFO
  81. {
  82. FOURCC ckid; /* chunk ID */
  83. DWORD cksize; /* chunk size */
  84. FOURCC fccType; /* form type or list type */
  85. DWORD dwDataOffset; /* offset of data portion of chunk */
  86. DWORD dwFlags; /* flags used by MMIO functions */
  87. } MMCKINFO, *PMMCKINFO, NEAR *NPMMCKINFO, FAR *LPMMCKINFO;
  88. typedef const MMCKINFO *LPCMMCKINFO;
  89. /* bit field masks */
  90. #define MMIO_RWMODE 0x00000003 /* open file for reading/writing/both */
  91. #define MMIO_SHAREMODE 0x00000070 /* file sharing mode number */
  92. /* constants for dwFlags field of MMIOINFO */
  93. #define MMIO_CREATE 0x00001000 /* create new file (or truncate file) */
  94. #define MMIO_PARSE 0x00000100 /* parse new file returning path */
  95. #define MMIO_DELETE 0x00000200 /* create new file (or truncate file) */
  96. #define MMIO_EXIST 0x00004000 /* checks for existence of file */
  97. #define MMIO_ALLOCBUF 0x00010000 /* mmioOpen() should allocate a buffer */
  98. #define MMIO_GETTEMP 0x00020000 /* mmioOpen() should retrieve temp name */
  99. #define MMIO_DIRTY 0x10000000 /* I/O buffer is dirty */
  100. /* read/write mode numbers (bit field MMIO_RWMODE) */
  101. #define MMIO_READ 0x00000000 /* open file for reading only */
  102. #define MMIO_WRITE 0x00000001 /* open file for writing only */
  103. #define MMIO_READWRITE 0x00000002 /* open file for reading and writing */
  104. /* share mode numbers (bit field MMIO_SHAREMODE) */
  105. #define MMIO_COMPAT 0x00000000 /* compatibility mode */
  106. #define MMIO_EXCLUSIVE 0x00000010 /* exclusive-access mode */
  107. #define MMIO_DENYWRITE 0x00000020 /* deny writing to other processes */
  108. #define MMIO_DENYREAD 0x00000030 /* deny reading to other processes */
  109. #define MMIO_DENYNONE 0x00000040 /* deny nothing to other processes */
  110. /* various MMIO flags */
  111. #define MMIO_FHOPEN 0x0010 /* mmioClose: keep file handle open */
  112. #define MMIO_EMPTYBUF 0x0010 /* mmioFlush: empty the I/O buffer */
  113. #define MMIO_TOUPPER 0x0010 /* mmioStringToFOURCC: to u-case */
  114. #define MMIO_INSTALLPROC 0x00010000 /* mmioInstallIOProc: install MMIOProc */
  115. #define MMIO_GLOBALPROC 0x10000000 /* mmioInstallIOProc: install globally */
  116. #define MMIO_REMOVEPROC 0x00020000 /* mmioInstallIOProc: remove MMIOProc */
  117. #define MMIO_UNICODEPROC 0x01000000 /* mmioInstallIOProc: Unicode MMIOProc */
  118. #define MMIO_FINDPROC 0x00040000 /* mmioInstallIOProc: find an MMIOProc */
  119. #define MMIO_FINDCHUNK 0x0010 /* mmioDescend: find a chunk by ID */
  120. #define MMIO_FINDRIFF 0x0020 /* mmioDescend: find a LIST chunk */
  121. #define MMIO_FINDLIST 0x0040 /* mmioDescend: find a RIFF chunk */
  122. #define MMIO_CREATERIFF 0x0020 /* mmioCreateChunk: make a LIST chunk */
  123. #define MMIO_CREATELIST 0x0040 /* mmioCreateChunk: make a RIFF chunk */
  124. /* message numbers for MMIOPROC I/O procedure functions */
  125. #define MMIOM_READ MMIO_READ /* read */
  126. #define MMIOM_WRITE MMIO_WRITE /* write */
  127. #define MMIOM_SEEK 2 /* seek to a new position in file */
  128. #define MMIOM_OPEN 3 /* open file */
  129. #define MMIOM_CLOSE 4 /* close file */
  130. #define MMIOM_WRITEFLUSH 5 /* write and flush */
  131. #define MMIOM_RENAME 6 /* rename specified file */
  132. #define MMIOM_USER 0x8000 /* beginning of user-defined messages */
  133. /* standard four character codes */
  134. #define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F')
  135. #define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T')
  136. /* four character codes used to identify standard built-in I/O procedures */
  137. #define FOURCC_DOS mmioFOURCC('D', 'O', 'S', ' ')
  138. #define FOURCC_MEM mmioFOURCC('M', 'E', 'M', ' ')
  139. /* flags for mmioSeek() */
  140. #ifndef SEEK_SET
  141. #define SEEK_SET 0 /* seek to an absolute position */
  142. #define SEEK_CUR 1 /* seek relative to current position */
  143. #define SEEK_END 2 /* seek relative to end of file */
  144. #endif /* ifndef SEEK_SET */
  145. /* other constants */
  146. #define MMIO_DEFAULTBUFFER 8192 /* default buffer size */
  147. /* MMIO macros */
  148. #define mmioFOURCC(ch0, ch1, ch2, ch3) MAKEFOURCC(ch0, ch1, ch2, ch3)
  149. /* MMIO function prototypes */
  150. FOURCC WINAPI mmioStringToFOURCC(LPCTSTR sz, UINT uFlags);
  151. LPMMIOPROC WINAPI mmioInstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc, DWORD dwFlags);
  152. HMMIO WINAPI mmioOpen(LPWSTR pszFileName, LPMMIOINFO pmmioinfo, DWORD fdwOpen);
  153. MMRESULT WINAPI mmioRename(LPCWSTR pszFileName, LPCWSTR pszNewFileName, LPCMMIOINFO pmmioinfo, DWORD fdwRename);
  154. MMRESULT WINAPI mmioClose( HMMIO hmmio, UINT fuClose);
  155. LONG WINAPI mmioRead( HMMIO hmmio, LPSTR pch, LONG cch);
  156. LONG WINAPI mmioWrite( HMMIO hmmio, LPCSTR pch, LONG cch);
  157. LONG WINAPI mmioSeek( HMMIO hmmio, LONG lOffset, int iOrigin);
  158. MMRESULT WINAPI mmioGetInfo( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuInfo);
  159. MMRESULT WINAPI mmioSetInfo( HMMIO hmmio, LPCMMIOINFO pmmioinfo, UINT fuInfo);
  160. MMRESULT WINAPI mmioSetBuffer( HMMIO hmmio, LPSTR pchBuffer, LONG cchBuffer, UINT fuBuffer);
  161. MMRESULT WINAPI mmioFlush( HMMIO hmmio, UINT fuFlush);
  162. MMRESULT WINAPI mmioAdvance( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuAdvance);
  163. LRESULT WINAPI mmioSendMessage( HMMIO hmmio, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
  164. MMRESULT WINAPI mmioDescend( HMMIO hmmio, LPMMCKINFO pmmcki, const MMCKINFO FAR* pmmckiParent, UINT fuDescend);
  165. MMRESULT WINAPI mmioAscend( HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuAscend);
  166. MMRESULT WINAPI mmioCreateChunk( HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuCreate);
  167. #endif /* ifndef MMNOMMIO */
  168. #ifdef __cplusplus
  169. } // End of extern "C" {
  170. #endif // __cplusplus
  171. #include "poppack.h" /* Revert to default packing */
  172. #endif // _INC_MMSYSTEM