ReactOS 0.4.16-dev-197-g92996da
wdmaud.h File Reference
#include <portcls.h>
#include <mmsystem.h>
#include "interface.h"
Include dependency graph for wdmaud.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  WDMAUD_COMPLETION_CONTEXT
 
struct  WDMAUD_HANDLE
 
struct  WDMAUD_CLIENT
 
struct  EVENT_ENTRY
 
struct  SYSAUDIO_ENTRY
 
struct  WDMAUD_DEVICE_EXTENSION
 
struct  PIN_CREATE_CONTEXT
 

Typedefs

typedef struct WDMAUD_COMPLETION_CONTEXTPWDMAUD_COMPLETION_CONTEXT
 
typedef struct WDMAUD_HANDLEPWDMAUD_HANDLE
 
typedef struct WDMAUD_CLIENTPWDMAUD_CLIENT
 
typedef struct EVENT_ENTRYPEVENT_ENTRY
 
typedef struct SYSAUDIO_ENTRYPSYSAUDIO_ENTRY
 
typedef struct WDMAUD_DEVICE_EXTENSIONPWDMAUD_DEVICE_EXTENSION
 
typedef struct PIN_CREATE_CONTEXTPPIN_CREATE_CONTEXT
 

Functions

NTSTATUS NTAPI OpenWavePin (IN PWDMAUD_DEVICE_EXTENSION DeviceExtension, IN ULONG FilterId, IN ULONG PinId, IN LPWAVEFORMATEX WaveFormatEx, IN ACCESS_MASK DesiredAccess, OUT PHANDLE PinHandle)
 
