ReactOS 0.4.15-dev-8428-g6910fa6
dispatcher.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for dispatcher.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI Dispatch_fnDeviceIoControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnRead (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnFlush (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnQuerySecurity (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Dispatch_fnSetSecurity (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
BOOLEAN NTAPI Dispatch_fnFastDeviceIoControl (PFILE_OBJECT FileObject, BOOLEAN Wait, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength, ULONG IoControlCode, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI Dispatch_fnFastRead (PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, ULONG LockKey, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI Dispatch_fnFastWrite (PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, ULONG LockKey, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject)
 
NTSTATUS NTAPI NewDispatchObject (IN PIRP Irp, IN IIrpTarget *Target, IN ULONG CreateItemCount, IN PKSOBJECT_CREATE_ITEM CreateItem)
 

Variables

static KSDISPATCH_TABLE DispatchTable
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file dispatcher.cpp.

Function Documentation

◆ Dispatch_fnClose()

NTSTATUS NTAPI Dispatch_fnClose ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 92 of file dispatcher.cpp.

95{
96 PIO_STACK_LOCATION IoStack;
99
100 // get current irp stack
102 // get dispatch context
103 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
104
105 // let IrpTarget handle request
106 Status = DispatchContext->Target->Close(DeviceObject, Irp);
107
108 if (NT_SUCCESS(Status))
109 {
110 KsFreeObjectHeader(DispatchContext->ObjectHeader);
112 }
113 // done
114 return Status;
115}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
KSDDKAPI VOID NTAPI KsFreeObjectHeader(IN PVOID Header)
Definition: api.c:720
Status
Definition: gdiplustypes.h:25
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
struct DISPATCH_CONTEXT * PDISPATCH_CONTEXT
#define TAG_PORTCLASS
Definition: private.hpp:24
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1708

◆ Dispatch_fnDeviceIoControl()

NTSTATUS NTAPI Dispatch_fnDeviceIoControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 16 of file dispatcher.cpp.

19{
20 PIO_STACK_LOCATION IoStack;
22
23 // get current irp stack
25
26 // get dispatch context
27 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
28
29 // let IrpTarget handle request
30 return DispatchContext->Target->DeviceIoControl(DeviceObject, Irp);
31}

◆ Dispatch_fnFastDeviceIoControl()

BOOLEAN NTAPI Dispatch_fnFastDeviceIoControl ( PFILE_OBJECT  FileObject,
BOOLEAN  Wait,
PVOID  InputBuffer,
ULONG  InputBufferLength,
PVOID  OutputBuffer,
ULONG  OutputBufferLength,
ULONG  IoControlCode,
PIO_STATUS_BLOCK  IoStatus,
PDEVICE_OBJECT  DeviceObject 
)

Definition at line 157 of file dispatcher.cpp.

167{
169
170 // get dispatch context
172
173 // let IrpTarget handle request
175}
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953

◆ Dispatch_fnFastRead()

BOOLEAN NTAPI Dispatch_fnFastRead ( PFILE_OBJECT  FileObject,
PLARGE_INTEGER  FileOffset,
ULONG  Length,
BOOLEAN  Wait,
ULONG  LockKey,
PVOID  Buffer,
PIO_STATUS_BLOCK  IoStatus,
PDEVICE_OBJECT  DeviceObject 
)

Definition at line 179 of file dispatcher.cpp.

188{
190
191 // get dispatch context
193
194 // let IrpTarget handle request
196}
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
Definition: bufpool.h:45
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2665
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

◆ Dispatch_fnFastWrite()

BOOLEAN NTAPI Dispatch_fnFastWrite ( PFILE_OBJECT  FileObject,
PLARGE_INTEGER  FileOffset,
ULONG  Length,
BOOLEAN  Wait,
ULONG  LockKey,
PVOID  Buffer,
PIO_STATUS_BLOCK  IoStatus,
PDEVICE_OBJECT  DeviceObject 
)

Definition at line 200 of file dispatcher.cpp.

209{
211
212 // get dispatch context
214 // let IrpTarget handle request
216}

◆ Dispatch_fnFlush()

NTSTATUS NTAPI Dispatch_fnFlush ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 73 of file dispatcher.cpp.

76{
77 PIO_STACK_LOCATION IoStack;
79
80 // get current irp stack
82
83 // get dispatch context
84 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
85
86 // let IrpTarget handle request
87 return DispatchContext->Target->Flush(DeviceObject, Irp);
88}

◆ Dispatch_fnQuerySecurity()

NTSTATUS NTAPI Dispatch_fnQuerySecurity ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 119 of file dispatcher.cpp.

122{
123 PIO_STACK_LOCATION IoStack;
125
126 // get current irp stack
128
129 // get dispatch context
130 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
131
132 // let IrpTarget handle request
133 return DispatchContext->Target->QuerySecurity(DeviceObject, Irp);
134}

◆ Dispatch_fnRead()

NTSTATUS NTAPI Dispatch_fnRead ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 35 of file dispatcher.cpp.

38{
39 PIO_STACK_LOCATION IoStack;
41
42 // get current irp stack
44
45 // get dispatch context
46 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
47
48 // let IrpTarget handle request
49 return DispatchContext->Target->Read(DeviceObject, Irp);
50}

◆ Dispatch_fnSetSecurity()

NTSTATUS NTAPI Dispatch_fnSetSecurity ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 138 of file dispatcher.cpp.

141{
142 PIO_STACK_LOCATION IoStack;
144
145 // get current irp stack
147
148 // get dispatch context
149 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
150
151 // let IrpTarget handle request
152 return DispatchContext->Target->SetSecurity(DeviceObject, Irp);
153}

◆ Dispatch_fnWrite()

NTSTATUS NTAPI Dispatch_fnWrite ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 54 of file dispatcher.cpp.

57{
58 PIO_STACK_LOCATION IoStack;
60
61 // get current irp stack
63
64 // get dispatch context
65 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
66
67 // let IrpTarget handle request
68 return DispatchContext->Target->Write(DeviceObject, Irp);
69}

◆ NewDispatchObject()

NTSTATUS NTAPI NewDispatchObject ( IN PIRP  Irp,
IN IIrpTarget *  Target,
IN ULONG  CreateItemCount,
IN PKSOBJECT_CREATE_ITEM  CreateItem 
)

Definition at line 234 of file dispatcher.cpp.

239{
241 KSOBJECT_HEADER ObjectHeader;
242 PIO_STACK_LOCATION IoStack;
244
245 // get current irp stack location
247
249 if (!DispatchContext)
251
252 // allocate object header
253 Status = KsAllocateObjectHeader(&ObjectHeader, CreateItemCount, CreateItem, Irp, &DispatchTable);
254
255 if (!NT_SUCCESS(Status))
256 {
257 // free dispatch context
259 // done
260 return Status;
261 }
262
263 // initialize dispatch context
264 DispatchContext->ObjectHeader = ObjectHeader;
265 DispatchContext->Target = Target;
266 DispatchContext->CreateItem = CreateItem;
267
268 // store dispatch context
269 IoStack->FileObject->FsContext = DispatchContext;
270
271 DPRINT("KsAllocateObjectHeader result %x Target %p Context %p\n", Status, Target, DispatchContext);
272 return Status;
273}
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 NonPagedPool
Definition: env_spec_w32.h:307
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
#define DPRINT
Definition: sndvol32.h:73
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:248
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by PcCreateItemDispatch(), and PcCreatePinDispatch().

Variable Documentation

◆ DispatchTable

KSDISPATCH_TABLE DispatchTable
static
Initial value:
=
{
}
NTSTATUS NTAPI Dispatch_fnDeviceIoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.cpp:16
NTSTATUS NTAPI Dispatch_fnRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.cpp:35
NTSTATUS NTAPI Dispatch_fnClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.cpp:92
NTSTATUS NTAPI Dispatch_fnFlush(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.cpp:73
BOOLEAN NTAPI Dispatch_fnFastWrite(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, ULONG LockKey, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject)
Definition: dispatcher.cpp:200
NTSTATUS NTAPI Dispatch_fnSetSecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.cpp:138
NTSTATUS NTAPI Dispatch_fnQuerySecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.cpp:119
BOOLEAN NTAPI Dispatch_fnFastRead(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, ULONG LockKey, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject)
Definition: dispatcher.cpp:179
BOOLEAN NTAPI Dispatch_fnFastDeviceIoControl(PFILE_OBJECT FileObject, BOOLEAN Wait, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength, ULONG IoControlCode, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject)
Definition: dispatcher.cpp:157
NTSTATUS NTAPI Dispatch_fnWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatcher.cpp:54

Definition at line 218 of file dispatcher.cpp.