ReactOS 0.4.15-dev-8145-ga541a46
filter.c File Reference
#include "kmixer.h"
#include <swenum.h>
#include <debug.h>
Include dependency graph for filter.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI Dispatch_fnDeviceIoControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI DispatchCreateKMixPin (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI DispatchCreateKMixAllocator (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI DispatchCreateKMix (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI KMixAllocateDeviceHeader (IN PKMIXER_DEVICE_EXT DeviceExtension)
 

Variables

static KSDISPATCH_TABLE DispatchTable
 

Function Documentation

◆ Dispatch_fnClose()

NTSTATUS NTAPI Dispatch_fnClose ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 33 of file filter.c.

36{
38
39 Irp->IoStatus.Status = STATUS_SUCCESS;
40 Irp->IoStatus.Information = 0;
42 return STATUS_SUCCESS;
43}
#define UNIMPLEMENTED
Definition: debug.h:118
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ Dispatch_fnDeviceIoControl()

NTSTATUS NTAPI Dispatch_fnDeviceIoControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 18 of file filter.c.

21{
24
25 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
26 Irp->IoStatus.Information = 0;
29}
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

◆ DispatchCreateKMix()

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

Definition at line 101 of file filter.c.

104{
106 KSOBJECT_HEADER ObjectHeader;
107 PKSOBJECT_CREATE_ITEM CreateItem;
108 PKMIXER_DEVICE_EXT DeviceExtension;
109
110 DPRINT("DispatchCreateKMix entered\n");
111
112 /* check if the request was from usermode */
113 if (Irp->RequestorMode == UserMode)
114 {
115 /* deny access from usermode */
116 Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
117 Irp->IoStatus.Information = 0;
120 }
121
122 /* get device extension */
123 DeviceExtension = (PKMIXER_DEVICE_EXT)DeviceObject->DeviceExtension;
124
125#if 0
126 /* reference the software bus object */
128
129 if (!NT_SUCCESS(Status))
130 {
131 /* failed to reference bus object */
132 Irp->IoStatus.Status = Status;
133 Irp->IoStatus.Information = 0;
135 return Status;
136 }
137#endif
138
139 /* allocate create item */
140 CreateItem = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM) * 2);
141 if (!CreateItem)
142 {
143 /* not enough memory */
144 Irp->IoStatus.Information = 0;
145 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
148 }
149
150 /* zero create struct */
151 RtlZeroMemory(CreateItem, sizeof(KSOBJECT_CREATE_ITEM) * 2);
152
153 /* initialize pin create item */
154 CreateItem[0].Create = DispatchCreateKMixPin;
155 RtlInitUnicodeString(&CreateItem[0].ObjectClass, KSSTRING_Pin);
156 CreateItem[1].Create = DispatchCreateKMixAllocator;
157 RtlInitUnicodeString(&CreateItem[1].ObjectClass, KSSTRING_Allocator);
158
159 /* allocate object header */
160 Status = KsAllocateObjectHeader(&ObjectHeader, 2, CreateItem, Irp, &DispatchTable);
161
162 if (!NT_SUCCESS(Status))
163 {
164 /* failed to allocate object header */
165 ExFreePool(CreateItem);
167 }
168
169 DPRINT("KsAllocateObjectHeader result %x\n", Status);
170 /* complete the irp */
171 Irp->IoStatus.Information = 0;
172 Irp->IoStatus.Status = Status;
174 return Status;
175}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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
KSDDKAPI NTSTATUS NTAPI KsReferenceSoftwareBusObject(IN KSDEVICE_HEADER Header)
Definition: device.c:780
KSDDKAPI VOID NTAPI KsDereferenceSoftwareBusObject(IN KSDEVICE_HEADER Header)
Definition: device.c:851
NTSTATUS NTAPI DispatchCreateKMixAllocator(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:82
NTSTATUS NTAPI DispatchCreateKMixPin(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:61
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:25
struct KMIXER_DEVICE_EXT * PKMIXER_DEVICE_EXT
#define KSSTRING_Allocator
Definition: ks.h:50
#define KSSTRING_Pin
Definition: ks.h:48
#define UserMode
Definition: asm.h:35
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define DPRINT
Definition: sndvol32.h:73
KSDEVICE_HEADER KsDeviceHeader
Definition: kmixer.h:9
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:248

Referenced by KMixAllocateDeviceHeader().

◆ DispatchCreateKMixAllocator()

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

Definition at line 82 of file filter.c.

85{
87
88 /* create the allocator */
90
91 /* save result */
92 Irp->IoStatus.Status = Status;
93 /* complete the request */
95 /* done */
96 return Status;
97}
KSDDKAPI NTSTATUS NTAPI KsCreateDefaultAllocator(IN PIRP Irp)
Definition: allocators.c:384

Referenced by DispatchCreateKMix().

◆ DispatchCreateKMixPin()

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

Definition at line 61 of file filter.c.

64{
66
67 DPRINT("DispatchCreateKMix entered\n");
68
69 /* create the pin */
71
72 /* save result */
73 Irp->IoStatus.Status = Status;
74 /* complete the request */
76 /* done */
77 return Status;
78}
NTSTATUS CreatePin(IN PIRP Irp)
Definition: pin.c:699

Referenced by DispatchCreateKMix().

◆ KMixAllocateDeviceHeader()

NTSTATUS NTAPI KMixAllocateDeviceHeader ( IN PKMIXER_DEVICE_EXT  DeviceExtension)

Definition at line 179 of file filter.c.

181{
183 PKSOBJECT_CREATE_ITEM CreateItem;
184
185 /* allocate create item */
186 CreateItem = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM) * 2);
187 if (!CreateItem)
189
190 /* initialize create item struct */
191 RtlZeroMemory(CreateItem, sizeof(KSOBJECT_CREATE_ITEM) * 2);
192 CreateItem[0].Create = DispatchCreateKMix;
193 RtlInitUnicodeString(&CreateItem[0].ObjectClass, L"GLOBAL");
194 CreateItem[1].Create = DispatchCreateKMix;
195 RtlInitUnicodeString(&CreateItem[1].ObjectClass, KSSTRING_Filter);
196
197 Status = KsAllocateDeviceHeader(&DeviceExtension->KsDeviceHeader,
198 2,
199 CreateItem);
200 return Status;
201}
KSDDKAPI NTSTATUS NTAPI KsAllocateDeviceHeader(OUT KSDEVICE_HEADER *OutHeader, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL)
Definition: api.c:522
NTSTATUS NTAPI DispatchCreateKMix(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:101
#define KSSTRING_Filter
Definition: ks.h:47
#define L(x)
Definition: ntvdm.h:50

Referenced by KMix_AddDevice().

Variable Documentation

◆ DispatchTable

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

Definition at line 45 of file filter.c.