NTSTATUS WdmAudRegisterDeviceInterface (IN PDEVICE_OBJECT PhysicalDeviceObject, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS WdmAudOpenSysAudioDevices (IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS WdmAudOpenSysaudio (IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_CLIENT *pClient)
 
NTSTATUS NTAPI WdmAudDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI WdmAudReadWrite (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI WdmAudWrite (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
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 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)
 
ULONG GetNumOfMixerDevices (IN PDEVICE_OBJECT DeviceObject)
 
NTSTATUS SetIrpIoStatus (IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
 
NTSTATUS WdmAudOpenSysAudioDevice (IN LPWSTR DeviceName, OUT PHANDLE Handle)
 
NTSTATUS FindProductName (IN LPWSTR PnpName, IN ULONG ProductNameSize, OUT LPWSTR ProductName)
 
NTSTATUS WdmAudMixerCapabilities (IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
 
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)
 
NTSTATUS NTAPI WdmAudGetPosition (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PWDMAUD_DEVICE_INFO DeviceInfo)
 
NTSTATUS NTAPI WdmAudFrameSize (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)
 
NTSTATUS NTAPI WdmAudGetControlDetails (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS WdmAudMixerInitialize (IN PDEVICE_OBJECT DeviceObject)
 
NTSTATUS NTAPI WdmAudWaveInitialize (IN PDEVICE_OBJECT DeviceObject)
 
ULONG ClosePin (IN PWDMAUD_CLIENT ClientInfo, IN ULONG FilterId, IN ULONG PinId, IN SOUND_DEVICE_TYPE DeviceType)
 
NTSTATUS InsertPinHandle (IN PWDMAUD_CLIENT ClientInfo, IN ULONG FilterId, IN ULONG PinId, IN SOUND_DEVICE_TYPE DeviceType, IN HANDLE PinHandle, IN ULONG FreeIndex)
 
NTSTATUS GetSysAudioDevicePnpName (IN PDEVICE_OBJECT DeviceObject, IN ULONG DeviceIndex, OUT LPWSTR *Device)
 
NTSTATUS OpenSysAudioDeviceByIndex (IN PDEVICE_OBJECT DeviceObject, IN ULONG DeviceIndex, IN PHANDLE DeviceHandle, IN PFILE_OBJECT *FileObject)
 
NTSTATUS OpenDevice (IN LPWSTR Device, OUT PHANDLE DeviceHandle, OUT PFILE_OBJECT *FileObject)
 
ULONG WdmAudGetMixerDeviceCount (VOID)
 
ULONG WdmAudGetWaveInDeviceCount (VOID)
 
ULONG WdmAudGetWaveOutDeviceCount (VOID)
 
ULONG WdmAudGetMidiInDeviceCount (VOID)
 
ULONG WdmAudGetMidiOutDeviceCount (VOID)
 
NTSTATUS WdmAudGetPnpNameByIndexAndType (IN ULONG DeviceIndex, IN SOUND_DEVICE_TYPE DeviceType, OUT LPWSTR *Device)
 
ULONG GetSysAudioDeviceCount (IN PDEVICE_OBJECT DeviceObject)
 
PVOID AllocateItem (IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
 
VOID FreeItem (IN PVOID Item)
 

Typedef Documentation

◆ PEVENT_ENTRY

◆ PPIN_CREATE_CONTEXT

◆ PSYSAUDIO_ENTRY

◆ PWDMAUD_CLIENT

◆ PWDMAUD_COMPLETION_CONTEXT

◆ PWDMAUD_DEVICE_EXTENSION

◆ PWDMAUD_HANDLE

Function Documentation

◆ AllocateItem()

PVOID AllocateItem ( IN POOL_TYPE  PoolType,
IN SIZE_T  NumberOfBytes 
)

Definition at line 29 of file misc.c.

32{
34}
#define TAG_KS
Definition: misc.c:14
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036

◆ ClosePin()

ULONG ClosePin ( IN PWDMAUD_CLIENT  ClientInfo,
IN ULONG  FilterId,
IN ULONG  PinId,
IN SOUND_DEVICE_TYPE  DeviceType 
)

Definition at line 72 of file sup.c.

77{
79
80 for(Index = 0; Index < ClientInfo->NumPins; Index++)
81 {
82 if (ClientInfo->hPins[Index].FilterId == FilterId && ClientInfo->hPins[Index].PinId == PinId && ClientInfo->hPins[Index].Handle && ClientInfo->hPins[Index].Type == DeviceType)
83 {
84 if (ClientInfo->hPins[Index].Type != MIXER_DEVICE_TYPE)
85 {
86 ZwClose(ClientInfo->hPins[Index].Handle);
87 }
88 ClientInfo->hPins[Index].Handle = NULL;
89 return Index;
90 }
91 }
92 return MAXULONG;
93}
#define NULL
Definition: types.h:112
CLIENT_DATA ClientInfo
DeviceType
Definition: mmdrv.h:42
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ MIXER_DEVICE_TYPE
Definition: sndtypes.h:33
#define MAXULONG
Definition: typedefs.h:251
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by CreatePinCallback().

◆ FindProductName()

NTSTATUS FindProductName ( IN LPWSTR  PnpName,
IN ULONG  ProductNameSize,
OUT LPWSTR  ProductName 
)

Definition at line 243 of file sup.c.

247{
248 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\{4D36E96C-E325-11CE-BFC1-08002BE10318}");
249
251 WCHAR SubKey[20];
253 HANDLE hKey, hSubKey;
256 PKEY_FULL_INFORMATION KeyInformation;
257
258 for(Index = 0; Index < wcslen(PnpName); Index++)
259 {
260 if (PnpName[Index] == '#')
261 PnpName[Index] = L'\\';
262 }
263
264
265 /* initialize key attributes */
267
268 /* open the key */
269 Status = ZwOpenKey(&hKey, GENERIC_READ, &ObjectAttributes);
270
271 /* check for success */
272 if (!NT_SUCCESS(Status))
273 return Status;
274
275 /* query num of subkeys */
276 Status = ZwQueryKey(hKey, KeyFullInformation, NULL, 0, &Length);
277
279 {
280 DPRINT1("ZwQueryKey failed with %x\n", Status);
281 /* failed */
282 ZwClose(hKey);
283 return Status;
284 }
285
286 /* allocate key information struct */
287 KeyInformation = AllocateItem(NonPagedPool, Length);
288 if (!KeyInformation)
289 {
290 /* no memory */
291 ZwClose(hKey);
293 }
294
295 /* query num of subkeys */
296 Status = ZwQueryKey(hKey, KeyFullInformation, (PVOID)KeyInformation, Length, &Length);
297
298 if (!NT_SUCCESS(Status))
299 {
300 DPRINT1("ZwQueryKey failed with %x\n", Status);
301 FreeItem(KeyInformation);
302 ZwClose(hKey);
303 return Status;
304 }
305
306 /* now iterate through all subkeys */
307 for(Index = 0; Index < KeyInformation->SubKeys; Index++)
308 {
309 /* subkeys are always in the format 0000-XXXX */
310 swprintf(SubKey, L"%04u", Index);
311
312 /* initialize subkey name */
314
315 /* initialize key attributes */
317
318 /* open the sub key */
319 Status = ZwOpenKey(&hSubKey, GENERIC_READ, &ObjectAttributes);
320
321 /* check for success */
322 if (NT_SUCCESS(Status))
323 {
324 /* compare product name */
325 Status = CompareProductName(hSubKey, PnpName, ProductNameSize, ProductName);
326
327 /* close subkey */
328 ZwClose(hSubKey);
329
330 if (NT_SUCCESS(Status))
331 break;
332 }
333 }
334
335 /* free buffer */
336 FreeItem(KeyInformation);
337
338 /* close key */
339 ZwClose(hKey);
340
341 /* no matching key found */
342 return Status;
343}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define GENERIC_READ
Definition: compat.h:135
#define swprintf
Definition: precomp.h:40
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: sup.c:20
NTSTATUS CompareProductName(IN HANDLE hSubKey, IN LPWSTR PnpName, IN ULONG ProductNameSize, OUT LPWSTR ProductName)
Definition: sup.c:182
VOID FreeItem(IN PVOID Item)
Definition: sup.c:28
#define NonPagedPool
Definition: env_spec_w32.h:307
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_OPENIF
Definition: winternl.h:229
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4725
@ KeyFullInformation
Definition: nt_native.h:1133
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
static PNP_ID_NAME PnpName[]
Definition: pnpdump.c:52
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ FreeItem()

VOID FreeItem ( IN PVOID  Item)

Definition at line 37 of file misc.c.

39{
41}
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_In_ WDFCOLLECTION _In_ WDFOBJECT Item

◆ GetNumOfMixerDevices()

ULONG GetNumOfMixerDevices ( IN PDEVICE_OBJECT  DeviceObject)

◆ GetSysAudioDeviceCount()

ULONG GetSysAudioDeviceCount ( IN PDEVICE_OBJECT  DeviceObject)

Definition at line 35 of file sup.c.

37{
38 PWDMAUD_DEVICE_EXTENSION DeviceExtension;
42
43 /* setup the query request */
47
48 DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
49
50 /* query sysaudio for the device count */
52 if (!NT_SUCCESS(Status))
53 return 0;
54
55 return Count;
56}
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 WDMAUD_DEVICE_EXTENSION * PWDMAUD_DEVICE_EXTENSION
struct KSIDENTIFIER KSPROPERTY
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:428
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
@ KSPROPERTY_SYSAUDIO_DEVICE_COUNT
Definition: ksmedia.h:1168
#define KSPROPSETID_Sysaudio
Definition: ksmedia.h:1165
#define KernelMode
Definition: asm.h:34
int Count
Definition: noreturn.cpp:7
PFILE_OBJECT FileObject
Definition: wdmaud.h:62
ULONG Flags
Definition: ntfs.h:536
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052

Referenced by Enum(), GetSysAudioDevicePnpName(), WdmAudCloseAllMixers(), and WdmAudInitWorkerRoutine().

◆ GetSysAudioDevicePnpName()

NTSTATUS GetSysAudioDevicePnpName ( IN PDEVICE_OBJECT  DeviceObject,
IN ULONG  DeviceIndex,
OUT LPWSTR Device 
)

Definition at line 346 of file sup.c.

350{
352 KSP_PIN Pin;
354 PWDMAUD_DEVICE_EXTENSION DeviceExtension;
355
356 /* first check if the device index is within bounds */
357 if (DeviceIndex >= GetSysAudioDeviceCount(DeviceObject))
359
360 /* setup the query request */
361 Pin.Property.Set = KSPROPSETID_Sysaudio;
363 Pin.Property.Flags = KSPROPERTY_TYPE_GET;
364 Pin.PinId = DeviceIndex;
365
366 DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
367
368 /* query sysaudio for the device path */
370
371 /* check if the request failed */
373 return STATUS_UNSUCCESSFUL;
374
375 /* allocate buffer for the device */
377 if (!Device)
379
380 /* query sysaudio again for the device path */
382
383 if (!NT_SUCCESS(Status))
384 {
385 /* failed */
387 return Status;
388 }
389
390 return Status;
391}
ULONG GetSysAudioDeviceCount(IN PDEVICE_OBJECT DeviceObject)
Definition: sup.c:35
@ KSPROPERTY_SYSAUDIO_DEVICE_INTERFACE_NAME
Definition: ksmedia.h:1171
Definition: ks.h:642
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

Referenced by Enum().

◆ InsertPinHandle()

NTSTATUS InsertPinHandle ( IN PWDMAUD_CLIENT  ClientInfo,
IN ULONG  FilterId,
IN ULONG  PinId,
IN SOUND_DEVICE_TYPE  DeviceType,
IN HANDLE  PinHandle,
IN ULONG  FreeIndex 
)

Definition at line 96 of file sup.c.

103{
104 PWDMAUD_HANDLE Handles;
105
106 if (FreeIndex != MAXULONG)
107 {
108 /* re-use a free index */
109 ClientInfo->hPins[FreeIndex].Handle = PinHandle;
110 ClientInfo->hPins[FreeIndex].FilterId = FilterId;
111 ClientInfo->hPins[FreeIndex].PinId = PinId;
112 ClientInfo->hPins[FreeIndex].Type = DeviceType;
113
114 return STATUS_SUCCESS;
115 }
116
117 Handles = AllocateItem(NonPagedPool, sizeof(WDMAUD_HANDLE) * (ClientInfo->NumPins+1));
118
119 if (!Handles)
121
122 if (ClientInfo->NumPins)
123 {
124 RtlMoveMemory(Handles, ClientInfo->hPins, sizeof(WDMAUD_HANDLE) * ClientInfo->NumPins);
125 FreeItem(ClientInfo->hPins);
126 }
127
128 ClientInfo->hPins = Handles;
129 ClientInfo->hPins[ClientInfo->NumPins].Handle = PinHandle;
130 ClientInfo->hPins[ClientInfo->NumPins].Type = DeviceType;
131 ClientInfo->hPins[ClientInfo->NumPins].FilterId = FilterId;
132 ClientInfo->hPins[ClientInfo->NumPins].PinId = PinId;
133 ClientInfo->NumPins++;
134
135 return STATUS_SUCCESS;
136}
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264

Referenced by CreatePinCallback().

◆ OpenDevice()

NTSTATUS OpenDevice ( IN LPWSTR  Device,
OUT PHANDLE  DeviceHandle,
OUT PFILE_OBJECT FileObject 
)

Definition at line 394 of file sup.c.

398{
400 HANDLE hDevice;
401
402 /* now open the device */
404
405 if (!NT_SUCCESS(Status))
406 {
407 return Status;
408 }
409
410 *DeviceHandle = hDevice;
411
412 if (FileObject)
413 {
415
416 if (!NT_SUCCESS(Status))
417 {
418 ZwClose(hDevice);
419 }
420 }
421
422 return Status;
423}
NTSTATUS WdmAudOpenSysAudioDevice(IN LPWSTR DeviceName, OUT PHANDLE Handle)
Definition: deviface.c:16
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
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:494
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550

◆ OpenSysAudioDeviceByIndex()

NTSTATUS OpenSysAudioDeviceByIndex ( IN PDEVICE_OBJECT  DeviceObject,
IN ULONG  DeviceIndex,
IN PHANDLE  DeviceHandle,
IN PFILE_OBJECT FileObject 
)

◆ OpenWavePin()

NTSTATUS NTAPI OpenWavePin ( IN PWDMAUD_DEVICE_EXTENSION  DeviceExtension,
IN ULONG  FilterId,
IN ULONG  PinId,
IN LPWAVEFORMATEX  WaveFormatEx,
IN ACCESS_MASK  DesiredAccess,
OUT PHANDLE  PinHandle 
)

◆ SetIrpIoStatus()

◆ 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}
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
VOID CALLBACK EventCallback(IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
Definition: mmixer.c:333
@ MM_STATUS_SUCCESS
Definition: mmixer.h:5
ULONG DeviceCount
Definition: mpu401.c:26
MIXER_STATUS MMixerClose(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerId, IN PVOID MixerEventContext, IN PMIXER_EVENT MixerEventRoutine)
Definition: mixer.c:115
#define ObDereferenceObject
Definition: obfuncs.h:203

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}
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:59

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 869 of file mmixer.c.

874{
877
878 Context.ClientInfo = ClientInfo;
879 Context.DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
880 Context.DeviceType = DeviceInfo->DeviceType;
881
883
886 else
888}
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
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:796
MIXER_STATUS
Definition: mmixer.h:4
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
@ MIDI_IN_DEVICE_TYPE
Definition: sndtypes.h:30

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{
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);
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}
NTSYSAPI void WINAPI DbgBreakPoint(void)
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
HMIXER hMixer
Definition: test.c:10
#define UserMode
Definition: asm.h:35
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
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 DPRINT
Definition: sndvol32.h:73
#define EVENT_MODIFY_STATE
Definition: winbase.h:163

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 847 of file mmixer.c.

852{
855
856 Context.ClientInfo = ClientInfo;
857 Context.DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
858 Context.DeviceType = DeviceInfo->DeviceType;
859
860 Status = MMixerOpenWave(&MixerContext, DeviceInfo->DeviceIndex, DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE, &DeviceInfo->u.WaveFormatEx, CreatePinCallback, &Context, &DeviceInfo->hDevice);
861
864 else
866}
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:453
@ WAVE_IN_DEVICE_TYPE
Definition: sndtypes.h:28

Referenced by WdmAudControlOpen().

◆ WdmAudDeviceControl()

NTSTATUS NTAPI WdmAudDeviceControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 302 of file control.c.

305{
306 PIO_STACK_LOCATION IoStack;
309
311
312 DPRINT("WdmAudDeviceControl entered\n");
313
314 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(WDMAUD_DEVICE_INFO))
315 {
316 /* invalid parameter */
317 DPRINT1("Input buffer too small size %u expected %u\n", IoStack->Parameters.DeviceIoControl.InputBufferLength, sizeof(WDMAUD_DEVICE_INFO));
319 }
320
321 DeviceInfo = (PWDMAUD_DEVICE_INFO)Irp->AssociatedIrp.SystemBuffer;
322
324 {
325 /* invalid parameter */
326 DPRINT1("Error: device type not set\n");
328 }
329
330 if (!IoStack->FileObject || !IoStack->FileObject->FsContext)
331 {
332 /* file object parameter */
333 DPRINT1("Error: file object is not attached\n");
335 }
336 ClientInfo = (PWDMAUD_CLIENT)IoStack->FileObject->FsContext;
337
338 DPRINT("WdmAudDeviceControl entered\n");
339
340 switch(IoStack->Parameters.DeviceIoControl.IoControlCode)
341 {
368 case IOCTL_GETPOS:
370 case IOCTL_GETDEVID:
371 case IOCTL_GETVOLUME:
372 case IOCTL_SETVOLUME:
373
374 DPRINT1("Unhandled %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
375 break;
376 }
377
379}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
MMRESULT WdmAudGetLineControls(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINECONTROLSW MixControls, IN ULONG Flags)
Definition: mmixer.c:413
MMRESULT WdmAudGetControlDetails(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
Definition: mmixer.c:440
MMRESULT WdmAudGetLineInfo(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINEW MixLine, IN ULONG Flags)
Definition: mmixer.c:400
MMRESULT WdmAudSetControlDetails(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
Definition: mmixer.c:426
NTSTATUS NTAPI WdmAudFrameSize(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: control.c:180
NTSTATUS NTAPI WdmAudGetDeviceInterface(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo)
Definition: control.c:222
NTSTATUS NTAPI WdmAudIoctlClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: control.c:149
NTSTATUS WdmAudControlDeviceState(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: control.c:82
NTSTATUS WdmAudControlDeviceType(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: control.c:44
NTSTATUS NTAPI WdmAudResetStream(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo)
Definition: control.c:270
NTSTATUS WdmAudCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: control.c:118
NTSTATUS WdmAudControlOpen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: control.c:18
NTSTATUS NTAPI WdmAudGetPosition(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PWDMAUD_DEVICE_INFO DeviceInfo)
Definition: mmixer.c:774
NTSTATUS NTAPI WdmAudGetMixerEvent(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:620
struct WDMAUD_CLIENT * PWDMAUD_CLIENT
if(dx< 0)
Definition: linetemp.h:194
@ MIN_SOUND_DEVICE_TYPE
Definition: sndtypes.h:36
@ MAX_SOUND_DEVICE_TYPE
Definition: sndtypes.h:37
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _IO_STACK_LOCATION::@1575::@1576 DeviceIoControl
union _IO_STACK_LOCATION::@1575 Parameters
#define IOCTL_GETFRAMESIZE
Definition: interface.h:255
#define IOCTL_CLOSE_WDMAUD
Definition: interface.h:99
#define IOCTL_GETVOLUME
Definition: interface.h:170
#define IOCTL_GETPOS
Definition: interface.h:238
#define IOCTL_GETCONTROLDETAILS
Definition: interface.h:325
#define IOCTL_OPEN_WDMAUD
Definition: interface.h:82
#define IOCTL_RESET_STREAM
Definition: interface.h:374
#define IOCTL_GETDEVID
Definition: interface.h:152
#define IOCTL_GETCAPABILITIES
Definition: interface.h:204
#define IOCTL_SETCONTROLDETAILS
Definition: interface.h:307
#define IOCTL_GETLINEINFO
Definition: interface.h:272
#define IOCTL_SETDEVICE_STATE
Definition: interface.h:134
#define IOCTL_QUERYDEVICEINTERFACESTRING
Definition: interface.h:343
#define IOCTL_SETVOLUME
Definition: interface.h:187
#define IOCTL_GETNUMDEVS_TYPE
Definition: interface.h:117
#define IOCTL_GETLINECONTROLS
Definition: interface.h:290
#define IOCTL_GET_MIXER_EVENT
Definition: interface.h:359
struct WDMAUD_DEVICE_INFO * PWDMAUD_DEVICE_INFO

Referenced by DriverEntry().

◆ WdmAudFrameSize()

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

Definition at line 180 of file control.c.

185{
189 KSALLOCATOR_FRAMING Framing;
191
192 /* Get sysaudio pin file object */
194 if (!NT_SUCCESS(Status))
195 {
196 DPRINT1("Invalid buffer handle %p\n", DeviceInfo->hDevice);
197 return SetIrpIoStatus(Irp, Status, 0);
198 }
199
200 /* Setup get framing request */
204
206 /* Did we succeed */
207 if (NT_SUCCESS(Status))
208 {
209 /* Store framesize */
210 DeviceInfo->u.FrameSize = Framing.FrameSize;
211 }
212
213 /* Release file object */
215
217
218}
@ KSPROPERTY_CONNECTION_ALLOCATORFRAMING
Definition: ks.h:352
#define KSPROPSETID_Connection
Definition: ks.h:346
#define GENERIC_WRITE
Definition: nt_native.h:90
* PFILE_OBJECT
Definition: iotypes.h:1998

Referenced by WdmAudDeviceControl().

◆ 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
546 else
548}
MIXER_STATUS MMixerGetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERCONTROLDETAILS MixerControlDetails)
Definition: mixer.c:565

◆ 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
590 else
592
593
594}
MIXER_STATUS MMixerGetLineControls(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINECONTROLSW MixerLineControls)
Definition: mixer.c:331

◆ 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
568 else
570}
MIXER_STATUS MMixerGetLineInfo(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINEW MixerLine)
Definition: mixer.c:148

◆ WdmAudGetMidiInDeviceCount()

ULONG WdmAudGetMidiInDeviceCount ( VOID  )

◆ WdmAudGetMidiOutDeviceCount()

ULONG WdmAudGetMidiOutDeviceCount ( VOID  )

◆ WdmAudGetMixerDeviceCount()

ULONG WdmAudGetMixerDeviceCount ( VOID  )

◆ 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 EVENT_ENTRY * PEVENT_ENTRY
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
Definition: wdmaud.h:38
ULONG Value
Definition: wdmaud.h:41
HANDLE hMixer
Definition: wdmaud.h:42
LIST_ENTRY Entry
Definition: wdmaud.h:39
ULONG NotificationType
Definition: wdmaud.h:40
base of all file and directory entries
Definition: entries.h:83
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by WdmAudDeviceControl().

◆ WdmAudGetPnpNameByIndexAndType()

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

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}
#define UNIMPLEMENTED
Definition: debug.h:118
MIXER_STATUS MMixerGetWaveDevicePath(IN PMIXER_CONTEXT MixerContext, IN ULONG bWaveIn, IN ULONG DeviceId, OUT LPWSTR *DevicePath)
Definition: wave.c:704
MIXER_STATUS MMixerGetMidiDevicePath(IN PMIXER_CONTEXT MixerContext, IN ULONG bMidiIn, IN ULONG DeviceId, OUT LPWSTR *DevicePath)
Definition: midi.c:380
@ MIDI_OUT_DEVICE_TYPE
Definition: sndtypes.h:31
@ WAVE_OUT_DEVICE_TYPE
Definition: sndtypes.h:29

Referenced by WdmAudGetDeviceInterface().

◆ WdmAudGetPosition()

NTSTATUS NTAPI WdmAudGetPosition ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_ PWDMAUD_DEVICE_INFO  DeviceInfo 
)

Definition at line 774 of file mmixer.c.

778{
781
782 /* Get position */
784
786 {
787 DeviceInfo->u.Position = (ULONGLONG)Position;
789 }
790 else
792}
MIXER_STATUS MMixerGetWavePosition(_In_ PMIXER_CONTEXT MixerContext, _In_ HANDLE PinHandle, _Out_ PDWORD Position)
Definition: wave.c:618
static COORD Position
Definition: mouse.c:34
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by WdmAudDeviceControl().

◆ WdmAudGetWaveInDeviceCount()

ULONG WdmAudGetWaveInDeviceCount ( VOID  )

◆ WdmAudGetWaveOutDeviceCount()

ULONG WdmAudGetWaveOutDeviceCount ( VOID  )

◆ 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
767 return STATUS_SUCCESS;
768 else
769 return STATUS_UNSUCCESSFUL;
770}
@ MM_STATUS_UNSUCCESSFUL
Definition: mmixer.h:11
MIXER_STATUS MMixerMidiInCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPMIDIINCAPSW Caps)
Definition: midi.c:344
MIXER_STATUS MMixerMidiOutCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPMIDIOUTCAPSW Caps)
Definition: midi.c:308

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{
405 return STATUS_SUCCESS;
406
408}
MIXER_STATUS MMixerGetCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerIndex, OUT LPMIXERCAPSW MixerCaps)
Definition: mixer.c:38

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
389 {
390 /* failed to initialize mmixer library */
391 DPRINT("MMixerInitialize failed with %lx\n", Status);
392 }
393
394 return Status;
395}
MIXER_STATUS Enum(IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR *DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey)
Definition: mmixer.c:220
MIXER_STATUS MMixerInitialize(IN PMIXER_CONTEXT MixerContext, IN PMIXER_ENUM EnumFunction, IN PVOID EnumContext)
Definition: mixer.c:768

