ReactOS 0.4.16-dev-334-g4d9f67c
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_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ 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;
33}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
NTSTATUS SysAudioHandleProperty(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: control.c:288
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
union _IO_STACK_LOCATION::@1581 Parameters
struct _IO_STACK_LOCATION::@1581::@1582 DeviceIoControl
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

◆ 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 */
91
92 /* allocate object header */
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}
LONG NTSTATUS
Definition: precomp.h:26
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
NTSTATUS NTAPI DispatchCreateSysAudioPin(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pin.c:431
#define NonPagedPool
Definition: env_spec_w32.h:307
static CABITEM * CreateItem(LPCWSTR Path, UINT Attrib, UINT Size, UINT DateTime)
Definition: folder.cpp:69
Status
Definition: gdiplustypes.h:25
#define KSSTRING_Pin
Definition: ks.h:48
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:248

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));
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}
KSDDKAPI NTSTATUS NTAPI KsAllocateDeviceHeader(OUT KSDEVICE_HEADER *OutHeader, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL)
Definition: api.c:522
NTSTATUS NTAPI DispatchCreateSysAudio(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatcher.c:65
#define L(x)
Definition: ntvdm.h:50

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}
MMRESULT OpenDevice(DeviceInfo **private_data, MIDIOPENDESC *open_desc, DWORD flags)
Definition: beepmidi.c:264
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by SysAudio_AddDevice().

Variable Documentation

◆ DispatchTable

KSDISPATCH_TABLE DispatchTable
static
Initial value:
=
{
KsDispatchFastWriteFailure,
}
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1189
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:1271
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:1251
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.