ReactOS  0.4.15-dev-2947-g59e1b78
dispatcher.c File Reference
#include "sysaudio.h"
#include <debug.h>
Include dependency graph for dispatcher.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI Dispatch_fnDeviceIoControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI DispatchCreateSysAudio (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS SysAudioAllocateDeviceHeader (IN SYSAUDIODEVEXT *DeviceExtension)
 
NTSTATUS SysAudioOpenKMixer (IN SYSAUDIODEVEXT *DeviceExtension)
 

Variables

static KSDISPATCH_TABLE DispatchTable
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file dispatcher.c.

Function Documentation

◆ Dispatch_fnClose()

NTSTATUS NTAPI Dispatch_fnClose ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 37 of file dispatcher.c.

40 {
41  DPRINT("Dispatch_fnClose called DeviceObject %p Irp %p\n", DeviceObject);
42 
43  Irp->IoStatus.Status = STATUS_SUCCESS;
44  Irp->IoStatus.Information = 0;
46  return STATUS_SUCCESS;
47 }
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71

◆ Dispatch_fnDeviceIoControl()

NTSTATUS NTAPI Dispatch_fnDeviceIoControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 16 of file dispatcher.c.

19 {
20  PIO_STACK_LOCATION IoStack;
21 
23  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
24  {
26  }
27 
28  /* unsupported request */
29  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
30  Irp->IoStatus.Information = 0;
32  return STATUS_UNSUCCESSFUL;
33 }
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS SysAudioHandleProperty(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: control.c:288
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IO_NO_INCREMENT
Definition: iotypes.h:598
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128

◆ DispatchCreateSysAudio()

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

Definition at line 65 of file dispatcher.c.

68 {
70  KSOBJECT_HEADER ObjectHeader;
71  PKSOBJECT_CREATE_ITEM CreateItem;
72 
73  DPRINT("DispatchCreateSysAudio entered\n");
74 
75  /* allocate create item */
76  CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
77  if (!CreateItem)
78  {
79  Irp->IoStatus.Information = 0;
80  Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
83  }
84 
85  /* zero create struct */
86  RtlZeroMemory(CreateItem, sizeof(KSOBJECT_CREATE_ITEM));
87 
88  /* setup create context */
89  CreateItem->Create = DispatchCreateSysAudioPin;
90  RtlInitUnicodeString(&CreateItem->ObjectClass, KSSTRING_Pin);
91 
92  /* allocate object header */
93  Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp, &DispatchTable);
94 
95  DPRINT("KsAllocateObjectHeader result %x\n", Status);
96  /* complete the irp */
97  Irp->IoStatus.Information = 0;
98  Irp->IoStatus.Status = Status;
100  return Status;
101 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
#define KSSTRING_Pin
Definition: ks.h:48
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI DispatchCreateSysAudioPin(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pin.c:431
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
KSDDKAPI NTSTATUS NTAPI KsAllocateObjectHeader(OUT KSOBJECT_HEADER *Header, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL, IN PIRP Irp, IN KSDISPATCH_TABLE *Table)
Definition: api.c:610
#define IO_NO_INCREMENT
Definition: iotypes.h:598
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define DPRINT
Definition: sndvol32.h:71
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:245

Referenced by SysAudioAllocateDeviceHeader().

◆ SysAudioAllocateDeviceHeader()

NTSTATUS SysAudioAllocateDeviceHeader ( IN SYSAUDIODEVEXT DeviceExtension)

Definition at line 104 of file dispatcher.c.

106 {
108  PKSOBJECT_CREATE_ITEM CreateItem;
109 
110  /* allocate create item */
111  CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
112  if (!CreateItem)
114 
115  /* initialize create item struct */
116  RtlZeroMemory(CreateItem, sizeof(KSOBJECT_CREATE_ITEM));
117  CreateItem->Create = DispatchCreateSysAudio;
118 
119  /* FIXME Sysaudio doesnt need a named create item because it installs itself
120  * via the device interface
121  */
122  RtlInitUnicodeString(&CreateItem->ObjectClass, L"GLOBAL");
123  CreateItem->Flags = KSCREATE_ITEM_WILDCARD;
124 
125  Status = KsAllocateDeviceHeader(&DeviceExtension->KsDeviceHeader,
126  1,
127  CreateItem);
128  return Status;
129 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
KSDDKAPI NTSTATUS NTAPI KsAllocateDeviceHeader(OUT KSDEVICE_HEADER *OutHeader, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL)
Definition: api.c:522
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI DispatchCreateSysAudio(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatcher.c:65
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by SysAudio_AddDevice().

◆ SysAudioOpenKMixer()

NTSTATUS SysAudioOpenKMixer ( IN SYSAUDIODEVEXT DeviceExtension)

Definition at line 132 of file dispatcher.c.

134 {
136  UNICODE_STRING DeviceInstanceName = RTL_CONSTANT_STRING(L"\\Device\\kmixer\\GLOBAL");
137  UNICODE_STRING DevicePath = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\kmixer");
138 
139  Status = ZwLoadDriver(&DevicePath);
140 
141  if (NT_SUCCESS(Status))
142  {
143  Status = OpenDevice(&DeviceInstanceName, &DeviceExtension->KMixerHandle, &DeviceExtension->KMixerFileObject);
144  if (!NT_SUCCESS(Status))
145  {
146  DeviceExtension->KMixerHandle = NULL;
147  DeviceExtension->KMixerFileObject = NULL;
148  }
149  }
150 
151  DPRINT("Status %lx KMixerHandle %p KMixerFileObject %p\n", Status, DeviceExtension->KMixerHandle, DeviceExtension->KMixerFileObject);
152  return STATUS_SUCCESS;
153 }
LONG NTSTATUS
Definition: precomp.h:26
MMRESULT OpenDevice(DeviceInfo **private_data, MIDIOPENDESC *open_desc, DWORD flags)
Definition: beepmidi.c:264
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by SysAudio_AddDevice().

Variable Documentation

◆ DispatchTable

KSDISPATCH_TABLE DispatchTable
static
Initial value:
=
{
KsDispatchFastWriteFailure,
}
KSDDKAPI BOOLEAN NTAPI KsDispatchFastIoDeviceControlFailure(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1230
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1168
KSDDKAPI BOOLEAN NTAPI KsDispatchFastReadFailure(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1250
NTSTATUS NTAPI Dispatch_fnDeviceIoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.c:16
NTSTATUS NTAPI Dispatch_fnClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.c:37

Definition at line 49 of file dispatcher.c.