Referenced by WdmAudInitWorkerRoutine().

◆ WdmAudOpenSysaudio()

NTSTATUS WdmAudOpenSysaudio ( IN PDEVICE_OBJECT  DeviceObject,
IN PWDMAUD_CLIENT pClient 
)

Definition at line 206 of file deviface.c.

209{
211 PWDMAUD_DEVICE_EXTENSION DeviceExtension;
212
213 /* get device extension */
214 DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
215
216 if (!DeviceExtension->NumSysAudioDevices)
217 {
218 /* wdmaud failed to open sysaudio */
219 return STATUS_UNSUCCESSFUL;
220 }
221
222 /* sanity check */
223 ASSERT(!IsListEmpty(&DeviceExtension->SysAudioDeviceList));
224
225 /* allocate client context struct */
227
228 /* check for allocation failure */
229 if (!Client)
230 {
231 /* not enough memory */
233 }
234
235 /* zero client context struct */
237
238 /* initialize mixer event list */
239 InitializeListHead(&Client->MixerEventList);
240
241 /* store result */
242 *pClient = Client;
243
244 /* insert client into list */
245 ExInterlockedInsertTailList(&DeviceExtension->WdmAudClientList, &Client->Entry, &DeviceExtension->Lock);
246
247 /* done */
248 return STATUS_SUCCESS;
249}
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
#define ASSERT(a)
Definition: mode.c:44
Definition: client.c:28
LIST_ENTRY SysAudioDeviceList
Definition: wdmaud.h:60
LIST_ENTRY WdmAudClientList
Definition: wdmaud.h:63
KSPIN_LOCK Lock
Definition: wdmaud.h:58
ULONG NumSysAudioDevices
Definition: wdmaud.h:59
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by WdmAudCreate().

