ReactOS 0.4.16-dev-197-g92996da
control.c File Reference
#include "wdmaud.h"
#include <debug.h>
Include dependency graph for control.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS WdmAudControlOpen (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS WdmAudControlDeviceType (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS WdmAudControlDeviceState (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS WdmAudCapabilities (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS NTAPI WdmAudIoctlClose (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS NTAPI WdmAudFrameSize (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
 
NTSTATUS NTAPI WdmAudGetDeviceInterface (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo)
 
NTSTATUS NTAPI WdmAudResetStream (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo)
 
NTSTATUS NTAPI WdmAudDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IoCompletion (PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Ctx)
 
NTSTATUS NTAPI WdmAudReadWrite (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Variables

const GUID KSPROPSETID_Sysaudio = {0xCBE3FAA0L, 0xCC75, 0x11D0, {0xB4, 0x65, 0x00, 0x00, 0x1A, 0x18, 0x18, 0xE6}}
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file control.c.

Function Documentation

◆ IoCompletion()

NTSTATUS NTAPI IoCompletion ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PVOID  Ctx 
)

Definition at line 383 of file control.c.

387{
389 PMDL Mdl, NextMdl;
391
392 /* get stream header */
393 Header = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
394
395 /* sanity check */
396 ASSERT(Header);
397
398 /* time to free all allocated mdls */
399 Mdl = Irp->MdlAddress;
400
401 while(Mdl)
402 {
403 /* get next mdl */
404 NextMdl = Mdl->Next;
405
406 /* unlock pages */
408
409 /* grab next mdl */
410 Mdl = NextMdl;
411 }
412 //IoFreeMdl(Mdl);
413 /* clear mdl list */
414 Irp->MdlAddress = Context->Mdl;
415
416
417
418 DPRINT("IoCompletion Irp %p IoStatus %lx Information %lx\n", Irp, Irp->IoStatus.Status, Irp->IoStatus.Information);
419
420 if (!NT_SUCCESS(Irp->IoStatus.Status))
421 {
422 /* failed */
423 Irp->IoStatus.Information = 0;
424 }
425
426 /* dereference file object */
427 ObDereferenceObject(Context->FileObject);
428
429 /* free context */
431
432 return STATUS_SUCCESS;
433}
Definition: Header.h:9
_In_ PIRP Irp
Definition: csq.h:116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
struct WDMAUD_COMPLETION_CONTEXT * PWDMAUD_COMPLETION_CONTEXT
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by IoSetIoCompletion(), TestObjectTypes(), and WdmAudReadWrite().

◆ WdmAudCapabilities()

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

Definition at line 118 of file control.c.

123{
124 PWDMAUD_DEVICE_EXTENSION DeviceExtension;
126
127 DPRINT("WdmAudCapabilities entered\n");
128
129 DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
130
131 if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE)
132 {
134 }
135 else if (DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE || DeviceInfo->DeviceType == WAVE_OUT_DEVICE_TYPE)
136 {
138 }
139 else if (DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE || DeviceInfo->DeviceType == MIDI_OUT_DEVICE_TYPE)
140 {
142 }
143
145}
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS WdmAudMidiCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
Definition: mmixer.c:747
NTSTATUS WdmAudWaveCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
Definition: mmixer.c:721
NTSTATUS WdmAudMixerCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
Definition: mmixer.c:398
NTSTATUS SetIrpIoStatus(IN PIRP Irp, IN NTSTATUS Status, IN ULONG Length)
Definition: sup.c:59
struct WDMAUD_DEVICE_EXTENSION * PWDMAUD_DEVICE_EXTENSION
Status
Definition: gdiplustypes.h:25
CLIENT_DATA ClientInfo
if(dx< 0)
Definition: linetemp.h:194
@ MIXER_DEVICE_TYPE
Definition: sndtypes.h:33
@ MIDI_OUT_DEVICE_TYPE
Definition: sndtypes.h:31
@ WAVE_IN_DEVICE_TYPE
Definition: sndtypes.h:28
@ WAVE_OUT_DEVICE_TYPE
Definition: sndtypes.h:29
@ MIDI_IN_DEVICE_TYPE
Definition: sndtypes.h:30
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

Referenced by WdmAudDeviceControl().

◆ WdmAudControlDeviceState()

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

Definition at line 82 of file control.c.

87{
93
94 DPRINT("WdmAudControlDeviceState\n");
95
97 if (!NT_SUCCESS(Status))
98 {
99 DPRINT1("Error: invalid device handle provided %p Type %x\n", DeviceInfo->hDevice, DeviceInfo->DeviceType);
101 }
102
106
107 State = DeviceInfo->u.State;
108
110
112
113 DPRINT("WdmAudControlDeviceState Status %x\n", Status);
115}
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define GENERIC_READ
Definition: compat.h:135
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
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
@ KSPROPERTY_CONNECTION_STATE
Definition: ks.h:349
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
KSSTATE
Definition: ks.h:1214
#define KSPROPSETID_Connection
Definition: ks.h:346
#define KernelMode
Definition: asm.h:34
#define GENERIC_WRITE
Definition: nt_native.h:90
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
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_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
* PFILE_OBJECT
Definition: iotypes.h:1998

Referenced by WdmAudDeviceControl().

◆ WdmAudControlDeviceType()

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

Definition at line 44 of file control.c.

49{
50 ULONG Result = 0;
51
52 if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE)
53 {
55 }
56 else if (DeviceInfo->DeviceType == WAVE_OUT_DEVICE_TYPE)
57 {
59 }
60 else if (DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE)
61 {
63 }
64 else if (DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE)
65 {
67 }
68 else if (DeviceInfo->DeviceType == MIDI_OUT_DEVICE_TYPE)
69 {
71 }
72
73
74 /* store result count */
75 DeviceInfo->DeviceCount = Result;
76
77 DPRINT("WdmAudControlDeviceType Devices %u\n", DeviceInfo->DeviceCount);
79}
ULONG WdmAudGetMidiOutDeviceCount()
Definition: mmixer.c:687
ULONG WdmAudGetWaveInDeviceCount()
Definition: mmixer.c:669
ULONG WdmAudGetWaveOutDeviceCount()
Definition: mmixer.c:675
ULONG WdmAudGetMidiInDeviceCount()
Definition: mmixer.c:681
ULONG WdmAudGetMixerDeviceCount()
Definition: mmixer.c:663
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by WdmAudDeviceControl().

◆ WdmAudControlOpen()

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

Definition at line 18 of file control.c.

23{
24 if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE)
25 {
27 }
28
29 if (DeviceInfo->DeviceType == WAVE_OUT_DEVICE_TYPE || DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE)
30 {
32 }
33
34 if (DeviceInfo->DeviceType == MIDI_OUT_DEVICE_TYPE || DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE)
35 {
37 }
38
39
41}
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
NTSTATUS WdmAudControlOpenMixer(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:411
NTSTATUS WdmAudControlOpenWave(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:847
NTSTATUS WdmAudControlOpenMidi(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo)
Definition: mmixer.c:869

Referenced by WdmAudDeviceControl().

◆ 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
@ 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 STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#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}
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
@ KSPROPERTY_CONNECTION_ALLOCATORFRAMING
Definition: ks.h:352

Referenced by WdmAudDeviceControl().

◆ WdmAudGetDeviceInterface()

NTSTATUS NTAPI WdmAudGetDeviceInterface ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo 
)

Definition at line 222 of file control.c.

226{
230
231 /* get device interface string input length */
232 Size = DeviceInfo->u.Interface.DeviceInterfaceStringSize;
233
234 /* get mixer info */
236
237 /* check for success */
238 if (!NT_SUCCESS(Status))
239 {
240 /* invalid device id */
242 }
243
244 /* calculate length */
245 Length = (wcslen(Device)+1) * sizeof(WCHAR);
246
247 if (!Size)
248 {
249 /* store device interface size */
250 DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
251 }
252 else if (Size < Length)
253 {
254 /* buffer too small */
255 DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
257 }
258 else
259 {
260 //FIXME SEH
261 RtlMoveMemory(DeviceInfo->u.Interface.DeviceInterfaceString, Device, Length);
262 }
263
266}
NTSTATUS WdmAudGetPnpNameByIndexAndType(IN ULONG DeviceIndex, IN SOUND_DEVICE_TYPE DeviceType, OUT LPWSTR *DevicePath)
Definition: mmixer.c:693
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by WdmAudDeviceControl().

◆ WdmAudIoctlClose()

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

Definition at line 149 of file control.c.

154{
155 ULONG Index;
156
157 for(Index = 0; Index < ClientInfo->NumPins; Index++)
158 {
159 if (ClientInfo->hPins[Index].Handle == DeviceInfo->hDevice && ClientInfo->hPins[Index].Type != MIXER_DEVICE_TYPE)
160 {
161 DPRINT1("Closing device %p\n", DeviceInfo->hDevice);
162 ZwClose(DeviceInfo->hDevice);
163 ClientInfo->hPins[Index].Handle = NULL;
165 return STATUS_SUCCESS;
166 }
167 else if (ClientInfo->hPins[Index].Handle == DeviceInfo->hDevice && ClientInfo->hPins[Index].Type == MIXER_DEVICE_TYPE)
168 {
169 DPRINT1("Closing mixer %p\n", DeviceInfo->hDevice);
171 }
172 }
173
176}
NTSTATUS WdmAudControlCloseMixer(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo, IN ULONG Index)
Definition: mmixer.c:475
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by WdmAudDeviceControl().

◆ 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 NonPagedPool
Definition: env_spec_w32.h:307
#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
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
#define IoCompleteRequest
Definition: irp.c:1240
#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
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define MmGetMdlVirtualAddress(_Mdl)

Referenced by DriverEntry().

◆ WdmAudResetStream()

NTSTATUS NTAPI WdmAudResetStream ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PWDMAUD_DEVICE_INFO  DeviceInfo 
)

Definition at line 270 of file control.c.

274{
275 KSRESET ResetStream;
279
280 DPRINT("WdmAudResetStream\n");
281
283 if (!NT_SUCCESS(Status))
284 {
285 DPRINT1("Error: invalid device handle provided %p Type %x\n", DeviceInfo->hDevice, DeviceInfo->DeviceType);
287 }
288
289 ResetStream = DeviceInfo->u.ResetStream;
290 ASSERT(ResetStream == KSRESET_BEGIN || ResetStream == KSRESET_END);
291
293
295
296 DPRINT("WdmAudResetStream Status %x\n", Status);
298}
KSRESET
Definition: ks.h:1226
@ KSRESET_BEGIN
Definition: ks.h:1227
@ KSRESET_END
Definition: ks.h:1228
#define IOCTL_KS_RESET_STATE
Definition: ks.h:145

Referenced by PopulateWdmDeviceList(), and WdmAudDeviceControl().

Variable Documentation

◆ KSPROPSETID_Sysaudio

const GUID KSPROPSETID_Sysaudio = {0xCBE3FAA0L, 0xCC75, 0x11D0, {0xB4, 0x65, 0x00, 0x00, 0x1A, 0x18, 0x18, 0xE6}}

Definition at line 15 of file control.c.

Referenced by SysAudioHandleProperty().