| 1 | /* -*- tab-width: 8; c-basic-offset: 4 -*- */ | 
|---|
| 2 |  | 
|---|
| 3 | /***************************************************************************** | 
|---|
| 4 | * Copyright 1998, Luiz Otavio L. Zorzella | 
|---|
| 5 | *           1999, Eric Pouech | 
|---|
| 6 | * | 
|---|
| 7 | * File:      winemm.h | 
|---|
| 8 | * Purpose:   multimedia declarations (internal to WINMM & MMSYSTEM DLLs) | 
|---|
| 9 | * | 
|---|
| 10 | ***************************************************************************** | 
|---|
| 11 | */ | 
|---|
| 12 |  | 
|---|
| 13 | #include "mmddk.h" | 
|---|
| 14 |  | 
|---|
| 15 | #ifdef __WIN32OS2__ | 
|---|
| 16 | typedef DWORD (* WINAPIMessageProc16)(UINT16 wDevID, UINT16 wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 17 | typedef DWORD (* WINAPIMessageProc32)(UINT wDevID, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 18 | #else | 
|---|
| 19 | typedef DWORD WINAPI (*MessageProc16)(UINT16 wDevID, UINT16 wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 20 | typedef DWORD WINAPI (*MessageProc32)(UINT wDevID, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 21 | #endif | 
|---|
| 22 |  | 
|---|
| 23 | /* Who said goofy boy ? */ | 
|---|
| 24 | #define WINE_DI_MAGIC   0x900F1B01 | 
|---|
| 25 |  | 
|---|
| 26 | typedef struct tagWINE_DRIVER | 
|---|
| 27 | { | 
|---|
| 28 | DWORD                       dwMagic; | 
|---|
| 29 | /* as usual LPWINE_DRIVER == hDriver32 */ | 
|---|
| 30 | DWORD                       dwFlags; | 
|---|
| 31 | union { | 
|---|
| 32 | struct { | 
|---|
| 33 | HMODULE                     hModule; | 
|---|
| 34 | DRIVERPROC                  lpDrvProc; | 
|---|
| 35 | DWORD                       dwDriverID; | 
|---|
| 36 | } d32; | 
|---|
| 37 | struct { | 
|---|
| 38 | HDRVR16                     hDriver16; | 
|---|
| 39 | } d16; | 
|---|
| 40 | } d; | 
|---|
| 41 | struct tagWINE_DRIVER*      lpPrevItem; | 
|---|
| 42 | struct tagWINE_DRIVER*      lpNextItem; | 
|---|
| 43 | } WINE_DRIVER, *LPWINE_DRIVER; | 
|---|
| 44 |  | 
|---|
| 45 | typedef struct tagWINE_MLD { | 
|---|
| 46 | /* EPP struct tagWINE_MLD*      lpNext; */              /* not used so far */ | 
|---|
| 47 | UINT                     uDeviceID; | 
|---|
| 48 | UINT                     type; | 
|---|
| 49 | UINT                     mmdIndex;               /* index to low-level driver in MMDrvs table */ | 
|---|
| 50 | DWORD                    dwDriverInstance;       /* this value is driver related, as opposed to | 
|---|
| 51 | * opendesc.dwInstance which is client (callback) related */ | 
|---|
| 52 | WORD                     bFrom32; | 
|---|
| 53 | WORD                     dwFlags; | 
|---|
| 54 | DWORD                    dwCallback; | 
|---|
| 55 | DWORD                    dwClientInstance; | 
|---|
| 56 | } WINE_MLD, *LPWINE_MLD; | 
|---|
| 57 |  | 
|---|
| 58 | typedef struct  { | 
|---|
| 59 | WINE_MLD                 mld; | 
|---|
| 60 | } WINE_WAVE, *LPWINE_WAVE; | 
|---|
| 61 |  | 
|---|
| 62 | typedef struct { | 
|---|
| 63 | WINE_MLD                 mld; | 
|---|
| 64 | MIDIOPENDESC             mod;                    /* FIXME: should be removed */ | 
|---|
| 65 | } WINE_MIDI, *LPWINE_MIDI; | 
|---|
| 66 |  | 
|---|
| 67 | typedef struct { | 
|---|
| 68 | WINE_MLD                 mld; | 
|---|
| 69 | } WINE_MIXER, *LPWINE_MIXER; | 
|---|
| 70 |  | 
|---|
| 71 | extern  BOOL            MMDRV_Init(void); | 
|---|
| 72 | extern  UINT            MMDRV_GetNum(UINT); | 
|---|
| 73 | extern  LPWINE_MLD      MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags, | 
|---|
| 74 | DWORD* dwCallback, DWORD* dwInstance, BOOL bFrom32); | 
|---|
| 75 | extern  void            MMDRV_Free(HANDLE hndl, LPWINE_MLD mld); | 
|---|
| 76 | extern  DWORD           MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 77 | extern  DWORD           MMDRV_Close(LPWINE_MLD mld, UINT wMsg); | 
|---|
| 78 | extern  LPWINE_MLD      MMDRV_Get(HANDLE hndl, UINT type, BOOL bCanBeID); | 
|---|
| 79 | extern  LPWINE_MLD      MMDRV_GetRelated(HANDLE hndl, UINT srcType, BOOL bSrcCanBeID, UINT dstTyped); | 
|---|
| 80 | extern  DWORD           MMDRV_Message(LPWINE_MLD mld, WORD wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32); | 
|---|
| 81 | extern  UINT            MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 82 |  | 
|---|
| 83 | #define MMDRV_AUX               0 | 
|---|
| 84 | #define MMDRV_MIXER             1 | 
|---|
| 85 | #define MMDRV_MIDIIN            2 | 
|---|
| 86 | #define MMDRV_MIDIOUT           3 | 
|---|
| 87 | #define MMDRV_WAVEIN            4 | 
|---|
| 88 | #define MMDRV_WAVEOUT           5 | 
|---|
| 89 | #define MMDRV_MAX               6 | 
|---|
| 90 |  | 
|---|
| 91 | #define WINE_MMTHREAD_CREATED   0x4153494C      /* "BSIL" */ | 
|---|
| 92 | #define WINE_MMTHREAD_DELETED   0xDEADDEAD | 
|---|
| 93 |  | 
|---|
| 94 | typedef struct { | 
|---|
| 95 | DWORD                    dwSignature;            /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */ | 
|---|
| 96 | DWORD                    dwCounter;              /* 04 > 1 when in mmThread functions */ | 
|---|
| 97 | HANDLE                   hThread;                /* 08 hThread */ | 
|---|
| 98 | DWORD                    dwThreadID;             /* 0C */ | 
|---|
| 99 | FARPROC16                fpThread;               /* 10 address of thread proc (segptr or lin depending on dwFlags) */ | 
|---|
| 100 | DWORD                    dwThreadPmt;            /* 14 parameter to be passed upon thread creation to fpThread */ | 
|---|
| 101 | DWORD                    dwSignalCount;          /* 18 counter used for signaling */ | 
|---|
| 102 | HANDLE                   hEvent;                 /* 1C event */ | 
|---|
| 103 | HANDLE                   hVxD;                   /* 20 return from OpenVxDHandle */ | 
|---|
| 104 | DWORD                    dwStatus;               /* 24 0x00, 0x10, 0x20, 0x30 */ | 
|---|
| 105 | DWORD                    dwFlags;                /* 28 dwFlags upon creation */ | 
|---|
| 106 | HANDLE16                 hTask;                  /* 2C handle to created task */ | 
|---|
| 107 | } WINE_MMTHREAD; | 
|---|
| 108 |  | 
|---|
| 109 | typedef struct tagWINE_MCIDRIVER { | 
|---|
| 110 | UINT                    wDeviceID; | 
|---|
| 111 | UINT                    wType; | 
|---|
| 112 | LPSTR                   lpstrElementName; | 
|---|
| 113 | LPSTR                   lpstrDeviceType; | 
|---|
| 114 | LPSTR                   lpstrAlias; | 
|---|
| 115 | HDRVR                   hDriver; | 
|---|
| 116 | DRIVERPROC16            driverProc; | 
|---|
| 117 | DWORD                   dwPrivate; | 
|---|
| 118 | YIELDPROC               lpfnYieldProc; | 
|---|
| 119 | DWORD                   dwYieldData; | 
|---|
| 120 | BOOL                    bIs32; | 
|---|
| 121 | HTASK16                 hCreatorTask; | 
|---|
| 122 | UINT                    uTypeCmdTable; | 
|---|
| 123 | UINT                    uSpecificCmdTable; | 
|---|
| 124 | struct tagWINE_MCIDRIVER*lpNext; | 
|---|
| 125 | } WINE_MCIDRIVER, *LPWINE_MCIDRIVER; | 
|---|
| 126 |  | 
|---|
| 127 | #define WINE_TIMER_IS32 0x80 | 
|---|
| 128 |  | 
|---|
| 129 | typedef struct tagWINE_TIMERENTRY { | 
|---|
| 130 | UINT                        wDelay; | 
|---|
| 131 | UINT                        wResol; | 
|---|
| 132 | FARPROC16                   lpFunc; | 
|---|
| 133 | DWORD                       dwUser; | 
|---|
| 134 | UINT16                      wFlags; | 
|---|
| 135 | UINT16                      wTimerID; | 
|---|
| 136 | UINT                        uCurTime; | 
|---|
| 137 | struct tagWINE_TIMERENTRY*  lpNext; | 
|---|
| 138 | } WINE_TIMERENTRY, *LPWINE_TIMERENTRY; | 
|---|
| 139 |  | 
|---|
| 140 | typedef struct tagWINE_MMIO { | 
|---|
| 141 | MMIOINFO                    info; | 
|---|
| 142 | struct IOProcList*          ioProc; | 
|---|
| 143 | BOOL                        bTmpIOProc; | 
|---|
| 144 | HANDLE                      hMem; | 
|---|
| 145 | SEGPTR                      buffer16; | 
|---|
| 146 | struct tagWINE_MMIO*        lpNext; | 
|---|
| 147 | BOOL                        bBufferLoaded; | 
|---|
| 148 | } WINE_MMIO, *LPWINE_MMIO; | 
|---|
| 149 |  | 
|---|
| 150 | typedef struct tagWINE_MM_IDATA { | 
|---|
| 151 | /* iData reference */ | 
|---|
| 152 | DWORD                       dwThisProcess; | 
|---|
| 153 | struct tagWINE_MM_IDATA*    lpNextIData; | 
|---|
| 154 | /* winmm part */ | 
|---|
| 155 | HANDLE                      hWinMM32Instance; | 
|---|
| 156 | HANDLE                      hWinMM16Instance; | 
|---|
| 157 | HANDLE                      h16Module32; | 
|---|
| 158 | CRITICAL_SECTION            cs; | 
|---|
| 159 | /* mm timer part */ | 
|---|
| 160 | HANDLE                      hMMTimer; | 
|---|
| 161 | DWORD                       mmSysTimeMS; | 
|---|
| 162 | LPWINE_TIMERENTRY           lpTimerList; | 
|---|
| 163 | int                         nSizeLpTimers; | 
|---|
| 164 | LPWINE_TIMERENTRY           lpTimers; | 
|---|
| 165 | /* mci part */ | 
|---|
| 166 | LPWINE_MCIDRIVER            lpMciDrvs; | 
|---|
| 167 | /* low level drivers (unused yet) */ | 
|---|
| 168 | /* LPWINE_WAVE              lpWave; */ | 
|---|
| 169 | /* LPWINE_MIDI              lpMidi; */ | 
|---|
| 170 | /* LPWINE_MIXER             lpMixer; */ | 
|---|
| 171 | /* mmio part */ | 
|---|
| 172 | LPWINE_MMIO                 lpMMIO; | 
|---|
| 173 | } WINE_MM_IDATA, *LPWINE_MM_IDATA; | 
|---|
| 174 |  | 
|---|
| 175 | /* function prototypes */ | 
|---|
| 176 |  | 
|---|
| 177 | typedef LONG                    (*MCIPROC16)(DWORD, HDRVR16, WORD, DWORD, DWORD); | 
|---|
| 178 | typedef LONG                    (*MCIPROC)(DWORD, HDRVR, DWORD, DWORD, DWORD); | 
|---|
| 179 |  | 
|---|
| 180 | extern LPWINE_DRIVER            DRIVER_FindFromHDrvr(HDRVR hDrvr); | 
|---|
| 181 | extern BOOL                     DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz); | 
|---|
| 182 | extern LPWINE_DRIVER            DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2); | 
|---|
| 183 |  | 
|---|
| 184 | extern LPWINE_MCIDRIVER         MCI_GetDriver(UINT16 uDevID); | 
|---|
| 185 | extern UINT                     MCI_GetDriverFromString(LPCSTR str); | 
|---|
| 186 | extern DWORD                    MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr); | 
|---|
| 187 | extern const char*              MCI_MessageToString(UINT16 wMsg); | 
|---|
| 188 |  | 
|---|
| 189 | extern UINT             WINAPI  MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data); | 
|---|
| 190 |  | 
|---|
| 191 | extern LRESULT                  MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2, BOOL bIs32); | 
|---|
| 192 |  | 
|---|
| 193 | extern DWORD                    MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32); | 
|---|
| 194 | extern DWORD                    MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 195 | extern DWORD                    MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2); | 
|---|
| 196 | extern DWORD                    MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2, UINT size); | 
|---|
| 197 |  | 
|---|
| 198 | void            CALLBACK        WINE_mmThreadEntryPoint(DWORD _pmt); | 
|---|
| 199 |  | 
|---|
| 200 | void                            MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16); | 
|---|
| 201 | void                            MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32); | 
|---|
| 202 |  | 
|---|
| 203 | BOOL                            MULTIMEDIA_MciInit(void); | 
|---|
| 204 | LPWINE_MM_IDATA                 MULTIMEDIA_GetIData(void); | 
|---|
| 205 |  | 
|---|
| 206 | LPWINE_MM_IDATA                 TIME_MMTimeStart(void); | 
|---|
| 207 | void                            TIME_MMTimeStop(void); | 
|---|