◆ WdmAudOpenSysAudioDevice()

NTSTATUS WdmAudOpenSysAudioDevice ( IN LPWSTR  DeviceName,
OUT PHANDLE  Handle 
)

Definition at line 16 of file deviface.c.

19{
24
27
32 NULL,
33 0,
34 0,
37 NULL,
38 0,
40 NULL,
42
43 return Status;
44}
static const WCHAR SymbolicLink[]
Definition: interface.c:31
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
ULONG Handle
Definition: gdb_input.c:15
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSTATUS NTAPI IoCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength, IN CREATE_FILE_TYPE CreateFileType, IN PVOID ExtraCreateParameters OPTIONAL, IN ULONG Options)
Definition: file.c:3010
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
#define IO_FORCE_ACCESS_CHECK
Definition: iotypes.h:540
#define IO_NO_PARAMETER_CHECKING
Definition: iotypes.h:541
@ CreateFileTypeNone
Definition: iotypes.h:535

Referenced by Open(), OpenDevice(), and WdmAudOpenSysAudioDevices().

◆ WdmAudOpenSysAudioDevices()

NTSTATUS WdmAudOpenSysAudioDevices ( IN PDEVICE_OBJECT  DeviceObject,
IN PWDMAUD_DEVICE_EXTENSION  DeviceExtension 
)

