Keep track of per-column information inside the listview.
[wine] / dlls / winmm / winemm.h
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
2
3 /*****************************************************************************
4  * Copyright 1998, Luiz Otavio L. Zorzella
5  *           1999, Eric Pouech
6  *
7  * Purpose:   multimedia declarations (internal to WINMM & MMSYSTEM DLLs)
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  *****************************************************************************
23  */
24
25 #include "mmddk.h"
26 #include "wownt32.h"
27
28 typedef DWORD (WINAPI *MessageProc16)(UINT16 wDevID, UINT16 wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
29 typedef DWORD (WINAPI *MessageProc32)(UINT wDevID, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
30
31 /* Who said goofy boy ? */
32 #define WINE_DI_MAGIC   0x900F1B01
33
34 typedef struct tagWINE_DRIVER
35 {
36     DWORD                       dwMagic;
37     /* as usual LPWINE_DRIVER == hDriver32 */
38     DWORD                       dwFlags;
39     union {
40         struct {
41             HMODULE                     hModule;
42             DRIVERPROC                  lpDrvProc;
43             DWORD                       dwDriverID;
44         } d32;
45         struct {
46             HDRVR16                     hDriver16;
47         } d16;
48     } d;
49     struct tagWINE_DRIVER*      lpPrevItem;
50     struct tagWINE_DRIVER*      lpNextItem;
51 } WINE_DRIVER, *LPWINE_DRIVER;
52
53 typedef struct tagWINE_MLD {
54 /* EPP struct tagWINE_MLD*      lpNext; */              /* not used so far */
55        UINT                     uDeviceID;
56        UINT                     type;
57        UINT                     mmdIndex;               /* index to low-level driver in MMDrvs table */
58        DWORD                    dwDriverInstance;       /* this value is driver related, as opposed to
59                                                          * opendesc.dwInstance which is client (callback) related */
60        WORD                     bFrom32;
61        WORD                     dwFlags;
62        DWORD                    dwCallback;
63        DWORD                    dwClientInstance;
64 } WINE_MLD, *LPWINE_MLD;
65
66 typedef struct  {
67        WINE_MLD                 mld;
68 } WINE_WAVE, *LPWINE_WAVE;
69
70 typedef struct {
71        WINE_MLD                 mld;
72        MIDIOPENDESC             mod;                    /* FIXME: should be removed */
73 } WINE_MIDI, *LPWINE_MIDI;
74
75 typedef struct {
76        WINE_MLD                 mld;
77 } WINE_MIXER, *LPWINE_MIXER;
78
79 extern  BOOL            MMDRV_Init(void);
80 extern  UINT            MMDRV_GetNum(UINT);
81 extern  LPWINE_MLD      MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
82                                     DWORD* dwCallback, DWORD* dwInstance, BOOL bFrom32);
83 extern  void            MMDRV_Free(HANDLE hndl, LPWINE_MLD mld);
84 extern  DWORD           MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD dwParam1, DWORD dwParam2);
85 extern  DWORD           MMDRV_Close(LPWINE_MLD mld, UINT wMsg);
86 extern  LPWINE_MLD      MMDRV_Get(HANDLE hndl, UINT type, BOOL bCanBeID);
87 extern  LPWINE_MLD      MMDRV_GetRelated(HANDLE hndl, UINT srcType, BOOL bSrcCanBeID, UINT dstTyped);
88 extern  DWORD           MMDRV_Message(LPWINE_MLD mld, WORD wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
89 extern  UINT            MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1, DWORD dwParam2);
90
91 #define MMDRV_AUX               0
92 #define MMDRV_MIXER             1
93 #define MMDRV_MIDIIN            2
94 #define MMDRV_MIDIOUT           3
95 #define MMDRV_WAVEIN            4
96 #define MMDRV_WAVEOUT           5
97 #define MMDRV_MAX               6
98
99 #define WINE_MMTHREAD_CREATED   0x4153494C      /* "BSIL" */
100 #define WINE_MMTHREAD_DELETED   0xDEADDEAD
101
102 typedef struct {
103        DWORD                    dwSignature;            /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */
104        DWORD                    dwCounter;              /* 04 > 1 when in mmThread functions */
105        HANDLE                   hThread;                /* 08 hThread */
106        DWORD                    dwThreadID;             /* 0C */
107        FARPROC16                fpThread;               /* 10 address of thread proc (segptr or lin depending on dwFlags) */
108        DWORD                    dwThreadPmt;            /* 14 parameter to be passed upon thread creation to fpThread */
109        DWORD                    dwSignalCount;          /* 18 counter used for signaling */
110        HANDLE                   hEvent;                 /* 1C event */
111        HANDLE                   hVxD;                   /* 20 return from OpenVxDHandle */
112        DWORD                    dwStatus;               /* 24 0x00, 0x10, 0x20, 0x30 */
113        DWORD                    dwFlags;                /* 28 dwFlags upon creation */
114        HANDLE16                 hTask;                  /* 2C handle to created task */
115 } WINE_MMTHREAD;
116
117 typedef struct tagWINE_MCIDRIVER {
118         UINT                    wDeviceID;
119         UINT                    wType;
120         LPSTR                   lpstrElementName;
121         LPSTR                   lpstrDeviceType;
122         LPSTR                   lpstrAlias;
123         HDRVR                   hDriver;
124         DRIVERPROC16            driverProc;
125         DWORD                   dwPrivate;
126         YIELDPROC               lpfnYieldProc;
127         DWORD                   dwYieldData;
128         BOOL                    bIs32;
129         HTASK16                 hCreatorTask;
130         DWORD                   CreatorThread;
131         UINT                    uTypeCmdTable;
132         UINT                    uSpecificCmdTable;
133         struct tagWINE_MCIDRIVER*lpNext;
134 } WINE_MCIDRIVER, *LPWINE_MCIDRIVER;
135
136 #define WINE_TIMER_IS32 0x80
137
138 typedef struct tagWINE_TIMERENTRY {
139     UINT                        wDelay;
140     UINT                        wResol;
141     FARPROC16                   lpFunc;
142     DWORD                       dwUser;
143     UINT16                      wFlags;
144     UINT16                      wTimerID;
145     UINT                        uCurTime;
146     struct tagWINE_TIMERENTRY*  lpNext;
147 } WINE_TIMERENTRY, *LPWINE_TIMERENTRY;
148
149 typedef struct tagWINE_MMIO {
150     MMIOINFO                    info;
151     struct IOProcList*          ioProc;
152     BOOL                        bTmpIOProc;
153     HANDLE                      hMem;
154     SEGPTR                      buffer16;
155     struct tagWINE_MMIO*        lpNext;
156     BOOL                        bBufferLoaded;
157     DWORD                       dwFileSize;
158 } WINE_MMIO, *LPWINE_MMIO;
159
160 typedef struct tagWINE_PLAYSOUND {
161     BOOL                        bLoop : 1,
162                                 bAlloc : 1;
163     LPCWSTR                     pszSound;
164     HMODULE                     hMod;
165     DWORD                       fdwSound;
166     struct tagWINE_PLAYSOUND*   lpNext;
167 } WINE_PLAYSOUND, *LPWINE_PLAYSOUND;
168
169 typedef struct tagWINE_MM_IDATA {
170     /* winmm part */
171     HANDLE                      hWinMM32Instance;
172     HANDLE                      hWinMM16Instance;
173     HANDLE                      h16Module32;
174     CRITICAL_SECTION            cs;
175     /* mm timer part */
176     HANDLE                      hMMTimer;
177     DWORD                       mmSysTimeMS;
178     LPWINE_TIMERENTRY           lpTimerList;
179     int                         nSizeLpTimers;
180     LPWINE_TIMERENTRY           lpTimers;
181     /* mci part */
182     LPWINE_MCIDRIVER            lpMciDrvs;
183     /* low level drivers (unused yet) */
184     /* LPWINE_WAVE              lpWave; */
185     /* LPWINE_MIDI              lpMidi; */
186     /* LPWINE_MIXER             lpMixer; */
187     /* mmio part */
188     LPWINE_MMIO                 lpMMIO;
189     /* playsound and sndPlaySound */
190     WINE_PLAYSOUND*             lpPlaySound;
191     HANDLE                      psLastEvent;
192     HANDLE                      psStopEvent;
193 } WINE_MM_IDATA, *LPWINE_MM_IDATA;
194
195 /* function prototypes */
196
197 typedef LONG                    (*MCIPROC16)(DWORD, HDRVR16, WORD, DWORD, DWORD);
198 typedef LONG                    (*MCIPROC)(DWORD, HDRVR, DWORD, DWORD, DWORD);
199
200 extern LPWINE_DRIVER            DRIVER_FindFromHDrvr(HDRVR hDrvr);
201 extern BOOL                     DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz);
202 extern LPWINE_DRIVER            DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2);
203
204 extern LPWINE_MCIDRIVER         MCI_GetDriver(UINT16 uDevID);
205 extern UINT                     MCI_GetDriverFromString(LPCSTR str);
206 extern DWORD                    MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr);
207 extern const char*              MCI_MessageToString(UINT16 wMsg);
208
209 extern UINT             WINAPI  MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data);
210
211 extern LRESULT                  MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2, BOOL bIs32);
212
213 extern DWORD                    MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
214 extern DWORD                    MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
215 extern DWORD                    MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
216
217 void            CALLBACK        WINE_mmThreadEntryPoint(DWORD _pmt);
218
219 void                            MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16);
220 void                            MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32);
221
222 UINT                            MMSYSTEM_mixerOpen(LPHMIXER lphMix, UINT uDeviceID, DWORD dwCallback,
223                                                    DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32);
224 UINT                            MMSYSTEM_midiOutOpen(HMIDIOUT* lphMidiOut, UINT uDeviceID, DWORD dwCallback,
225                                                      DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
226 UINT                            MMSYSTEM_midiInOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD dwCallback,
227                                                     DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
228 MMRESULT                        MMSYSTEM_MidiStream_Open(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
229                                                          DWORD cMidi, DWORD dwCallback,
230                                                          DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32);
231 UINT                            MMSYSTEM_waveOpen(HANDLE* lphndl, UINT uDeviceID, UINT uType,
232                                                   const LPWAVEFORMATEX lpFormat, DWORD dwCallback, 
233                                                   DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
234 WORD                            timeSetEventInternal(UINT wDelay, UINT wResol,
235                                                      FARPROC16 lpFunc, DWORD dwUser, UINT wFlags);
236
237 BOOL                            MULTIMEDIA_MciInit(void);
238 LPWINE_MM_IDATA                 MULTIMEDIA_GetIData(void);
239 BOOL                            MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSound, BOOL bUnicode);
240
241 LPWINE_MM_IDATA                 TIME_MMTimeStart(void);
242 void                            TIME_MMTimeStop(void);
243
244 /* HANDLE16 -> HANDLE conversions */
245 #define HDRVR_32(h16)           ((HDRVR)(ULONG_PTR)(h16))
246 #define HMIDI_32(h16)           ((HMIDI)(ULONG_PTR)(h16))
247 #define HMIDIIN_32(h16)         ((HMIDIIN)(ULONG_PTR)(h16))
248 #define HMIDIOUT_32(h16)        ((HMIDIOUT)(ULONG_PTR)(h16))
249 #define HMIDISTRM_32(h16)       ((HMIDISTRM)(ULONG_PTR)(h16))
250 #define HMIXER_32(h16)          ((HMIXER)(ULONG_PTR)(h16))
251 #define HMIXEROBJ_32(h16)       ((HMIXEROBJ)(ULONG_PTR)(h16))
252 #define HMMIO_32(h16)           ((HMMIO)(ULONG_PTR)(h16))
253 #define HWAVE_32(h16)           ((HWAVE)(ULONG_PTR)(h16))
254 #define HWAVEIN_32(h16)         ((HWAVEIN)(ULONG_PTR)(h16))
255 #define HWAVEOUT_32(h16)        ((HWAVEOUT)(ULONG_PTR)(h16))
256
257 /* HANDLE -> HANDLE16 conversions */
258 #define HDRVR_16(h32)           (LOWORD(h32))
259 #define HMIDI_16(h32)           (LOWORD(h32))
260 #define HMIDIIN_16(h32)         (LOWORD(h32))
261 #define HMIDIOUT_16(h32)        (LOWORD(h32))
262 #define HMIDISTRM_16(h32)       (LOWORD(h32))
263 #define HMIXER_16(h32)          (LOWORD(h32))
264 #define HMIXEROBJ_16(h32)       (LOWORD(h32))
265 #define HMMIO_16(h32)           (LOWORD(h32))
266 #define HWAVE_16(h32)           (LOWORD(h32))
267 #define HWAVEIN_16(h32)         (LOWORD(h32))
268 #define HWAVEOUT_16(h32)        (LOWORD(h32))