ReactOS  0.4.13-dev-242-g611e6d7
mmixer.c File Reference
#include "wdmaud.h"
#include <mmixer.h>
#include <debug.h>
Include dependency graph for mmixer.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PVOID Alloc (ULONG NumBytes)
 
MIXER_STATUS Close (HANDLE hDevice)
 
VOID Free (PVOID Block)
 
VOID Copy (PVOID Src, PVOID Dst, ULONG NumBytes)
 
MIXER_STATUS Open (IN LPWSTR DevicePath, OUT PHANDLE hDevice)
 
MIXER_STATUS Control (IN HANDLE hMixer, IN ULONG dwIoControlCode, IN PVOID lpInBuffer, IN ULONG nInBufferSize, OUT PVOID lpOutBuffer, ULONG nOutBufferSize, PULONG lpBytesReturned)
 
MIXER_STATUS Enum (IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR *DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey)
 
MIXER_STATUS OpenKey (IN HANDLE hKey, IN LPWSTR SubKey, IN ULONG DesiredAccess, OUT PHANDLE OutKey)
 
MIXER_STATUS CloseKey (IN HANDLE hKey)
 
MIXER_STATUS QueryKeyValue (IN HANDLE hKey, IN LPWSTR KeyName, OUT PVOID *ResultBuffer, OUT PULONG ResultLength, OUT PULONG KeyType)
 
PVOID AllocEventData (IN ULONG ExtraSize)
 
VOID FreeEventData (IN PVOID EventData)
 
