xref: /reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h (revision d1b8feb6)
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 WdmAudGetPosition(
204     _In_ PDEVICE_OBJECT DeviceObject,
205     _In_ PIRP Irp,
206     _In_ PWDMAUD_DEVICE_INFO DeviceInfo);
207 
208 NTSTATUS
209 NTAPI
210 WdmAudFrameSize(
211     IN  PDEVICE_OBJECT DeviceObject,
212     IN  PIRP Irp,
213     IN  PWDMAUD_DEVICE_INFO DeviceInfo,
214     IN  PWDMAUD_CLIENT ClientInfo);
215 
216 NTSTATUS
217 NTAPI
218 WdmAudGetLineInfo(
219     IN  PDEVICE_OBJECT DeviceObject,
220     IN  PIRP Irp,
221     IN  PWDMAUD_DEVICE_INFO DeviceInfo,
222     IN  PWDMAUD_CLIENT ClientInfo);
223 
224 NTSTATUS
225 NTAPI
226 WdmAudGetLineControls(
227     IN  PDEVICE_OBJECT DeviceObject,
228     IN  PIRP Irp,
229     IN  PWDMAUD_DEVICE_INFO DeviceInfo,
230     IN  PWDMAUD_CLIENT ClientInfo);
231 
232 NTSTATUS
233 NTAPI
234 WdmAudSetControlDetails(
235     IN  PDEVICE_OBJECT DeviceObject,
236     IN  PIRP Irp,
237     IN  PWDMAUD_DEVICE_INFO DeviceInfo,
238     IN  PWDMAUD_CLIENT ClientInfo);
239 
240 NTSTATUS
241 NTAPI
242 WdmAudGetMixerEvent(
243     IN  PDEVICE_OBJECT DeviceObject,
244     IN  PIRP Irp,
245     IN  PWDMAUD_DEVICE_INFO DeviceInfo,
246     IN  PWDMAUD_CLIENT ClientInfo);
247 
248 NTSTATUS
249 NTAPI
250 WdmAudGetControlDetails(
251     IN  PDEVICE_OBJECT DeviceObject,
252     IN  PIRP Irp,
253     IN  PWDMAUD_DEVICE_INFO DeviceInfo,
254     IN  PWDMAUD_CLIENT ClientInfo);
255 
256 NTSTATUS
257 WdmAudMixerInitialize(
258     IN PDEVICE_OBJECT DeviceObject);
259 
260 NTSTATUS
261 NTAPI
262 WdmAudWaveInitialize(
263     IN PDEVICE_OBJECT DeviceObject);
264 
265 ULONG
266 ClosePin(
267     IN  PWDMAUD_CLIENT ClientInfo,
268     IN  ULONG FilterId,
269     IN  ULONG PinId,
270     IN  SOUND_DEVICE_TYPE DeviceType);
271 
272 NTSTATUS
273 InsertPinHandle(
274     IN  PWDMAUD_CLIENT ClientInfo,
275     IN  ULONG FilterId,
276     IN  ULONG PinId,
277     IN  SOUND_DEVICE_TYPE DeviceType,
278     IN  HANDLE PinHandle,
279     IN  ULONG FreeIndex);
280 
281 NTSTATUS
282 GetSysAudioDevicePnpName(
283     IN  PDEVICE_OBJECT DeviceObject,
284     IN  ULONG DeviceIndex,
285     OUT LPWSTR * Device);
286 
287 NTSTATUS
288 OpenSysAudioDeviceByIndex(
289     IN  PDEVICE_OBJECT DeviceObject,
290     IN  ULONG DeviceIndex,
291     IN  PHANDLE DeviceHandle,
292     IN  PFILE_OBJECT * FileObject);
293 
294 NTSTATUS
295 OpenDevice(
296     IN LPWSTR Device,
297     OUT PHANDLE DeviceHandle,
298     OUT PFILE_OBJECT * FileObject);
299 
300 ULONG
301 WdmAudGetMixerDeviceCount(VOID);
302 
303 ULONG
304 WdmAudGetWaveInDeviceCount(VOID);
305 
306 ULONG
307 WdmAudGetWaveOutDeviceCount(VOID);
308 
309 ULONG
310 WdmAudGetMidiInDeviceCount(VOID);
311 
312 ULONG
313 WdmAudGetMidiOutDeviceCount(VOID);
314 
315 NTSTATUS
316 WdmAudGetPnpNameByIndexAndType(
317     IN ULONG DeviceIndex,
318     IN SOUND_DEVICE_TYPE DeviceType,
319     OUT LPWSTR *Device);
320 
321 
322 /* sup.c */
323 
324 ULONG
325 GetSysAudioDeviceCount(
326     IN  PDEVICE_OBJECT DeviceObject);
327 
328 
329 PVOID
330 AllocateItem(
331     IN POOL_TYPE PoolType,
332     IN SIZE_T NumberOfBytes);
333 
334 VOID
335 FreeItem(
336     IN PVOID Item);
337 
338 #endif /* _WDMAUD_PCH_ */
339