Definition at line 93 of file deviface.c.

96{
101 HANDLE hSysAudio;
103 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\sysaudio\\GLOBAL");
104
105 if (DeviceExtension->DeviceInterfaceSupport)
106 {
108 NULL,
109 0,
111
112 if (NT_SUCCESS(Status))
113 {
116 }
117
118
122 DeviceObject->DriverObject,
124 (PVOID)DeviceExtension,
125 &DeviceExtension->SysAudioNotification);
126 }
127 else
128 {
130 if (!Entry)
131 {
133 }
134
135
136 Length = wcslen(DeviceName.Buffer) + 1;
137 Entry->SymbolicLink.Length = 0;
138 Entry->SymbolicLink.MaximumLength = Length * sizeof(WCHAR);
139 Entry->SymbolicLink.Buffer = AllocateItem(NonPagedPool, Entry->SymbolicLink.MaximumLength);
140
141 if (!Entry->SymbolicLink.Buffer)
142 {
145 }
146
148
149 if (!NT_SUCCESS(Status))
150 {
151 FreeItem(Entry->SymbolicLink.Buffer);
153 return Status;
154 }
155
156 DPRINT("Opening device %S\n", Entry->SymbolicLink.Buffer);
157 Status = WdmAudOpenSysAudioDevice(Entry->SymbolicLink.Buffer, &hSysAudio);
158 if (!NT_SUCCESS(Status))
159 {
160 DPRINT1("Failed to open sysaudio %x\n", Status);
161 FreeItem(Entry->SymbolicLink.Buffer);
163 return Status;
164 }
165
166 InsertTailList(&DeviceExtension->SysAudioDeviceList, &Entry->Entry);
167 DeviceExtension->NumSysAudioDevices++;
168
169 /* get the file object */
171 if (!NT_SUCCESS(Status))
172 {
173 DPRINT1("Failed to reference FileObject %x\n", Status);
174 ZwClose(hSysAudio);
175 return Status;
176 }
177 DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
178 DeviceExtension->hSysAudio = hSysAudio;
179 DeviceExtension->FileObject = FileObject;
180 }
181
182 return Status;
183}
NTSTATUS WdmAudOpenSysAudioDeviceInterfaces(IN PWDMAUD_DEVICE_EXTENSION DeviceExtension, IN LPWSTR SymbolicLinkList)
Definition: deviface.c:60
NTSTATUS NTAPI DeviceInterfaceChangeCallback(IN PVOID NotificationStructure, IN PVOID Context)
Definition: deviface.c:48
#define InsertTailList(ListHead, Entry)
#define KSCATEGORY_SYSAUDIO
Definition: ksmedia.h:217
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSTATUS NTAPI IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList)
Definition: deviface.c:454
NTSTATUS NTAPI IoRegisterPlugPlayNotification(_In_ IO_NOTIFICATION_EVENT_CATEGORY EventCategory, _In_ ULONG EventCategoryFlags, _In_opt_ PVOID EventCategoryData, _In_ PDRIVER_OBJECT DriverObject, _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, _Inout_opt_ PVOID Context, _Out_ PVOID *NotificationEntry)
Definition: pnpnotify.c:346
Entry(ENTRY_TYPE etype)
Definition: entries.cpp:35
Definition: wdmaud.h:46
_In_opt_ PDEVICE_OBJECT _In_ ULONG _Outptr_result_nullonfailure_ _At_ * SymbolicLinkList(return==0, __drv_allocatesMem(Mem))) PZZWSTR *SymbolicLinkList
@ EventCategoryDeviceInterfaceChange
Definition: iotypes.h:1226
#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES
Definition: iotypes.h:1239
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by WdmAudInitWorkerRoutine().