VOID CALLBACK EventCallback (IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
 
NTSTATUS WdmAudMixerInitialize (IN PDEVICE_OBJECT DeviceObject)
 
NTSTATUS WdmAudMixerCapabilities (IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS WdmAudControlOpenMixer (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS WdmAudControlCloseMixer (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN ULONG Index)
 
VOID WdmAudCloseAllMixers (IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_CLIENT ClientInfo, IN ULONG Index)
 
NTSTATUS NTAPI WdmAudGetControlDetails (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS NTAPI WdmAudGetLineInfo (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS NTAPI WdmAudGetLineControls (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS NTAPI WdmAudSetControlDetails (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS NTAPI WdmAudGetMixerEvent (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
ULONG WdmAudGetMixerDeviceCount ()
 
ULONG WdmAudGetWaveInDeviceCount ()
 
ULONG WdmAudGetWaveOutDeviceCount ()
 
ULONG WdmAudGetMidiInDeviceCount ()
 
ULONG WdmAudGetMidiOutDeviceCount ()
 
NTSTATUS WdmAudGetPnpNameByIndexAndType (IN ULONG DeviceIndex, IN SOUND_DEVICE_TYPE DeviceType, OUT LPWSTR *DevicePath)
 
NTSTATUS WdmAudWaveCapabilities (IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS WdmAudMidiCapabilities (IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
 
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)
 
NTSTATUS WdmAudControlOpenWave (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS WdmAudControlOpenMidi (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 

Variables

MIXER_CONTEXT MixerContext
 
GUID CategoryGuid = {STATIC_KSCATEGORY_AUDIO}
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file mmixer.c.

Function Documentation

◆ Alloc()

PVOID Alloc ( ULONG  NumBytes)

Definition at line 154 of file mmixer.c.

155 {
156  return AllocateItem(NonPagedPool, NumBytes);
157 }
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30

◆ AllocEventData()

PVOID AllocEventData ( IN ULONG  ExtraSize)

Definition at line 302 of file mmixer.c.

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 }
struct KSEVENTDATA * PKSEVENTDATA
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KSEVENTF_EVENT_HANDLE
Definition: ks.h:1808

◆ Close()

MIXER_STATUS Close ( HANDLE  hDevice)

Definition at line 160 of file mmixer.c.

161 {
162  if (ZwClose(hDevice) == STATUS_SUCCESS)
163  return MM_STATUS_SUCCESS;
164  else
165  return MM_STATUS_UNSUCCESSFUL;
166 }
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ CloseKey()

MIXER_STATUS CloseKey ( IN HANDLE  hKey)

Definition at line 144 of file mmixer.c.

146 {
147  if (ZwClose(hKey) == STATUS_SUCCESS)
148  return MM_STATUS_SUCCESS;
149  else
150  return MM_STATUS_UNSUCCESSFUL;
151 }
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ Control()

MIXER_STATUS Control ( IN HANDLE  hMixer,
IN ULONG  dwIoControlCode,
IN PVOID  lpInBuffer,
IN ULONG  nInBufferSize,
OUT PVOID  lpOutBuffer,
ULONG  nOutBufferSize,
PULONG  lpBytesReturned 
)

Definition at line 192 of file mmixer.c.

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 }
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
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
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
#define GENERIC_WRITE
Definition: nt_native.h:90
HMIXER hMixer
Definition: test.c:10
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
* PFILE_OBJECT
Definition: iotypes.h:1954
#define GENERIC_READ
Definition: compat.h:124
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
#define STATUS_MORE_ENTRIES
Definition: udferr_usr.h:124
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
_In_ DWORD _In_ DWORD _In_ DWORD _Out_ LPDWORD lpBytesReturned
Definition: winddi.h:1704
return STATUS_SUCCESS
Definition: btrfs.c:2745
_In_ DWORD dwIoControlCode
Definition: winddi.h:1700

◆ Copy()

VOID Copy ( PVOID  Src,
PVOID  Dst,
ULONG  NumBytes 
)

Definition at line 175 of file mmixer.c.

176 {
177  RtlMoveMemory(Src, Dst, NumBytes);
178 }
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define Dst
Definition: mesh.h:153

◆ CreatePinCallback()

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 at line 774 of file mmixer.c.

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 }
#define IOCTL_KS_PROPERTY
Definition: ks.h:150
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
KSDDKAPI DWORD NTAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle)
Definition: ksuser.c:192
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
GUID Set
Definition: dmksctrl.h:76
KSPROPERTY Property
Definition: ksmedia.h:1080
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
struct PIN_CREATE_CONTEXT * PPIN_CREATE_CONTEXT
smooth NULL
Definition: ftsmooth.c:416
ULONG ClosePin(IN PWDMAUD_CLIENT ClientInfo, IN ULONG FilterId, IN ULONG PinId, IN SOUND_DEVICE_TYPE DeviceType)
Definition: sup.c:80
ULONG Id
Definition: dmksctrl.h:77
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG Flags
Definition: dmksctrl.h:78
Status
Definition: gdiplustypes.h:24
_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 KSPROPSETID_Sysaudio
Definition: ksmedia.h:1065
unsigned int ULONG
Definition: retypes.h:1
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43

Referenced by WdmAudControlOpenMidi(), and WdmAudControlOpenWave().

◆ Enum()

MIXER_STATUS Enum ( IN PVOID  EnumContext,
IN ULONG  DeviceIndex,
OUT LPWSTR DeviceName,
OUT PHANDLE  OutHandle,
OUT PHANDLE  OutKey 
)

Definition at line 236 of file mmixer.c.

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 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
NTSTATUS NTAPI IoOpenDeviceInterfaceRegistryKey(IN PUNICODE_STRING SymbolicLinkName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DeviceInterfaceKey)
Definition: deviface.c:241
struct _DEVICE_OBJECT * PDEVICE_OBJECT
LONG NTSTATUS
Definition: precomp.h:26
WCHAR DeviceName[]
Definition: adapter.cpp:21
NTSTATUS GetSysAudioDevicePnpName(IN PDEVICE_OBJECT DeviceObject, IN ULONG DeviceIndex, OUT LPWSTR *Device)
Definition: sup.c:357
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
MMRESULT OpenDevice(DeviceInfo **private_data, MIDIOPENDESC *open_desc, DWORD flags)
Definition: beepmidi.c:264
ULONG DeviceCount
Definition: mpu401.c:26
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
ULONG GetSysAudioDeviceCount(IN PDEVICE_OBJECT DeviceObject)
Definition: sup.c:42

◆ EventCallback()

VOID CALLBACK EventCallback ( IN PVOID  MixerEventContext,
IN HANDLE  hMixer,
IN ULONG  NotificationType,
IN ULONG  Value 
)

Definition at line 333 of file mmixer.c.

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 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
struct _Entry Entry
Definition: kefuncs.h:640
struct WDMAUD_CLIENT * PWDMAUD_CLIENT
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
#define InsertTailList(ListHead, Entry)
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
CLIENT_DATA ClientInfo
Entry(ENTRY_TYPE etype)
Definition: entries.cpp:35
HMIXER hMixer
Definition: test.c:10
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned int ULONG
Definition: retypes.h:1
base of all file and directory entries
Definition: entries.h:82
Definition: wdmaud.h:37

Referenced by WdmAudCloseAllMixers(), WdmAudControlCloseMixer(), and WdmAudControlOpenMixer().

◆ Free()

VOID Free ( PVOID  Block)

Definition at line 169 of file mmixer.c.

170 {
171  FreeItem(Block);
172 }
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43

Referenced by ILGlobalFree().

◆ FreeEventData()

VOID FreeEventData ( IN PVOID  EventData)

Definition at line 323 of file mmixer.c.

324 {
325  PKSEVENTDATA Data = (PKSEVENTDATA)EventData;
326 
327  FreeItem(Data->EventHandle.Event);
328  FreeItem(Data);
329 }
struct KSEVENTDATA * PKSEVENTDATA
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43

◆ Open()

MIXER_STATUS Open ( IN LPWSTR  DevicePath,
OUT PHANDLE  hDevice 
)

Definition at line 181 of file mmixer.c.

184 {
185  if (WdmAudOpenSysAudioDevice(DevicePath, hDevice) == STATUS_SUCCESS)
186  return MM_STATUS_SUCCESS;
187  else
188  return MM_STATUS_UNSUCCESSFUL;
189 }
NTSTATUS WdmAudOpenSysAudioDevice(IN LPWSTR DeviceName, OUT PHANDLE Handle)
Definition: deviface.c:16
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ OpenKey()

MIXER_STATUS OpenKey ( IN HANDLE  hKey,
IN LPWSTR  SubKey,
IN ULONG  DesiredAccess,
OUT PHANDLE  OutKey 
)

Definition at line 118 of file mmixer.c.

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 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
LONG NTSTATUS
Definition: precomp.h:26
#define OBJ_OPENIF
Definition: winternl.h:229
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
Status
Definition: gdiplustypes.h:24
_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
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106

◆ QueryKeyValue()

MIXER_STATUS QueryKeyValue ( IN HANDLE  hKey,
IN LPWSTR  KeyName,
OUT PVOID ResultBuffer,
OUT PULONG  ResultLength,
OUT PULONG  KeyType 
)

Definition at line 49 of file mmixer.c.

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 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PKMT_RESULTBUFFER ResultBuffer

◆ WdmAudCloseAllMixers()

VOID WdmAudCloseAllMixers ( IN PDEVICE_OBJECT  DeviceObject,
IN PWDMAUD_CLIENT  ClientInfo,
IN ULONG  Index 
)

Definition at line 501 of file mmixer.c.

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 }
VOID CALLBACK EventCallback(IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
Definition: mmixer.c:333
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
CLIENT_DATA ClientInfo
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
ULONG DeviceCount
Definition: mpu401.c:26
smooth NULL
Definition: ftsmooth.c:416
MIXER_STATUS MMixerClose(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerId, IN PVOID MixerEventContext, IN PMIXER_EVENT MixerEventRoutine)
Definition: mixer.c:116
static const UCHAR Index[8]
Definition: usbohci.c:18
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
ULONG GetSysAudioDeviceCount(IN PDEVICE_OBJECT DeviceObject)
Definition: sup.c:42

Referenced by WdmAudCleanup().

◆ WdmAudControlCloseMixer()

NTSTATUS WdmAudControlCloseMixer ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo,
IN ULONG  Index 
)

Definition at line 475 of file mmixer.c.

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 }
VOID CALLBACK EventCallback(IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
Definition: mmixer.c:333
_In_ PIRP Irp
Definition: csq.h:116
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
CLIENT_DATA ClientInfo
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
smooth NULL
Definition: ftsmooth.c:416
MIXER_STATUS MMixerClose(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerId, IN PVOID MixerEventContext, IN PMIXER_EVENT MixerEventRoutine)
Definition: mixer.c:116
static const UCHAR Index[8]
Definition: usbohci.c:18
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudIoctlClose().

◆ WdmAudControlOpenMidi()

NTSTATUS WdmAudControlOpenMidi ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 847 of file mmixer.c.

852 {
855 
856  Context.ClientInfo = ClientInfo;
858  Context.DeviceType = DeviceInfo->DeviceType;
859 
861 
862  if (Status == MM_STATUS_SUCCESS)
864  else
866 }
_In_ PIRP Irp
Definition: csq.h:116
CLIENT_DATA ClientInfo
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
struct WDMAUD_DEVICE_EXTENSION * PWDMAUD_DEVICE_EXTENSION
PVOID DeviceExtension
Definition: env_spec_w32.h:418
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
Status
Definition: gdiplustypes.h:24
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
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
struct tagContext Context
Definition: acpixf.h:1012
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudControlOpen().

◆ WdmAudControlOpenMixer()

NTSTATUS WdmAudControlOpenMixer ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 411 of file mmixer.c.

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 }
VOID CALLBACK EventCallback(IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
Definition: mmixer.c:333
_In_ PIRP Irp
Definition: csq.h:116
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
void DbgBreakPoint()
Definition: mach.c:558
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
CLIENT_DATA ClientInfo
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
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
HMIXER hMixer
Definition: test.c:10
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Status
Definition: gdiplustypes.h:24
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
#define DPRINT1
Definition: precomp.h:8
MIXER_STATUS MMixerOpen(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerId, IN PVOID MixerEventContext, IN PMIXER_EVENT MixerEventRoutine, OUT PHANDLE MixerHandle)
Definition: mixer.c:77
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudControlOpen().

◆ WdmAudControlOpenWave()

NTSTATUS WdmAudControlOpenWave ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 825 of file mmixer.c.

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 }
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
_In_ PIRP Irp
Definition: csq.h:116
CLIENT_DATA ClientInfo
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
struct WDMAUD_DEVICE_EXTENSION * PWDMAUD_DEVICE_EXTENSION
PVOID DeviceExtension
Definition: env_spec_w32.h:418
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
Status
Definition: gdiplustypes.h:24
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
MIXER_STATUS
Definition: mmixer.h:3
struct tagContext Context
Definition: acpixf.h:1012
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudControlOpen().

◆ WdmAudGetControlDetails()

NTSTATUS NTAPI WdmAudGetControlDetails ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 530 of file mmixer.c.

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 }
_In_ PIRP Irp
Definition: csq.h:116
MIXER_STATUS MMixerGetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERCONTROLDETAILS MixerControlDetails)
Definition: mixer.c:566
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
Status
Definition: gdiplustypes.h:24
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
MIXER_STATUS
Definition: mmixer.h:3
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ WdmAudGetLineControls()

NTSTATUS NTAPI WdmAudGetLineControls ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 574 of file mmixer.c.

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 }
_In_ PIRP Irp
Definition: csq.h:116
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
MIXER_STATUS MMixerGetLineControls(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINECONTROLSW MixerLineControls)
Definition: mixer.c:332
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
Status
Definition: gdiplustypes.h:24
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
MIXER_STATUS
Definition: mmixer.h:3
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ WdmAudGetLineInfo()

NTSTATUS NTAPI WdmAudGetLineInfo ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 552 of file mmixer.c.

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 }
_In_ PIRP Irp
Definition: csq.h:116
MIXER_STATUS MMixerGetLineInfo(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINEW MixerLine)
Definition: mixer.c:149
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
Status
Definition: gdiplustypes.h:24
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
MIXER_STATUS
Definition: mmixer.h:3
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ WdmAudGetMidiInDeviceCount()

ULONG WdmAudGetMidiInDeviceCount ( )

Definition at line 681 of file mmixer.c.

682 {
684 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
ULONG MMixerGetMidiInCount(IN PMIXER_CONTEXT MixerContext)
Definition: midi.c:502

Referenced by WdmAudControlDeviceType().

◆ WdmAudGetMidiOutDeviceCount()

ULONG WdmAudGetMidiOutDeviceCount ( )

Definition at line 687 of file mmixer.c.

688 {
690 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
ULONG MMixerGetWaveOutCount(IN PMIXER_CONTEXT MixerContext)
Definition: wave.c:585

Referenced by WdmAudControlDeviceType().

◆ WdmAudGetMixerDeviceCount()

ULONG WdmAudGetMixerDeviceCount ( )

Definition at line 663 of file mmixer.c.

664 {
665  return MMixerGetCount(&MixerContext);
666 }
ULONG MMixerGetCount(IN PMIXER_CONTEXT MixerContext)
Definition: mixer.c:15
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46

Referenced by WdmAudControlDeviceType(), and WdmAudInitWorkerRoutine().

◆ WdmAudGetMixerEvent()

NTSTATUS NTAPI WdmAudGetMixerEvent ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 620 of file mmixer.c.

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 }
struct _Entry Entry
Definition: kefuncs.h:640
_In_ PIRP Irp
Definition: csq.h:116
HANDLE hMixer
Definition: wdmaud.h:42
LIST_ENTRY Entry
Definition: wdmaud.h:39
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
CLIENT_DATA ClientInfo
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
ULONG Value
Definition: wdmaud.h:41
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
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
struct EVENT_ENTRY * PEVENT_ENTRY
Definition: typedefs.h:117
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:67
ULONG NotificationType
Definition: wdmaud.h:40
return STATUS_SUCCESS
Definition: btrfs.c:2745
base of all file and directory entries
Definition: entries.h:82
Definition: wdmaud.h:37

Referenced by WdmAudDeviceControl().

◆ WdmAudGetPnpNameByIndexAndType()

NTSTATUS WdmAudGetPnpNameByIndexAndType ( IN ULONG  DeviceIndex,
IN SOUND_DEVICE_TYPE  DeviceType,
OUT LPWSTR DevicePath 
)

Definition at line 693 of file mmixer.c.

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 }
DeviceType
Definition: mmdrv.h:41
MIXER_STATUS MMixerGetMidiDevicePath(IN PMIXER_CONTEXT MixerContext, IN ULONG bMidiIn, IN ULONG DeviceId, OUT LPWSTR *DevicePath)
Definition: midi.c:380
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
MIXER_STATUS MMixerGetWaveDevicePath(IN PMIXER_CONTEXT MixerContext, IN ULONG bWaveIn, IN ULONG DeviceId, OUT LPWSTR *DevicePath)
Definition: wave.c:659
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define UNIMPLEMENTED
Definition: debug.h:114
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudGetDeviceInterface().

◆ WdmAudGetWaveInDeviceCount()

ULONG WdmAudGetWaveInDeviceCount ( )

Definition at line 669 of file mmixer.c.

670 {
672 }
ULONG MMixerGetWaveInCount(IN PMIXER_CONTEXT MixerContext)
Definition: wave.c:563
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46

Referenced by WdmAudControlDeviceType(), and WdmAudInitWorkerRoutine().

◆ WdmAudGetWaveOutDeviceCount()

ULONG WdmAudGetWaveOutDeviceCount ( )

Definition at line 675 of file mmixer.c.

676 {
678 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
ULONG MMixerGetWaveOutCount(IN PMIXER_CONTEXT MixerContext)
Definition: wave.c:585

Referenced by WdmAudControlDeviceType(), and WdmAudInitWorkerRoutine().

◆ WdmAudMidiCapabilities()

NTSTATUS WdmAudMidiCapabilities ( IN PDEVICE_OBJECT  DeviceObject,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo,
IN PWDMAUD_DEVICE_EXTENSION  DeviceExtension 
)

Definition at line 747 of file mmixer.c.

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 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
MIXER_STATUS MMixerMidiOutCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPMIDIOUTCAPSW Caps)
Definition: midi.c:308
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Status
Definition: gdiplustypes.h:24
MIXER_STATUS
Definition: mmixer.h:3
MIXER_STATUS MMixerMidiInCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPMIDIINCAPSW Caps)
Definition: midi.c:344
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudCapabilities().

