kernel32: Add a test for threads state when a process is being terminated.
[wine] / dlls / mmsystem.dll16 / winemm16.h
1 /*
2  * Copyright 1998, Luiz Otavio L. Zorzella
3  *           1999, Eric Pouech
4  *
5  * Purpose:   multimedia declarations (internal to WINMM & MMSYSTEM DLLs)
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "wine/mmsystem16.h"
23 #include "wownt32.h"
24
25 /* mmsystem (16 bit files) only functions */
26 void            MMDRV_Init16(void);
27 void            MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32);
28
29 typedef LONG                    (*MCIPROC16)(DWORD, HDRVR16, WORD, DWORD, DWORD);
30
31 /* HANDLE16 -> HANDLE conversions */
32 #define HDRVR_32(h16)           ((HDRVR)(ULONG_PTR)(h16))
33 #define HMIDI_32(h16)           ((HMIDI)(ULONG_PTR)(h16))
34 #define HMIDIIN_32(h16)         ((HMIDIIN)(ULONG_PTR)(h16))
35 #define HMIDIOUT_32(h16)        ((HMIDIOUT)(ULONG_PTR)(h16))
36 #define HMIDISTRM_32(h16)       ((HMIDISTRM)(ULONG_PTR)(h16))
37 #define HMIXER_32(h16)          ((HMIXER)(ULONG_PTR)(h16))
38 #define HMIXEROBJ_32(h16)       ((HMIXEROBJ)(ULONG_PTR)(h16))
39 #define HMMIO_32(h16)           ((HMMIO)(ULONG_PTR)(h16))
40 #define HWAVE_32(h16)           ((HWAVE)(ULONG_PTR)(h16))
41 #define HWAVEIN_32(h16)         ((HWAVEIN)(ULONG_PTR)(h16))
42 #define HWAVEOUT_32(h16)        ((HWAVEOUT)(ULONG_PTR)(h16))
43
44 /* HANDLE -> HANDLE16 conversions */
45 #define HDRVR_16(h32)           (LOWORD(h32))
46 #define HMIDI_16(h32)           (LOWORD(h32))
47 #define HMIDIIN_16(h32)         (LOWORD(h32))
48 #define HMIDIOUT_16(h32)        (LOWORD(h32))
49 #define HMIDISTRM_16(h32)       (LOWORD(h32))
50 #define HMIXER_16(h32)          (LOWORD(h32))
51 #define HMIXEROBJ_16(h32)       (LOWORD(h32))
52 #define HMMIO_16(h32)           (LOWORD(h32))
53 #define HWAVE_16(h32)           (LOWORD(h32))
54 #define HWAVEIN_16(h32)         (LOWORD(h32))
55 #define HWAVEOUT_16(h32)        (LOWORD(h32))
56
57 typedef enum {
58     MMSYSTEM_MAP_NOMEM,         /* ko, memory problem */
59     MMSYSTEM_MAP_MSGERROR,      /* ko, unknown message */
60     MMSYSTEM_MAP_OK,            /* ok, no memory allocated. to be sent to the proc. */
61     MMSYSTEM_MAP_OKMEM,         /* ok, some memory allocated, need to call UnMapMsg. to be sent to the proc. */
62 } MMSYSTEM_MapType;
63
64 extern  CRITICAL_SECTION        mmdrv_cs;
65
66 enum MMSYSTEM_DriverType
67 {
68     MMSYSTDRV_MIXER,
69     MMSYSTDRV_MIDIIN,
70     MMSYSTDRV_MIDIOUT,
71     MMSYSTDRV_WAVEIN,
72     MMSYSTDRV_WAVEOUT,
73     MMSYSTDRV_MAX
74 };
75
76 extern  struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD callback, DWORD flags, enum MMSYSTEM_DriverType kind);
77 extern  void                    MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk);
78 extern  void                    MMSYSTDRV_SetHandle(struct mmsystdrv_thunk* thunk, void* h);
79 extern  void                    MMSYSTDRV_CloseHandle(void* h);
80 extern  DWORD                   MMSYSTDRV_Message(void* h, UINT msg, DWORD_PTR param1, DWORD_PTR param2);
81
82 #define WINE_MMTHREAD_CREATED   0x4153494C      /* "BSIL" */
83 #define WINE_MMTHREAD_DELETED   0xDEADDEAD
84
85 typedef struct {
86        DWORD                    dwSignature;            /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */
87        DWORD                    dwCounter;              /* 04 > 1 when in mmThread functions */
88        HANDLE                   hThread;                /* 08 hThread */
89        DWORD                    dwThreadID;             /* 0C */
90        DWORD                    fpThread;               /* 10 address of thread proc (segptr or lin depending on dwFlags) */
91        DWORD                    dwThreadPmt;            /* 14 parameter to be passed upon thread creation to fpThread */
92        LONG                     dwSignalCount;          /* 18 counter used for signaling */
93        HANDLE                   hEvent;                 /* 1C event */
94        HANDLE                   hVxD;                   /* 20 return from OpenVxDHandle */
95        DWORD                    dwStatus;               /* 24 0x00, 0x10, 0x20, 0x30 */
96        DWORD                    dwFlags;                /* 28 dwFlags upon creation */
97        UINT16                   hTask;                  /* 2C handle to created task */
98 } WINE_MMTHREAD;