ReactOS  0.4.14-dev-50-g13bb5e2
mmixer.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Kernel Streaming
4  * FILE: drivers/wdm/audio/legacy/wdmaud/mmixer.c
5  * PURPOSE: WDM Legacy Mixer
6  * PROGRAMMER: Johannes Anderwald
7  */
8 
9 #include "wdmaud.h"
10 
11 #include <mmixer.h>
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 PVOID Alloc(ULONG NumBytes);
17 MIXER_STATUS Close(HANDLE hDevice);
18 VOID Free(PVOID Block);
19 VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes);
20 MIXER_STATUS Open(IN LPWSTR DevicePath, OUT PHANDLE hDevice);
21 MIXER_STATUS Control(IN HANDLE hMixer, IN ULONG dwIoControlCode, IN PVOID lpInBuffer, IN ULONG nInBufferSize, OUT PVOID lpOutBuffer, ULONG nOutBufferSize, PULONG lpBytesReturned);
22 MIXER_STATUS Enum(IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR * DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey);
26 PVOID AllocEventData(IN ULONG ExtraSize);
27 VOID FreeEventData(IN PVOID EventData);
28 
30 {
31  sizeof(MIXER_CONTEXT),
32  NULL,
33  Alloc,
34  Control,
35  Free,
36  Open,
37  Close,
38  Copy,
39  OpenKey,
41  CloseKey,
44 };
45 
47 
50  IN HANDLE hKey,
51  IN LPWSTR lpKeyName,
54  OUT PULONG KeyType)
55 {
58  ULONG Length;
59  PKEY_VALUE_PARTIAL_INFORMATION PartialInformation;
60 
61  /* initialize key name */
62  RtlInitUnicodeString(&KeyName, lpKeyName);
63 
64  /* now query MatchingDeviceId key */
65  Status = ZwQueryValueKey(hKey, &KeyName, KeyValuePartialInformation, NULL, 0, &Length);
66 
67  /* check for success */
70 
71  /* allocate a buffer for key data */
72  PartialInformation = AllocateItem(NonPagedPool, Length);
73 
74  if (!PartialInformation)
75  return MM_STATUS_NO_MEMORY;
76 
77 
78  /* now query MatchingDeviceId key */
79  Status = ZwQueryValueKey(hKey, &KeyName, KeyValuePartialInformation, PartialInformation, Length, &Length);
80 
81  /* check for success */
82  if (!NT_SUCCESS(Status))
83  {
84  FreeItem(PartialInformation);
86  }
87 
88  if (KeyType)
89  {
90  /* return key type */
91  *KeyType = PartialInformation->Type;
92  }
93 
94  if (ResultLength)
95  {
96  /* return data length */
97  *ResultLength = PartialInformation->DataLength;
98  }
99 
100  *ResultBuffer = AllocateItem(NonPagedPool, PartialInformation->DataLength);
101  if (!*ResultBuffer)
102  {
103  /* not enough memory */
104  FreeItem(PartialInformation);
105  return MM_STATUS_NO_MEMORY;
106  }
107 
108  /* copy key value */
109  RtlMoveMemory(*ResultBuffer, PartialInformation->Data, PartialInformation->DataLength);
110 
111  /* free key info */
112  FreeItem(PartialInformation);
113 
114  return MM_STATUS_SUCCESS;
115 }
116 
119  IN HANDLE hKey,
120  IN LPWSTR lpSubKeyName,
122  OUT PHANDLE OutKey)
123 {
127 
128  /* initialize sub key name */
129  RtlInitUnicodeString(&SubKeyName, lpSubKeyName);
130 
131  /* initialize key attributes */
133 
134  /* open the key */
135  Status = ZwOpenKey(OutKey, DesiredAccess, &ObjectAttributes);
136 
137  if (NT_SUCCESS(Status))
138  return MM_STATUS_SUCCESS;
139  else
140  return MM_STATUS_UNSUCCESSFUL;
141 }
142 
145  IN HANDLE hKey)
146 {
147  if (ZwClose(hKey) == STATUS_SUCCESS)
148  return MM_STATUS_SUCCESS;
149  else
150  return MM_STATUS_UNSUCCESSFUL;
151 }
152 
153 
154 PVOID Alloc(ULONG NumBytes)
155 {
156  return AllocateItem(NonPagedPool, NumBytes);
157 }
158 
160 Close(HANDLE hDevice)
161 {
162  if (ZwClose(hDevice) == STATUS_SUCCESS)
163  return MM_STATUS_SUCCESS;
164  else
165  return MM_STATUS_UNSUCCESSFUL;
166 }
167 
168 VOID
169 Free(PVOID Block)
170 {
171  FreeItem(Block);
172 }
173 
174 VOID
175 Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
176 {
177  RtlMoveMemory(Src, Dst, NumBytes);
178 }
179 
182  IN LPWSTR DevicePath,
183  OUT PHANDLE hDevice)
184 {
185  if (WdmAudOpenSysAudioDevice(DevicePath, hDevice) == STATUS_SUCCESS)
186  return MM_STATUS_SUCCESS;
187  else
188  return MM_STATUS_UNSUCCESSFUL;
189 }
190 
193  IN HANDLE hMixer,
195  IN PVOID lpInBuffer,
196  IN ULONG nInBufferSize,
197  OUT PVOID lpOutBuffer,
198  ULONG nOutBufferSize,
200 {
203 
204  /* get file object */
206  if (!NT_SUCCESS(Status))
207  {
208  DPRINT("failed to reference %p with %lx\n", hMixer, Status);
209  return MM_STATUS_UNSUCCESSFUL;
210  }
211 
212  /* perform request */
213  Status = KsSynchronousIoControlDevice(FileObject, KernelMode, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned);
214 
215  /* release object reference */
217 
219  {
220  /* more data is available */
221  return MM_STATUS_MORE_ENTRIES;
222  }
223  else if (Status == STATUS_SUCCESS)
224  {
225  /* operation succeeded */
226  return MM_STATUS_SUCCESS;
227  }
228  else
229  {
230  DPRINT("Failed with %lx\n", Status);
231  return MM_STATUS_UNSUCCESSFUL;
232  }
233 }
234 
237  IN PVOID EnumContext,
238  IN ULONG DeviceIndex,
240  OUT PHANDLE OutHandle,
241  OUT PHANDLE OutKey)
242 {
247 
248  /* get enumeration context */
249  DeviceObject = (PDEVICE_OBJECT)EnumContext;
250 
251  /* get device count */
253 
254  if (DeviceIndex >= DeviceCount)
255  {
256  /* no more devices */
258  }
259 
260  /* get device name */
262 
263  if (!NT_SUCCESS(Status))
264  {
265  /* failed to retrieve device name */
266  return MM_STATUS_UNSUCCESSFUL;
267  }
268 
269  /* initialize key name */
271 
272  /* open device interface key */
274 
275  if (!NT_SUCCESS(Status))
276  {
277  *OutKey = NULL;
278  }
279 
280 #if 0
281  if (!NT_SUCCESS(Status))
282  {
283  /* failed to open key */
284  DPRINT("IoOpenDeviceInterfaceRegistryKey failed with %lx\n", Status);
286  return MM_STATUS_UNSUCCESSFUL;
287  }
288 #endif
289 
290  /* open device handle */
291  Status = OpenDevice(*DeviceName, OutHandle, NULL);
292  if (!NT_SUCCESS(Status))
293  {
294  /* failed to open device */
295  return MM_STATUS_UNSUCCESSFUL;
296  }
297 
298  return MM_STATUS_SUCCESS;
299 }
300 
301 PVOID
303  IN ULONG ExtraSize)
304 {
306  if (!Data)
307  return NULL;
308 
309  Data->EventObject.Event = AllocateItem(NonPagedPool, sizeof(KEVENT));
310  if (!Data->EventHandle.Event)
311  {
312  FreeItem(Data);
313  return NULL;
314  }
315 
316  KeInitializeEvent(Data->EventObject.Event, NotificationEvent, FALSE);
317 
318  Data->NotificationType = KSEVENTF_EVENT_HANDLE;
319  return Data;
320 }
321 
322 VOID
324 {
325  PKSEVENTDATA Data = (PKSEVENTDATA)EventData;
326 
327  FreeItem(Data->EventHandle.Event);
328  FreeItem(Data);
329 }
330 
331 VOID
332 CALLBACK
334  IN PVOID MixerEventContext,
335  IN HANDLE hMixer,
336  IN ULONG NotificationType,
337  IN ULONG Value)
338 {
341  ULONG Index;
342 
343  /* get client context */
344  ClientInfo = (PWDMAUD_CLIENT)MixerEventContext;
345 
346  /* now search for the mixer which originated the request */
347  for(Index = 0; Index < ClientInfo->NumPins; Index++)
348  {
349  if (ClientInfo->hPins[Index].Handle == hMixer && ClientInfo->hPins[Index].Type == MIXER_DEVICE_TYPE)
350  {
351  if (ClientInfo->hPins[Index].NotifyEvent)
352  {
353  /* allocate event entry */
355  if (!Entry)
356  {
357  /* no memory */
358  break;
359  }
360 
361  /* setup event entry */
362  Entry->NotificationType = NotificationType;
363  Entry->Value = Value;
364  Entry->hMixer = hMixer;
365 
366  /* insert entry */
367  InsertTailList(&ClientInfo->MixerEventList, &Entry->Entry);
368 
369  /* now notify the client */
370  KeSetEvent(ClientInfo->hPins[Index].NotifyEvent, 0, FALSE);
371  }
372  /* done */
373  break;
374  }
375  }
376 }
377 
378 
379 NTSTATUS
382 {
384 
385  /* initialize the mixer library */
387 
388  if (Status != MM_STATUS_SUCCESS)
389  {
390  /* failed to initialize mmixer library */
391  DPRINT("MMixerInitialize failed with %lx\n", Status);
392  }
393 
394  return Status;
395 }
396 
397 NTSTATUS
402  IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
403 {
404  if (MMixerGetCapabilities(&MixerContext, DeviceInfo->DeviceIndex, &DeviceInfo->u.MixCaps) == MM_STATUS_SUCCESS)
405  return STATUS_SUCCESS;
406 
408 }
409 
410 NTSTATUS
413  IN PIRP Irp,
416 {
417  HANDLE hMixer;
418  PWDMAUD_HANDLE Handles;
419  //PWDMAUD_DEVICE_EXTENSION DeviceExtension;
421  PKEVENT EventObject = NULL;
422 
423  DPRINT("WdmAudControlOpenMixer\n");
424 
425  //DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
426 
427  if (DeviceInfo->u.hNotifyEvent)
428  {
430 
431  if (!NT_SUCCESS(Status))
432  {
433  DPRINT1("Invalid notify event passed %p from client %p\n", DeviceInfo->u.hNotifyEvent, ClientInfo);
434  DbgBreakPoint();
436  }
437  }
438 
440  {
441  ObDereferenceObject(EventObject);
442  DPRINT1("Failed to open mixer\n");
444  }
445 
446 
447  Handles = AllocateItem(NonPagedPool, sizeof(WDMAUD_HANDLE) * (ClientInfo->NumPins+1));
448 
449  if (Handles)
450  {
451  if (ClientInfo->NumPins)
452  {
453  RtlMoveMemory(Handles, ClientInfo->hPins, sizeof(WDMAUD_HANDLE) * ClientInfo->NumPins);
454  FreeItem(ClientInfo->hPins);
455  }
456 
457  ClientInfo->hPins = Handles;
458  ClientInfo->hPins[ClientInfo->NumPins].Handle = hMixer;
459  ClientInfo->hPins[ClientInfo->NumPins].Type = MIXER_DEVICE_TYPE;
460  ClientInfo->hPins[ClientInfo->NumPins].NotifyEvent = EventObject;
461  ClientInfo->NumPins++;
462  }
463  else
464  {
465  ObDereferenceObject(EventObject);
467  }
468 
469  DeviceInfo->hDevice = hMixer;
470 
472 }
473 
474 NTSTATUS
477  IN PIRP Irp,
480  IN ULONG Index)
481 {
482  /* Remove event associated to this client */
484  {
485  DPRINT1("Failed to close mixer\n");
487  }
488 
489  /* Dereference event */
490  if (ClientInfo->hPins[Index].NotifyEvent)
491  {
492  ObDereferenceObject(ClientInfo->hPins[Index].NotifyEvent);
493  ClientInfo->hPins[Index].NotifyEvent = NULL;
494  }
495 
496  /* FIXME: do we need to free ClientInfo->hPins ? */
498 }
499 
500 VOID
504  IN ULONG Index)
505 {
506  ULONG DeviceCount, DeviceIndex;
507 
508  /* Get all mixers */
510 
511  /* Close every mixer attached to the device */
512  for (DeviceIndex = 0; DeviceIndex < DeviceCount; DeviceIndex++)
513  {
515  {
516  DPRINT1("Failed to close mixer for device %lu\n", DeviceIndex);
517  }
518  }
519 
520  /* Dereference event */
521  if (ClientInfo->hPins[Index].NotifyEvent)
522  {
523  ObDereferenceObject(ClientInfo->hPins[Index].NotifyEvent);
524  ClientInfo->hPins[Index].NotifyEvent = NULL;
525  }
526 }
527 
528 NTSTATUS
529 NTAPI
532  IN PIRP Irp,
535 {
537 
538  /* clear hmixer type flag */
539  DeviceInfo->Flags &= ~MIXER_OBJECTF_HMIXER;
540 
541  /* query mmixer library */
542  Status = MMixerGetControlDetails(&MixerContext, DeviceInfo->hDevice, DeviceInfo->DeviceIndex, DeviceInfo->Flags, &DeviceInfo->u.MixDetails);
543 
544  if (Status == MM_STATUS_SUCCESS)
546  else
548 }
549 
550 NTSTATUS
551 NTAPI
554  IN PIRP Irp,
557 {
559 
560  /* clear hmixer type flag */
561  DeviceInfo->Flags &= ~MIXER_OBJECTF_HMIXER;
562 
563  /* query mixer library */
564  Status = MMixerGetLineInfo(&MixerContext, DeviceInfo->hDevice, DeviceInfo->DeviceIndex, DeviceInfo->Flags, &DeviceInfo->u.MixLine);
565 
566  if (Status == MM_STATUS_SUCCESS)
568  else
570 }
571 
572 NTSTATUS
573 NTAPI
576  IN PIRP Irp,
579 {
581 
582  /* clear hmixer type flag */
583  DeviceInfo->Flags &= ~MIXER_OBJECTF_HMIXER;
584 
585  /* query mixer library */
586  Status = MMixerGetLineControls(&MixerContext, DeviceInfo->hDevice, DeviceInfo->DeviceIndex, DeviceInfo->Flags, &DeviceInfo->u.MixControls);
587 
588  if (Status == MM_STATUS_SUCCESS)
590  else
592 
593 
594 }
595 
596 NTSTATUS
597 NTAPI
600  IN PIRP Irp,
603 {
605 
606  /* clear hmixer type flag */
607  DeviceInfo->Flags &= ~MIXER_OBJECTF_HMIXER;
608 
609  /* query mixer library */
610  Status = MMixerSetControlDetails(&MixerContext, DeviceInfo->hDevice, DeviceInfo->DeviceIndex, DeviceInfo->Flags, &DeviceInfo->u.MixDetails);
611 
612  if (Status == MM_STATUS_SUCCESS)
614  else
616 }
617 
618 NTSTATUS
619 NTAPI
622  IN PIRP Irp,
625 {
627  PEVENT_ENTRY EventEntry;
628 
629  /* enumerate event list and check if there is a new event */
630  Entry = ClientInfo->MixerEventList.Flink;
631 
632  while(Entry != &ClientInfo->MixerEventList)
633  {
634  /* grab event entry */
636 
637  if (EventEntry->hMixer == DeviceInfo->hDevice)
638  {
639  /* found an entry */
640  DeviceInfo->u.MixerEvent.hMixer = EventEntry->hMixer;
641  DeviceInfo->u.MixerEvent.NotificationType = EventEntry->NotificationType;
642  DeviceInfo->u.MixerEvent.Value = EventEntry->Value;
643 
644  /* remove entry from list */
645  RemoveEntryList(&EventEntry->Entry);
646 
647  /* free event entry */
648  FreeItem(EventEntry);
649 
650  /* done */
652  }
653 
654  /* move to next */
655  Entry = Entry->Flink;
656  }
657 
658  /* no event entry available */
660 }
661 
662 ULONG
664 {
665  return MMixerGetCount(&MixerContext);
666 }
667 
668 ULONG
670 {
672 }
673 
674 ULONG
676 {
678 }
679 
680 ULONG
682 {
684 }
685 
686 ULONG
688 {
690 }
691 
692 NTSTATUS
694  IN ULONG DeviceIndex,
696  OUT LPWSTR *DevicePath)
697 {
699  {
701  return STATUS_SUCCESS;
702  else
703  return STATUS_UNSUCCESSFUL;
704  }
706  {
708  return STATUS_SUCCESS;
709  else
710  return STATUS_UNSUCCESSFUL;
711  }
712  else if (DeviceType == MIXER_DEVICE_TYPE)
713  {
715  }
716 
717  return STATUS_UNSUCCESSFUL;
718 }
719 
720 NTSTATUS
725  IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
726 {
728 
729  if (DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE)
730  {
731  /* get capabilities */
732  Status = MMixerWaveInCapabilities(&MixerContext, DeviceInfo->DeviceIndex, &DeviceInfo->u.WaveInCaps);
733  }
734  else if (DeviceInfo->DeviceType == WAVE_OUT_DEVICE_TYPE)
735  {
736  /* get capabilities */
737  Status = MMixerWaveOutCapabilities(&MixerContext, DeviceInfo->DeviceIndex, &DeviceInfo->u.WaveOutCaps);
738  }
739 
740  if (Status == MM_STATUS_SUCCESS)
741  return STATUS_SUCCESS;
742  else
743  return Status;
744 }
745 
746 NTSTATUS
751  IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
752 {
754 
755  if (DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE)
756  {
757  /* get capabilities */
758  Status = MMixerMidiInCapabilities(&MixerContext, DeviceInfo->DeviceIndex, &DeviceInfo->u.MidiInCaps);
759  }
760  else if (DeviceInfo->DeviceType == WAVE_OUT_DEVICE_TYPE)
761  {
762  /* get capabilities */
763  Status = MMixerMidiOutCapabilities(&MixerContext, DeviceInfo->DeviceIndex, &DeviceInfo->u.MidiOutCaps);
764  }
765 
766  if (Status == MM_STATUS_SUCCESS)
767  return STATUS_SUCCESS;
768  else
769  return STATUS_UNSUCCESSFUL;
770 }
771 
772 
775  IN PVOID Ctx,
776  IN ULONG VirtualDeviceId,
777  IN ULONG PinId,
778  IN HANDLE hFilter,
779  IN PKSPIN_CONNECT PinConnect,
781  OUT PHANDLE PinHandle)
782 {
784  SYSAUDIO_INSTANCE_INFO InstanceInfo;
786  ULONG FreeIndex;
788 
789  /* setup property request */
790  InstanceInfo.Property.Set = KSPROPSETID_Sysaudio;
792  InstanceInfo.Property.Flags = KSPROPERTY_TYPE_SET;
793  InstanceInfo.Flags = 0;
794  InstanceInfo.DeviceNumber = VirtualDeviceId;
795 
796  /* attach to virtual device */
797  Status = KsSynchronousIoControlDevice(Context->DeviceExtension->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&InstanceInfo, sizeof(SYSAUDIO_INSTANCE_INFO), NULL, 0, &BytesReturned);
798 
799  if (!NT_SUCCESS(Status))
800  return MM_STATUS_UNSUCCESSFUL;
801 
802  /* close existing pin */
803  FreeIndex = ClosePin(Context->ClientInfo, VirtualDeviceId, PinId, Context->DeviceType);
804 
805  /* now create the pin */
806  Status = KsCreatePin(Context->DeviceExtension->hSysAudio, PinConnect, DesiredAccess, PinHandle);
807 
808  /* check for success */
809  if (!NT_SUCCESS(Status))
810  return MM_STATUS_UNSUCCESSFUL;
811 
812  /* store the handle */
813  Status = InsertPinHandle(Context->ClientInfo, VirtualDeviceId, PinId, Context->DeviceType, *PinHandle, FreeIndex);
814  if (!NT_SUCCESS(Status))
815  {
816  /* failed to insert handle */
817  ZwClose(*PinHandle);
818  return MM_STATUS_UNSUCCESSFUL;
819  }
820 
821  return MM_STATUS_SUCCESS;
822 }
823 
824 NTSTATUS
827  IN PIRP Irp,
830 {
833 
834  Context.ClientInfo = ClientInfo;
836  Context.DeviceType = DeviceInfo->DeviceType;
837 
838  Status = MMixerOpenWave(&MixerContext, DeviceInfo->DeviceIndex, DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE, &DeviceInfo->u.WaveFormatEx, CreatePinCallback, &Context, &DeviceInfo->hDevice);
839 
840  if (Status == MM_STATUS_SUCCESS)
842  else
844 }
845 
846 NTSTATUS
849  IN PIRP Irp,
852 {
855 
856  Context.ClientInfo = ClientInfo;
858  Context.DeviceType = DeviceInfo->DeviceType;
859 
861 
862  if (Status == MM_STATUS_SUCCESS)
864  else
866 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
MMRESULT WdmAudGetLineInfo(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINEW MixLine, IN ULONG Flags)
Definition: mmixer.c:405
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
MIXER_STATUS MMixerOpenWave(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, IN ULONG bWaveIn, IN LPWAVEFORMATEX WaveFormat, IN PIN_CREATE_CALLBACK CreateCallback, IN PVOID Context, OUT PHANDLE PinHandle)
Definition: wave.c:436
VOID CALLBACK EventCallback(IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
Definition: mmixer.c:333
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
#define IN
Definition: typedefs.h:38
ULONG MMixerGetWaveInCount(IN PMIXER_CONTEXT MixerContext)
Definition: wave.c:563
NTSTATUS WdmAudControlOpenMidi(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:847
MIXER_STATUS Control(IN HANDLE hMixer, IN ULONG dwIoControlCode, IN PVOID lpInBuffer, IN ULONG nInBufferSize, OUT PVOID lpOutBuffer, ULONG nOutBufferSize, PULONG lpBytesReturned)
Definition: mmixer.c:158
NTSTATUS NTAPI IoOpenDeviceInterfaceRegistryKey(IN PUNICODE_STRING SymbolicLinkName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DeviceInterfaceKey)
Definition: deviface.c:241
MIXER_STATUS QueryKeyValue(IN HANDLE hKey, IN LPWSTR KeyName, OUT PVOID *ResultBuffer, OUT PULONG ResultLength, OUT PULONG KeyType)
Definition: mmixer.c:66
NTSTATUS InsertPinHandle(IN PWDMAUD_CLIENT ClientInfo, IN ULONG FilterId, IN ULONG PinId, IN SOUND_DEVICE_TYPE DeviceType, IN HANDLE PinHandle, IN ULONG FreeIndex)
Definition: sup.c:104
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
#define STATIC_KSCATEGORY_AUDIO
Definition: ksmedia.h:169
KSDDKAPI DWORD NTAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle)
Definition: ksuser.c:192
struct _Entry Entry
Definition: kefuncs.h:640
struct WDMAUD_CLIENT * PWDMAUD_CLIENT
MIXER_STATUS MMixerInitialize(IN PMIXER_CONTEXT MixerContext, IN PMIXER_ENUM EnumFunction, IN PVOID EnumContext)
Definition: mixer.c:770
NTSTATUS WdmAudMixerCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
Definition: mmixer.c:398
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct KSEVENTDATA * PKSEVENTDATA
struct _DEVICE_OBJECT * PDEVICE_OBJECT
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
DeviceType
Definition: mmdrv.h:41
MIXER_STATUS MMixerGetLineInfo(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINEW MixerLine)
Definition: mixer.c:149
PVOID AllocEventData(IN ULONG ExtraSize)
Definition: mmixer.c:312
ULONG MMixerGetCount(IN PMIXER_CONTEXT MixerContext)
Definition: mixer.c:15
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
#define CALLBACK
Definition: compat.h:27
HANDLE hMixer
Definition: wdmaud.h:42
LIST_ENTRY Entry
Definition: wdmaud.h:39
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
MIXER_STATUS Close(HANDLE hDevice)
Definition: mmixer.c:116
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define InsertTailList(ListHead, Entry)
MIXER_STATUS MMixerGetMidiDevicePath(IN PMIXER_CONTEXT MixerContext, IN ULONG bMidiIn, IN ULONG DeviceId, OUT LPWSTR *DevicePath)
Definition: midi.c:380
NTSTATUS WdmAudControlCloseMixer(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN ULONG Index)
Definition: mmixer.c:475
MIXER_STATUS MMixerGetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERCONTROLDETAILS MixerControlDetails)
Definition: mixer.c:566
NTSTATUS GetSysAudioDevicePnpName(IN PDEVICE_OBJECT DeviceObject, IN ULONG DeviceIndex, OUT LPWSTR *Device)
Definition: sup.c:357
void DbgBreakPoint()
Definition: mach.c:553
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
PVOID Alloc(ULONG NumBytes)
Definition: mmixer.c:110
GUID Set
Definition: dmksctrl.h:76
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
ULONG WdmAudGetWaveInDeviceCount()
Definition: mmixer.c:669
KSPROPERTY Property
Definition: ksmedia.h:1080
VOID FreeEventData(IN PVOID EventData)
Definition: mmixer.c:331
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
KSDDKAPI NTSTATUS NTAPI KsSynchronousIoControlDevice(IN PFILE_OBJECT FileObject, IN KPROCESSOR_MODE RequestorMode, IN ULONG IoControl, IN PVOID InBuffer, IN ULONG InSize, OUT PVOID OutBuffer, IN ULONG OutSize, OUT PULONG BytesReturned)
Definition: api.c:1099
CLIENT_DATA ClientInfo
#define OBJ_OPENIF
Definition: winternl.h:229
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
MMRESULT OpenDevice(DeviceInfo **private_data, MIDIOPENDESC *open_desc, DWORD flags)
Definition: beepmidi.c:264
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
ULONG DeviceCount
Definition: mpu401.c:26
struct PIN_CREATE_CONTEXT * PPIN_CREATE_CONTEXT
Entry(ENTRY_TYPE etype)
Definition: entries.cpp:35
#define GENERIC_WRITE
Definition: nt_native.h:90
struct WDMAUD_DEVICE_EXTENSION * PWDMAUD_DEVICE_EXTENSION
ULONG WdmAudGetMidiInDeviceCount()
Definition: mmixer.c:681
MMRESULT WdmAudSetControlDetails(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
Definition: mmixer.c:431
HMIXER hMixer
Definition: test.c:10
NTSTATUS WdmAudControlOpenWave(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:825
MMRESULT WdmAudGetControlDetails(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
Definition: mmixer.c:445
ULONG Value
Definition: wdmaud.h:41
PVOID DeviceExtension
Definition: env_spec_w32.h:418
MIXER_STATUS MMixerGetLineControls(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINECONTROLSW MixerLineControls)
Definition: mixer.c:332
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS WdmAudWaveCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
Definition: mmixer.c:721
ULONG ClosePin(IN PWDMAUD_CLIENT ClientInfo, IN ULONG FilterId, IN ULONG PinId, IN SOUND_DEVICE_TYPE DeviceType)
Definition: sup.c:80
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
void DPRINT(...)
Definition: polytest.cpp:61
GUID CategoryGuid
Definition: mmixer.c:63
MIXER_STATUS MMixerClose(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerId, IN PVOID MixerEventContext, IN PMIXER_EVENT MixerEventRoutine)
Definition: mixer.c:116
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
NTSTATUS WdmAudMixerInitialize(IN PDEVICE_OBJECT DeviceObject)
Definition: mmixer.c:380
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
MIXER_STATUS Open(IN LPWSTR DevicePath, OUT PHANDLE hDevice)
Definition: mmixer.c:137
NTSTATUS WdmAudOpenSysAudioDevice(IN LPWSTR DeviceName, OUT PHANDLE Handle)
Definition: deviface.c:16
MIXER_STATUS CreatePinCallback(IN PVOID Ctx, IN ULONG VirtualDeviceId, IN ULONG PinId, IN HANDLE hFilter, IN PKSPIN_CONNECT PinConnect, IN ACCESS_MASK DesiredAccess, OUT PHANDLE PinHandle)
Definition: mmixer.c:774
NTSTATUS WdmAudControlOpenMixer(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:411
VOID Free(PVOID Block)
Definition: mmixer.c:125
ULONG Id
Definition: dmksctrl.h:77
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG MMixerGetMidiInCount(IN PMIXER_CONTEXT MixerContext)
Definition: midi.c:502
static const UCHAR Index[8]
Definition: usbohci.c:18
MIXER_STATUS MMixerGetWaveDevicePath(IN PMIXER_CONTEXT MixerContext, IN ULONG bWaveIn, IN ULONG DeviceId, OUT LPWSTR *DevicePath)
Definition: wave.c:659
MIXER_STATUS MMixerWaveInCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEINCAPSW Caps)
Definition: wave.c:491
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
MIXER_STATUS MMixerMidiOutCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPMIDIOUTCAPSW Caps)
Definition: midi.c:308
* PFILE_OBJECT
Definition: iotypes.h:1955
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
MMRESULT WdmAudGetLineControls(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINECONTROLSW MixControls, IN ULONG Flags)
Definition: mmixer.c:418
ULONG Flags
Definition: dmksctrl.h:78
VOID WdmAudCloseAllMixers(IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_CLIENT ClientInfo, IN ULONG Index)
Definition: mmixer.c:501
struct EVENT_ENTRY * PEVENT_ENTRY
MIXER_STATUS MMixerWaveOutCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEOUTCAPSW Caps)
Definition: wave.c:527
ULONG WdmAudGetWaveOutDeviceCount()
Definition: mmixer.c:675
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
NTSTATUS WdmAudGetPnpNameByIndexAndType(IN ULONG DeviceIndex, IN SOUND_DEVICE_TYPE DeviceType, OUT LPWSTR *DevicePath)
Definition: mmixer.c:693
#define GENERIC_READ
Definition: compat.h:124
Definition: typedefs.h:117
MIXER_STATUS CloseKey(IN HANDLE hKey)
Definition: mmixer.c:102
MIXER_STATUS Enum(IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR *DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey)
Definition: mmixer.c:225
MIXER_STATUS OpenKey(IN HANDLE hKey, IN LPWSTR SubKey, IN ULONG DesiredAccess, OUT PHANDLE OutKey)
Definition: mmixer.c:89
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
#define STATUS_MORE_ENTRIES
Definition: udferr_usr.h:124
Status
Definition: gdiplustypes.h:24
#define Dst
Definition: mesh.h:153
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
MIXER_STATUS MMixerSetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERCONTROLDETAILS MixerControlDetails)
Definition: mixer.c:496
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:131
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
MIXER_STATUS
Definition: mmixer.h:3
MIXER_STATUS MMixerOpenMidi(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, IN ULONG bMidiIn, IN PIN_CREATE_CALLBACK CreateCallback, IN PVOID Context, OUT PHANDLE PinHandle)
Definition: midi.c:454
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
#define KSEVENTF_EVENT_HANDLE
Definition: ks.h:1778
unsigned int * PULONG
Definition: retypes.h:1
SOUND_DEVICE_TYPE
Definition: sndtypes.h:25
_In_ DWORD _In_ DWORD _In_ DWORD _Out_ LPDWORD lpBytesReturned
Definition: winddi.h:1704
#define DPRINT1
Definition: precomp.h:8
#define KSPROPSETID_Sysaudio
Definition: ksmedia.h:1065
MIXER_STATUS MMixerOpen(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerId, IN PVOID MixerEventContext, IN PMIXER_EVENT MixerEventRoutine, OUT PHANDLE MixerHandle)
Definition: mixer.c:77
NTSTATUS NTAPI WdmAudGetMixerEvent(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:620
MIXER_STATUS MMixerMidiInCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPMIDIINCAPSW Caps)
Definition: midi.c:344
#define OUT
Definition: typedefs.h:39
ULONG NotificationType
Definition: wdmaud.h:40
struct tagContext Context
Definition: acpixf.h:1024
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
NTSTATUS WdmAudMidiCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
Definition: mmixer.c:747
unsigned int ULONG
Definition: retypes.h:1
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNIMPLEMENTED
Definition: debug.h:114
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
MIXER_STATUS MMixerGetCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerIndex, OUT LPMIXERCAPSW MixerCaps)
Definition: mixer.c:38
WCHAR * LPWSTR
Definition: xmlstorage.h:184
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
PKMT_RESULTBUFFER ResultBuffer
ULONG WdmAudGetMixerDeviceCount()
Definition: mmixer.c:663
ULONG GetSysAudioDeviceCount(IN PDEVICE_OBJECT DeviceObject)
Definition: sup.c:42
ULONG ACCESS_MASK
Definition: nt_native.h:40
base of all file and directory entries
Definition: entries.h:82
Definition: wdmaud.h:37
ULONG MMixerGetWaveOutCount(IN PMIXER_CONTEXT MixerContext)
Definition: wave.c:585
ULONG WdmAudGetMidiOutDeviceCount()
Definition: mmixer.c:687
_In_ DWORD dwIoControlCode
Definition: winddi.h:1700