◆ WdmAudMixerCapabilities()

NTSTATUS WdmAudMixerCapabilities ( IN PDEVICE_OBJECT  DeviceObject,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo,
IN PWDMAUD_DEVICE_EXTENSION  DeviceExtension 
)

Definition at line 398 of file mmixer.c.

403 {
404  if (MMixerGetCapabilities(&MixerContext, DeviceInfo->DeviceIndex, &DeviceInfo->u.MixCaps) == MM_STATUS_SUCCESS)
405  return STATUS_SUCCESS;
406 
408 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
MIXER_STATUS MMixerGetCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerIndex, OUT LPMIXERCAPSW MixerCaps)
Definition: mixer.c:38
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudCapabilities().

◆ WdmAudMixerInitialize()

NTSTATUS WdmAudMixerInitialize ( IN PDEVICE_OBJECT  DeviceObject)

Definition at line 380 of file mmixer.c.

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 }
MIXER_STATUS MMixerInitialize(IN PMIXER_CONTEXT MixerContext, IN PMIXER_ENUM EnumFunction, IN PVOID EnumContext)
Definition: mixer.c:770
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
void DPRINT(...)
Definition: polytest.cpp:61
MIXER_STATUS Enum(IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR *DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey)
Definition: mmixer.c:225
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
MIXER_STATUS
Definition: mmixer.h:3

