Stub for GetSecurityInfoExW().
[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 "wine/mmsystem16.h"
27 #include "wownt32.h"
28
29 typedef DWORD (WINAPI *MessageProc16)(UINT16 wDevID, UINT16 wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
30 typedef DWORD (WINAPI *MessageProc32)(UINT wDevID, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
31
32 typedef enum {
33     WINMM_MAP_NOMEM,    /* ko, memory problem */
34     WINMM_MAP_MSGERROR, /* ko, unknown message */
35     WINMM_MAP_OK,       /* ok, no memory allocated. to be sent to the proc. */
36     WINMM_MAP_OKMEM,    /* ok, some memory allocated, need to call UnMapMsg. to be sent to the proc. */
37 } WINMM_MapType;
38
39 /* Who said goofy boy ? */
40 #define WINE_DI_MAGIC   0x900F1B01
41
42 typedef struct tagWINE_DRIVER
43 {
44     DWORD                       dwMagic;
45     /* as usual LPWINE_DRIVER == hDriver32 */
46     DWORD                       dwFlags;
47     union {
48         struct {
49             HMODULE                     hModule;
50             DRIVERPROC                  lpDrvProc;
51             DWORD                       dwDriverID;
52         } d32;
53         struct {
54             HDRVR16                     hDriver16;
55         } d16;
56     } d;
57     struct tagWINE_DRIVER*      lpPrevItem;
58     struct tagWINE_DRIVER*      lpNextItem;
59 } WINE_DRIVER, *LPWINE_DRIVER;
60
61 typedef DWORD   (CALLBACK *WINEMM_msgFunc16)(UINT16, WORD, DWORD, DWORD, DWORD);
62 typedef DWORD   (CALLBACK *WINEMM_msgFunc32)(UINT  , UINT, DWORD, DWORD, DWORD);
63
64 /* for each loaded driver and each known type of driver, this structure contains
65  * the information needed to access it
66  */
67 typedef struct tagWINE_MM_DRIVER_PART {
68     int                         nIDMin;         /* lower bound of global indexes for this type */
69     int                         nIDMax;         /* hhigher bound of global indexes for this type */
70     union {
71         WINEMM_msgFunc32        fnMessage32;    /* pointer to fonction */
72         WINEMM_msgFunc16        fnMessage16;
73     } u;
74 } WINE_MM_DRIVER_PART;
75
76 #define MMDRV_AUX               0
77 #define MMDRV_MIXER             1
78 #define MMDRV_MIDIIN            2
79 #define MMDRV_MIDIOUT           3
80 #define MMDRV_WAVEIN            4
81 #define MMDRV_WAVEOUT           5
82 #define MMDRV_MAX               6
83
84 /* each low-level .drv will be associated with an instance of this structure */
85 typedef struct tagWINE_MM_DRIVER {
86     HDRVR                       hDriver;
87     LPSTR                       drvname;        /* name of the driver */
88     BOOL                        bIs32 : 1,      /* TRUE if 32 bit driver, FALSE for 16 */
89                                 bIsMapper : 1;  /* TRUE if mapper */
90     WINE_MM_DRIVER_PART         parts[MMDRV_MAX];/* Information for all known types */
91 } WINE_MM_DRIVER, *LPWINE_MM_DRIVER;
92
93 typedef struct tagWINE_MLD {
94 /* EPP struct tagWINE_MLD*      lpNext; */              /* not used so far */
95        UINT                     uDeviceID;
96        UINT                     type;
97        UINT                     mmdIndex;               /* index to low-level driver in MMDrvs table */
98        DWORD                    dwDriverInstance;       /* this value is driver related, as opposed to
99                                                          * opendesc.dwInstance which is client (callback) related */
100        WORD                     bFrom32;
101        WORD                     dwFlags;
102        DWORD                    dwCallback;
103        DWORD                    dwClientInstance;
104 } WINE_MLD, *LPWINE_MLD;
105
106 typedef struct  {
107        WINE_MLD                 mld;
108 } WINE_WAVE, *LPWINE_WAVE;
109
110 typedef struct {
111        WINE_MLD                 mld;
112        MIDIOPENDESC             mod;                    /* FIXME: should be removed */
113 } WINE_MIDI, *LPWINE_MIDI;
114
115 typedef struct {
116        WINE_MLD                 mld;
117 } WINE_MIXER, *LPWINE_MIXER;
118
119 #define WINE_MMTHREAD_CREATED   0x4153494C      /* "BSIL" */
120 #define WINE_MMTHREAD_DELETED   0xDEADDEAD
121
122 typedef struct {
123        DWORD                    dwSignature;            /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */
124        DWORD                    dwCounter;              /* 04 > 1 when in mmThread functions */
125        HANDLE                   hThread;                /* 08 hThread */
126        DWORD                    dwThreadID;             /* 0C */
127        FARPROC16                fpThread;               /* 10 address of thread proc (segptr or lin depending on dwFlags) */
128        DWORD                    dwThreadPmt;            /* 14 parameter to be passed upon thread creation to fpThread */
129        DWORD                    dwSignalCount;          /* 18 counter used for signaling */
130        HANDLE                   hEvent;                 /* 1C event */
131        HANDLE                   hVxD;                   /* 20 return from OpenVxDHandle */
132        DWORD                    dwStatus;               /* 24 0x00, 0x10, 0x20, 0x30 */
133        DWORD                    dwFlags;                /* 28 dwFlags upon creation */
134        HANDLE16                 hTask;                  /* 2C handle to created task */
135 } WINE_MMTHREAD;
136
137 typedef struct tagWINE_MCIDRIVER {
138         UINT                    wDeviceID;
139         UINT                    wType;
140         LPSTR                   lpstrElementName;
141         LPSTR                   lpstrDeviceType;
142         LPSTR                   lpstrAlias;
143         HDRVR                   hDriver;
144         DRIVERPROC16            driverProc;
145         DWORD                   dwPrivate;
146         YIELDPROC               lpfnYieldProc;
147         DWORD                   dwYieldData;
148         BOOL                    bIs32;
149         DWORD                   CreatorThread;
150         UINT                    uTypeCmdTable;
151         UINT                    uSpecificCmdTable;
152         struct tagWINE_MCIDRIVER*lpNext;
153 } WINE_MCIDRIVER, *LPWINE_MCIDRIVER;
154
155 #define WINE_TIMER_IS32 0x80
156
157 typedef struct tagWINE_TIMERENTRY {
158     UINT                        wDelay;
159     UINT                        wResol;
160     FARPROC16                   lpFunc;
161     DWORD                       dwUser;
162     UINT16                      wFlags;
163     UINT16                      wTimerID;
164     UINT                        uCurTime;
165     struct tagWINE_TIMERENTRY*  lpNext;
166 } WINE_TIMERENTRY, *LPWINE_TIMERENTRY;
167
168 enum mmioProcType {MMIO_PROC_16,MMIO_PROC_32A,MMIO_PROC_32W};
169
170 struct IOProcList
171 {
172     struct IOProcList*pNext;       /* Next item in linked list */
173     FOURCC            fourCC;      /* four-character code identifying IOProc */
174     LPMMIOPROC        pIOProc;     /* pointer to IProc */
175     enum mmioProcType type;        /* 16, 32A or 32W */
176     int               count;       /* number of objects linked to it */
177 };
178
179 typedef struct tagWINE_MMIO {
180     MMIOINFO                    info;
181     struct tagWINE_MMIO*        lpNext;
182     struct IOProcList*          ioProc;
183     BOOL                        bTmpIOProc : 1,
184                                 bBufferLoaded : 1;
185     SEGPTR                      segBuffer16;
186     DWORD                       dwFileSize;
187 } WINE_MMIO, *LPWINE_MMIO;
188
189 typedef struct tagWINE_PLAYSOUND {
190     BOOL                        bLoop : 1,
191                                 bAlloc : 1;
192     LPCWSTR                     pszSound;
193     HMODULE                     hMod;
194     DWORD                       fdwSound;
195     struct tagWINE_PLAYSOUND*   lpNext;
196 } WINE_PLAYSOUND, *LPWINE_PLAYSOUND;
197
198 typedef struct tagWINE_MM_IDATA {
199     /* winmm part */
200     HANDLE                      hWinMM32Instance;
201     HANDLE                      hWinMM16Instance;
202     CRITICAL_SECTION            cs;
203     /* mm timer part */
204     HANDLE                      hMMTimer;
205     DWORD                       mmSysTimeMS;
206     LPWINE_TIMERENTRY           lpTimerList;
207     int                         nSizeLpTimers;
208     LPWINE_TIMERENTRY           lpTimers;
209     /* mci part */
210     LPWINE_MCIDRIVER            lpMciDrvs;
211     /* low level drivers (unused yet) */
212     /* LPWINE_WAVE              lpWave; */
213     /* LPWINE_MIDI              lpMidi; */
214     /* LPWINE_MIXER             lpMixer; */
215     /* mmio part */
216     LPWINE_MMIO                 lpMMIO;
217     /* playsound and sndPlaySound */
218     WINE_PLAYSOUND*             lpPlaySound;
219     HANDLE                      psLastEvent;
220     HANDLE                      psStopEvent;
221 } WINE_MM_IDATA, *LPWINE_MM_IDATA;
222
223 /* function prototypes */
224
225 typedef LONG                    (*MCIPROC16)(DWORD, HDRVR16, WORD, DWORD, DWORD);
226 typedef LONG                    (*MCIPROC)(DWORD, HDRVR, DWORD, DWORD, DWORD);
227 typedef WINMM_MapType           (*MMDRV_MAPFUNC)(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
228
229 LPWINE_DRIVER   DRIVER_FindFromHDrvr(HDRVR hDrvr);
230 BOOL            DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz);
231 LPWINE_DRIVER   DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2);
232 void            DRIVER_UnloadAll(void);
233
234 BOOL            MMDRV_Init(void);
235 void            MMDRV_Exit(void);
236 UINT            MMDRV_GetNum(UINT);
237 LPWINE_MLD      MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
238                             DWORD* dwCallback, DWORD* dwInstance, BOOL bFrom32);
239 void            MMDRV_Free(HANDLE hndl, LPWINE_MLD mld);
240 DWORD           MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD dwParam1, DWORD dwParam2);
241 DWORD           MMDRV_Close(LPWINE_MLD mld, UINT wMsg);
242 LPWINE_MLD      MMDRV_Get(HANDLE hndl, UINT type, BOOL bCanBeID);
243 LPWINE_MLD      MMDRV_GetRelated(HANDLE hndl, UINT srcType, BOOL bSrcCanBeID, UINT dstTyped);
244 DWORD           MMDRV_Message(LPWINE_MLD mld, WORD wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
245 UINT            MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1, DWORD dwParam2);
246 BOOL            MMDRV_Is32(unsigned int);
247 void            MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_MAPFUNC,
248                                  MMDRV_MAPFUNC, MMDRV_MAPFUNC, LPDRVCALLBACK);
249
250 BOOL            MCI_Init(void);
251 WINE_MCIDRIVER* MCI_GetDriver(UINT16 uDevID);
252 UINT            MCI_GetDriverFromString(LPCSTR str);
253 DWORD           MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr);
254 const char*     MCI_MessageToString(UINT16 wMsg);
255 UINT    WINAPI  MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data);
256 LRESULT         MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2);
257 DWORD           MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
258 DWORD           MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
259 DWORD           MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
260
261 BOOL            WINMM_CheckForMMSystem(void);
262
263 UINT            MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD dwCallback,
264                            DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32);
265 UINT            MIDI_OutOpen(HMIDIOUT* lphMidiOut, UINT uDeviceID, DWORD dwCallback,
266                              DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
267 UINT            MIDI_InOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD dwCallback,
268                             DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
269 MMRESULT        MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
270                                 DWORD cMidi, DWORD dwCallback,
271                                 DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32);
272 UINT            WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
273                           const LPWAVEFORMATEX lpFormat, DWORD dwCallback, 
274                           DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
275
276 HMMIO           MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo,
277                           DWORD dwOpenFlags, enum mmioProcType type);
278 LPMMIOPROC      MMIO_InstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
279                                    DWORD dwFlags, enum mmioProcType type);
280 LRESULT         MMIO_SendMessage(HMMIO hmmio, UINT uMessage, LPARAM lParam1, 
281                                  LPARAM lParam2, enum mmioProcType type);
282 LPWINE_MMIO     MMIO_Get(HMMIO h);
283
284 WORD            TIME_SetEventInternal(UINT wDelay, UINT wResol,
285                                       FARPROC16 lpFunc, DWORD dwUser, UINT wFlags);
286 void            TIME_MMTimeStart(void);
287 void            TIME_MMTimeStop(void);
288
289 /* Global variables */
290 extern LPWINE_MM_IDATA  WINMM_IData;
291
292 /* pointers to 16 bit functions (if sibling MMSYSTEM.DLL is loaded
293  * NULL otherwise
294  */
295 extern  WINE_MMTHREAD*  (*pFnGetMMThread16)(HANDLE16);
296 extern  LPWINE_DRIVER   (*pFnOpenDriver16)(LPCSTR,LPCSTR,LPARAM);
297 extern  LRESULT         (*pFnCloseDriver16)(HDRVR16,LPARAM,LPARAM);
298 extern  LRESULT         (*pFnSendMessage16)(HDRVR16,UINT,LPARAM,LPARAM);
299 extern  WINMM_MapType   (*pFnMciMapMsg16To32A)(WORD,WORD,DWORD*);
300 extern  WINMM_MapType   (*pFnMciUnMapMsg16To32A)(WORD,WORD,DWORD);
301 extern  WINMM_MapType   (*pFnMciMapMsg32ATo16)(WORD,WORD,DWORD,DWORD*);
302 extern  WINMM_MapType   (*pFnMciUnMapMsg32ATo16)(WORD,WORD,DWORD,DWORD);
303 extern  LRESULT         (*pFnCallMMDrvFunc16)(FARPROC16,WORD,WORD,LONG,LONG,LONG);
304 extern  unsigned        (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER);
305 extern  LRESULT         (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM);
306
307 /* mmsystem (16 bit files) only functions */
308 void            MMDRV_Init16(void);
309 void            MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16);
310 void            MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32);
311
312 /* HANDLE16 -> HANDLE conversions */
313 #define HDRVR_32(h16)           ((HDRVR)(ULONG_PTR)(h16))
314 #define HMIDI_32(h16)           ((HMIDI)(ULONG_PTR)(h16))
315 #define HMIDIIN_32(h16)         ((HMIDIIN)(ULONG_PTR)(h16))
316 #define HMIDIOUT_32(h16)        ((HMIDIOUT)(ULONG_PTR)(h16))
317 #define HMIDISTRM_32(h16)       ((HMIDISTRM)(ULONG_PTR)(h16))
318 #define HMIXER_32(h16)          ((HMIXER)(ULONG_PTR)(h16))
319 #define HMIXEROBJ_32(h16)       ((HMIXEROBJ)(ULONG_PTR)(h16))
320 #define HMMIO_32(h16)           ((HMMIO)(ULONG_PTR)(h16))
321 #define HWAVE_32(h16)           ((HWAVE)(ULONG_PTR)(h16))
322 #define HWAVEIN_32(h16)         ((HWAVEIN)(ULONG_PTR)(h16))
323 #define HWAVEOUT_32(h16)        ((HWAVEOUT)(ULONG_PTR)(h16))
324
325 /* HANDLE -> HANDLE16 conversions */
326 #define HDRVR_16(h32)           (LOWORD(h32))
327 #define HMIDI_16(h32)           (LOWORD(h32))
328 #define HMIDIIN_16(h32)         (LOWORD(h32))
329 #define HMIDIOUT_16(h32)        (LOWORD(h32))
330 #define HMIDISTRM_16(h32)       (LOWORD(h32))
331 #define HMIXER_16(h32)          (LOWORD(h32))
332 #define HMIXEROBJ_16(h32)       (LOWORD(h32))
333 #define HMMIO_16(h32)           (LOWORD(h32))
334 #define HWAVE_16(h32)           (LOWORD(h32))
335 #define HWAVEIN_16(h32)         (LOWORD(h32))
336 #define HWAVEOUT_16(h32)        (LOWORD(h32))