ReactOS  0.4.14-dev-41-g31d7680
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.

Macros

#define YDEBUG
 

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
 

Macro Definition Documentation

◆ YDEBUG

#define YDEBUG

Definition at line 13 of file filter.c.

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 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define UNIMPLEMENTED
Definition: debug.h:114
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ Dispatch_fnDeviceIoControl()

NTSTATUS NTAPI Dispatch_fnDeviceIoControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 18 of file filter.c.

21 {
23  DbgBreakPoint();
24 
25  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
26  Irp->IoStatus.Information = 0;
28  return STATUS_UNSUCCESSFUL;
29 }
_In_ PIRP Irp
Definition: csq.h:116
void DbgBreakPoint()
Definition: mach.c:553
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define UNIMPLEMENTED
Definition: debug.h:114

◆ 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 }
NTSTATUS NTAPI DispatchCreateKMixPin(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:61
#define KSSTRING_Allocator
Definition: ks.h:50
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
KSDDKAPI NTSTATUS NTAPI KsReferenceSoftwareBusObject(IN KSDEVICE_HEADER Header)
Definition: device.c:805
KSDDKAPI VOID NTAPI KsDereferenceSoftwareBusObject(IN KSDEVICE_HEADER Header)
Definition: device.c:876
_In_ PIRP Irp
Definition: csq.h:116
#define KSSTRING_Pin
Definition: ks.h:48
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
static KSDISPATCH_TABLE DispatchTable
Definition: filter.c:45
struct KMIXER_DEVICE_EXT * PKMIXER_DEVICE_EXT
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI DispatchCreateKMixAllocator(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:82
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KSDEVICE_HEADER KsDeviceHeader
Definition: kmixer.h:9
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
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:566
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

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 }
_In_ PIRP Irp
Definition: csq.h:116
KSDDKAPI NTSTATUS NTAPI KsCreateDefaultAllocator(IN PIRP Irp)
Definition: allocators.c:384
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
#define IO_NO_INCREMENT
Definition: iotypes.h:566

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 */
70  Status = CreatePin(Irp);
71 
72  /* save result */
73  Irp->IoStatus.Status = Status;
74  /* complete the request */
76  /* done */
77  return Status;
78 }
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS CreatePin(IN PIRP Irp)
Definition: pin.c:699
Status
Definition: gdiplustypes.h:24
#define IO_NO_INCREMENT
Definition: iotypes.h:566

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 }
#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
LONG NTSTATUS
Definition: precomp.h:26
#define KSSTRING_Filter
Definition: ks.h:47
NTSTATUS NTAPI DispatchCreateKMix(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:101
static const WCHAR L[]
Definition: oid.c:1250
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:24
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

Referenced by KMix_AddDevice().

Variable Documentation

◆ DispatchTable

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

Definition at line 45 of file filter.c.

Referenced by DispatchCreateKMix().