Referenced by WdmAudInitWorkerRoutine().

◆ WdmAudSetControlDetails()

NTSTATUS NTAPI WdmAudSetControlDetails ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo 
)

Definition at line 598 of file mmixer.c.

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 }
_In_ PIRP Irp
Definition: csq.h:116
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
Status
Definition: gdiplustypes.h:24
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
MIXER_STATUS
Definition: mmixer.h:3
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ WdmAudWaveCapabilities()

NTSTATUS WdmAudWaveCapabilities ( IN PDEVICE_OBJECT  DeviceObject,
IN PWDMAUD_DEVICE_INFO  DeviceInfo,
IN PWDMAUD_CLIENT  ClientInfo,
IN PWDMAUD_DEVICE_EXTENSION  DeviceExtension 
)

Definition at line 721 of file mmixer.c.

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 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
MIXER_STATUS MMixerWaveInCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEINCAPSW Caps)
Definition: wave.c:491
MIXER_STATUS MMixerWaveOutCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEOUTCAPSW Caps)
Definition: wave.c:527
Status
Definition: gdiplustypes.h:24
MIXER_STATUS
Definition: mmixer.h:3
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by WdmAudCapabilities().

Variable Documentation

◆ CategoryGuid

GUID CategoryGuid = {STATIC_KSCATEGORY_AUDIO}