◆ WdmAudReadWrite()

NTSTATUS NTAPI WdmAudReadWrite ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 437 of file control.c.

440{
444 PIO_STACK_LOCATION IoStack;
446 PMDL Mdl;
447 BOOLEAN Read = TRUE;
449
450 /* allocate completion context */
452
453 if (!Context)
454 {
455 /* not enough memory */
456 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
458
459 /* done */
461 }
462
463 /* get current irp stack location */
465
466 /* store the input buffer in UserBuffer - as KsProbeStreamIrp operates on IRP_MJ_DEVICE_CONTROL */
467 Irp->UserBuffer = MmGetMdlVirtualAddress(Irp->MdlAddress);
468
469 /* sanity check */
470 ASSERT(Irp->UserBuffer);
471
472 /* get the length of the request length */
473 Length = IoStack->Parameters.Write.Length;
474
475 /* store outputbuffer length */
476 IoStack->Parameters.DeviceIoControl.OutputBufferLength = Length;
477
478 /* setup context */
479 Context->Length = Length;
481 Context->Mdl = Irp->MdlAddress;
482
483 /* store mdl address */
484 Mdl = Irp->MdlAddress;
485
486 /* remove mdladdress as KsProbeStreamIrp will interpret it as an already probed audio buffer */
487 Irp->MdlAddress = NULL;
488
489 if (IoStack->MajorFunction == IRP_MJ_WRITE)
490 {
491 /* probe the write stream irp */
492 Read = FALSE;
493 Status = KsProbeStreamIrp(Irp, KSPROBE_STREAMWRITE | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK, Length);
494 }
495 else
496 {
497 /* probe the read stream irp */
498 Status = KsProbeStreamIrp(Irp, KSPROBE_STREAMREAD | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK, Length);
499 }
500
501 if (!NT_SUCCESS(Status))
502 {
503 DPRINT1("KsProbeStreamIrp failed with Status %x Cancel %u\n", Status, Irp->Cancel);
504 Irp->MdlAddress = Mdl;
506 return SetIrpIoStatus(Irp, Status, 0);
507 }
508
509 /* get device info */
510 DeviceInfo = (PWDMAUD_DEVICE_INFO)Irp->AssociatedIrp.SystemBuffer;
512
513 /* now get sysaudio file object */
515 if (!NT_SUCCESS(Status))
516 {
517 DPRINT1("Invalid pin handle %p\n", DeviceInfo->hDevice);
518 Irp->MdlAddress = Mdl;
520 return SetIrpIoStatus(Irp, Status, 0);
521 }
522
523 /* store file object whose reference is released in the completion callback */
524 Context->FileObject = FileObject;
525
526 /* skip current irp stack location */
528
529 /* get next stack location */
531
532 /* prepare stack location */
533 IoStack->FileObject = FileObject;
534 IoStack->Parameters.Write.Length = Length;
535 IoStack->MajorFunction = IRP_MJ_WRITE;
538
539 /* mark irp as pending */
540// IoMarkIrpPending(Irp);
541 /* call the driver */
543 return Status;
544}
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
KSDDKAPI NTSTATUS NTAPI KsProbeStreamIrp(IN PIRP Irp, IN ULONG ProbeFlags, IN ULONG HeaderSize)
Definition: irp.c:680
NTSTATUS NTAPI IoCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Ctx)
Definition: control.c:383
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
#define IOCTL_KS_READ_STREAM
Definition: ks.h:142
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:139
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
#define IoCallDriver
Definition: irp.c:1225
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
_In_ BOOLEAN Read
Definition: strmini.h:479
struct _IO_STACK_LOCATION::@3974::@3979 Write
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#define MmGetMdlVirtualAddress(_Mdl)

