[WDMAUD] Close mixers on cleanup. Should fix CORE-10735 definitely (#21)
[reactos.git] / drivers / wdm / audio / legacy / wdmaud / wdmaud.h
1 #ifndef _WDMAUD_PCH_
2 #define _WDMAUD_PCH_
3
4 #include <portcls.h>
5 #include <mmsystem.h>
6
7 #include "interface.h"
8
9 typedef struct
10 {
11 PMDL Mdl;
12 ULONG Length;
13 ULONG Function;
14 PFILE_OBJECT FileObject;
15 }WDMAUD_COMPLETION_CONTEXT, *PWDMAUD_COMPLETION_CONTEXT;
16
17
18 typedef struct
19 {
20 HANDLE Handle;
21 SOUND_DEVICE_TYPE Type;
22 ULONG FilterId;
23 ULONG PinId;
24 PRKEVENT NotifyEvent;
25 }WDMAUD_HANDLE, *PWDMAUD_HANDLE;
26
27 typedef struct
28 {
29 LIST_ENTRY Entry;
30 HANDLE hProcess;
31 ULONG NumPins;
32 WDMAUD_HANDLE * hPins;
33
34 LIST_ENTRY MixerEventList;
35 }WDMAUD_CLIENT, *PWDMAUD_CLIENT;
36
37 typedef struct
38 {
39 LIST_ENTRY Entry;
40 ULONG NotificationType;
41 ULONG Value;
42 HANDLE hMixer;
43 }EVENT_ENTRY, *PEVENT_ENTRY;
44
45 typedef struct
46 {
47 LIST_ENTRY Entry;
48 UNICODE_STRING SymbolicLink;
49 }SYSAUDIO_ENTRY, *PSYSAUDIO_ENTRY;
50
51 typedef struct
52 {
53 KSDEVICE_HEADER DeviceHeader;
54 PVOID SysAudioNotification;
55
56 BOOL DeviceInterfaceSupport;
57
58 KSPIN_LOCK Lock;
59 ULONG NumSysAudioDevices;
60 LIST_ENTRY SysAudioDeviceList;
61 HANDLE hSysAudio;
62 PFILE_OBJECT FileObject;
63 LIST_ENTRY WdmAudClientList;
64
65 ULONG SysAudioDeviceCount;
66 PIO_WORKITEM WorkItem;
67 KEVENT InitializationCompletionEvent;
68 ULONG WorkItemActive;
69
70 PDEVICE_OBJECT NextDeviceObject;
71 }WDMAUD_DEVICE_EXTENSION, *PWDMAUD_DEVICE_EXTENSION;
72
73 typedef struct
74 {
75 PWDMAUD_CLIENT ClientInfo;
76 PWDMAUD_DEVICE_EXTENSION DeviceExtension;
77 SOUND_DEVICE_TYPE DeviceType;
78 }PIN_CREATE_CONTEXT, *PPIN_CREATE_CONTEXT;
79
80
81 NTSTATUS
82 NTAPI
83 OpenWavePin(
84 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension,
85 IN ULONG FilterId,
86 IN ULONG PinId,
87 IN LPWAVEFORMATEX WaveFormatEx,
88 IN ACCESS_MASK DesiredAccess,
89 OUT PHANDLE PinHandle);
90
91 NTSTATUS
92 WdmAudRegisterDeviceInterface(
93 IN PDEVICE_OBJECT PhysicalDeviceObject,
94 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
95
96 NTSTATUS
97 WdmAudOpenSysAudioDevices(
98 IN PDEVICE_OBJECT DeviceObject,
99 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
100
101 NTSTATUS
102 WdmAudOpenSysaudio(
103 IN PDEVICE_OBJECT DeviceObject,
104 IN PWDMAUD_CLIENT *pClient);
105
106 NTSTATUS
107 NTAPI
108 WdmAudDeviceControl(
109 IN PDEVICE_OBJECT DeviceObject,
110 IN PIRP Irp);
111
112 NTSTATUS
113 NTAPI
114 WdmAudReadWrite(
115 IN PDEVICE_OBJECT DeviceObject,
116 IN PIRP Irp);
117
118 NTSTATUS
119 NTAPI
120 WdmAudWrite(
121 IN PDEVICE_OBJECT DeviceObject,
122 IN PIRP Irp);
123
124 NTSTATUS
125 WdmAudControlOpenMixer(
126 IN PDEVICE_OBJECT DeviceObject,
127 IN PIRP Irp,
128 IN PWDMAUD_DEVICE_INFO DeviceInfo,
129 IN PWDMAUD_CLIENT ClientInfo);
130
131 NTSTATUS
132 WdmAudControlCloseMixer(
133 IN PDEVICE_OBJECT DeviceObject,
134 IN PIRP Irp,
135 IN PWDMAUD_DEVICE_INFO DeviceInfo,
136 IN PWDMAUD_CLIENT ClientInfo,
137 IN ULONG Index);
138
139 VOID
140 WdmAudCloseAllMixers(
141 IN PDEVICE_OBJECT DeviceObject,
142 IN PWDMAUD_CLIENT ClientInfo,
143 IN ULONG Index);
144
145 NTSTATUS
146 WdmAudControlOpenWave(
147 IN PDEVICE_OBJECT DeviceObject,
148 IN PIRP Irp,
149 IN PWDMAUD_DEVICE_INFO DeviceInfo,
150 IN PWDMAUD_CLIENT ClientInfo);
151
152 NTSTATUS
153 WdmAudControlOpenMidi(
154 IN PDEVICE_OBJECT DeviceObject,
155 IN PIRP Irp,
156 IN PWDMAUD_DEVICE_INFO DeviceInfo,
157 IN PWDMAUD_CLIENT ClientInfo);
158
159 ULONG
160 GetNumOfMixerDevices(
161 IN PDEVICE_OBJECT DeviceObject);
162
163 NTSTATUS
164 SetIrpIoStatus(
165 IN PIRP Irp,
166 IN NTSTATUS Status,
167 IN ULONG Length);
168
169 NTSTATUS
170 WdmAudOpenSysAudioDevice(
171 IN LPWSTR DeviceName,
172 OUT PHANDLE Handle);
173
174 NTSTATUS
175 FindProductName(
176 IN LPWSTR PnpName,
177 IN ULONG ProductNameSize,
178 OUT LPWSTR ProductName);
179
180 NTSTATUS
181 WdmAudMixerCapabilities(
182 IN PDEVICE_OBJECT DeviceObject,
183 IN PWDMAUD_DEVICE_INFO DeviceInfo,
184 IN PWDMAUD_CLIENT ClientInfo,
185 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
186
187 NTSTATUS
188 WdmAudWaveCapabilities(
189 IN PDEVICE_OBJECT DeviceObject,
190 IN PWDMAUD_DEVICE_INFO DeviceInfo,
191 IN PWDMAUD_CLIENT ClientInfo,
192 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
193
194 NTSTATUS
195 WdmAudMidiCapabilities(
196 IN PDEVICE_OBJECT DeviceObject,
197 IN PWDMAUD_DEVICE_INFO DeviceInfo,
198 IN PWDMAUD_CLIENT ClientInfo,
199 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
200
201 NTSTATUS
202 NTAPI
203 WdmAudFrameSize(
204 IN PDEVICE_OBJECT DeviceObject,
205 IN PIRP Irp,
206 IN PWDMAUD_DEVICE_INFO DeviceInfo,
207 IN PWDMAUD_CLIENT ClientInfo);
208
209 NTSTATUS
210 NTAPI
211 WdmAudGetLineInfo(
212 IN PDEVICE_OBJECT DeviceObject,
213 IN PIRP Irp,
214 IN PWDMAUD_DEVICE_INFO DeviceInfo,
215 IN PWDMAUD_CLIENT ClientInfo);
216
217 NTSTATUS
218 NTAPI
219 WdmAudGetLineControls(
220 IN PDEVICE_OBJECT DeviceObject,
221 IN PIRP Irp,
222 IN PWDMAUD_DEVICE_INFO DeviceInfo,
223 IN PWDMAUD_CLIENT ClientInfo);
224
225 NTSTATUS
226 NTAPI
227 WdmAudSetControlDetails(
228 IN PDEVICE_OBJECT DeviceObject,
229 IN PIRP Irp,
230 IN PWDMAUD_DEVICE_INFO DeviceInfo,
231 IN PWDMAUD_CLIENT ClientInfo);
232
233 NTSTATUS
234 NTAPI
235 WdmAudGetMixerEvent(
236 IN PDEVICE_OBJECT DeviceObject,
237 IN PIRP Irp,
238 IN PWDMAUD_DEVICE_INFO DeviceInfo,
239 IN PWDMAUD_CLIENT ClientInfo);
240
241 NTSTATUS
242 NTAPI
243 WdmAudGetControlDetails(
244 IN PDEVICE_OBJECT DeviceObject,
245 IN PIRP Irp,
246 IN PWDMAUD_DEVICE_INFO DeviceInfo,
247 IN PWDMAUD_CLIENT ClientInfo);
248
249 NTSTATUS
250 WdmAudMixerInitialize(
251 IN PDEVICE_OBJECT DeviceObject);
252
253 NTSTATUS
254 NTAPI
255 WdmAudWaveInitialize(
256 IN PDEVICE_OBJECT DeviceObject);
257
258 ULONG
259 ClosePin(
260 IN PWDMAUD_CLIENT ClientInfo,
261 IN ULONG FilterId,
262 IN ULONG PinId,
263 IN SOUND_DEVICE_TYPE DeviceType);
264
265 NTSTATUS
266 InsertPinHandle(
267 IN PWDMAUD_CLIENT ClientInfo,
268 IN ULONG FilterId,
269 IN ULONG PinId,
270 IN SOUND_DEVICE_TYPE DeviceType,
271 IN HANDLE PinHandle,
272 IN ULONG FreeIndex);
273
274 NTSTATUS
275 GetSysAudioDevicePnpName(
276 IN PDEVICE_OBJECT DeviceObject,
277 IN ULONG DeviceIndex,
278 OUT LPWSTR * Device);
279
280 NTSTATUS
281 OpenSysAudioDeviceByIndex(
282 IN PDEVICE_OBJECT DeviceObject,
283 IN ULONG DeviceIndex,
284 IN PHANDLE DeviceHandle,
285 IN PFILE_OBJECT * FileObject);
286
287 NTSTATUS
288 OpenDevice(
289 IN LPWSTR Device,
290 OUT PHANDLE DeviceHandle,
291 OUT PFILE_OBJECT * FileObject);
292
293 ULONG
294 WdmAudGetMixerDeviceCount(VOID);
295
296 ULONG
297 WdmAudGetWaveInDeviceCount(VOID);
298
299 ULONG
300 WdmAudGetWaveOutDeviceCount(VOID);
301
302 ULONG
303 WdmAudGetMidiInDeviceCount(VOID);
304
305 ULONG
306 WdmAudGetMidiOutDeviceCount(VOID);
307
308 NTSTATUS
309 WdmAudGetPnpNameByIndexAndType(
310 IN ULONG DeviceIndex,
311 IN SOUND_DEVICE_TYPE DeviceType,
312 OUT LPWSTR *Device);
313
314
315 /* sup.c */
316
317 ULONG
318 GetSysAudioDeviceCount(
319 IN PDEVICE_OBJECT DeviceObject);
320
321
322 PVOID
323 AllocateItem(
324 IN POOL_TYPE PoolType,
325 IN SIZE_T NumberOfBytes);
326
327 VOID
328 FreeItem(
329 IN PVOID Item);
330
331 #endif /* _WDMAUD_PCH_ */