Definition at line 46 of file mmixer.c.

◆ MixerContext

MIXER_CONTEXT MixerContext
Initial value:
=
{
sizeof(MIXER_CONTEXT),
}
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
MIXER_STATUS QueryKeyValue(IN HANDLE hKey, IN LPWSTR KeyName, OUT PVOID *ResultBuffer, OUT PULONG ResultLength, OUT PULONG KeyType)
Definition: mmixer.c:66
PVOID AllocEventData(IN ULONG ExtraSize)
Definition: mmixer.c:312
MIXER_STATUS Close(HANDLE hDevice)
Definition: mmixer.c:116
PVOID Alloc(ULONG NumBytes)
Definition: mmixer.c:110
VOID FreeEventData(IN PVOID EventData)
Definition: mmixer.c:331
smooth NULL
Definition: ftsmooth.c:416
MIXER_STATUS Open(IN LPWSTR DevicePath, OUT PHANDLE hDevice)
Definition: mmixer.c:137
VOID Free(PVOID Block)
Definition: mmixer.c:125
MIXER_STATUS CloseKey(IN HANDLE hKey)
Definition: mmixer.c:102
MIXER_STATUS OpenKey(IN HANDLE hKey, IN LPWSTR SubKey, IN ULONG DesiredAccess, OUT PHANDLE OutKey)
Definition: mmixer.c:89
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:131

Definition at line 29 of file mmixer.c.