Referenced by DriverEntry().

◆ WdmAudRegisterDeviceInterface()

NTSTATUS WdmAudRegisterDeviceInterface ( IN PDEVICE_OBJECT  PhysicalDeviceObject,
IN PWDMAUD_DEVICE_EXTENSION  DeviceExtension 
)

Definition at line 186 of file deviface.c.

189{
192
194 if (NT_SUCCESS(Status))
195 {
198 //DeviceExtension->DeviceInterfaceSupport = TRUE;
199 return Status;
200 }
201
202 return Status;
203}
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define KSCATEGORY_WDMAUD
Definition: ksmedia.h:222
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:955
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
Definition: wdfdevice.h:3739

Referenced by WdmaudAddDevice().

◆ 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
614 else
616}
MIXER_STATUS MMixerSetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERCONTROLDETAILS MixerControlDetails)
Definition: mixer.c:495

◆ 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
741 return STATUS_SUCCESS;
742 else
743 return Status;
744}
MIXER_STATUS MMixerWaveOutCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEOUTCAPSW Caps)
Definition: wave.c:538
MIXER_STATUS MMixerWaveInCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEINCAPSW Caps)
Definition: wave.c:502

Referenced by WdmAudCapabilities().

◆ WdmAudWaveInitialize()

NTSTATUS NTAPI WdmAudWaveInitialize ( IN PDEVICE_OBJECT  DeviceObject)

◆ WdmAudWrite()

NTSTATUS NTAPI WdmAudWrite ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)