ReactOS  0.4.15-dev-321-g2d9b385
devctl.c File Reference
#include "rfsd.h"
Include dependency graph for devctl.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI RfsdDeviceControlCompletion (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
 
NTSTATUS RfsdDeviceControlNormal (IN PRFSD_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdDeviceControl (IN PRFSD_IRP_CONTEXT IrpContext)
 

Variables

PRFSD_GLOBAL RfsdGlobal
 

Function Documentation

◆ RfsdDeviceControl()

__drv_mustHoldCriticalRegion NTSTATUS RfsdDeviceControl ( IN PRFSD_IRP_CONTEXT  IrpContext)

Definition at line 236 of file devctl.c.

237 {
238  PIRP Irp;
239  PIO_STACK_LOCATION IoStackLocation;
242 
243  PAGED_CODE();
244 
245  ASSERT(IrpContext);
246 
247  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
248  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
249 
250  Irp = IrpContext->Irp;
251 
252  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
253 
254  IoControlCode =
255  IoStackLocation->Parameters.DeviceIoControl.IoControlCode;
256 
257  switch (IoControlCode) {
258 
259 #if RFSD_UNLOAD
260  case IOCTL_PREPARE_TO_UNLOAD:
261  Status = RfsdPrepareToUnload(IrpContext);
262  break;
263 #endif
264  default:
265  Status = RfsdDeviceControlNormal(IrpContext);
266  }
267 
268  return Status;
269 }
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS RfsdDeviceControlNormal(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: devctl.c:52
Definition: rfsd.h:326
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
NTSTATUS RfsdPrepareToUnload(IN PRFSD_IRP_CONTEXT IrpContext)
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
#define PAGED_CODE()

Referenced by RfsdDispatchRequest().

◆ RfsdDeviceControlCompletion()

NTSTATUS NTAPI RfsdDeviceControlCompletion ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PVOID  Context 
)

Definition at line 40 of file devctl.c.

43 {
44  if (Irp->PendingReturned) {
46  }
47 
48  return STATUS_SUCCESS;
49 }
_In_ PIRP Irp
Definition: csq.h:116
return STATUS_SUCCESS
Definition: btrfs.c:3014
IoMarkIrpPending(Irp)

Referenced by RfsdDeviceControlNormal().

◆ RfsdDeviceControlNormal()

NTSTATUS RfsdDeviceControlNormal ( IN PRFSD_IRP_CONTEXT  IrpContext)

Definition at line 52 of file devctl.c.

53 {
57 
58  PRFSD_VCB Vcb;
59 
60  PIRP Irp;
62  PIO_STACK_LOCATION NextIrpSp;
63 
65 
66  PAGED_CODE();
67 
68  _SEH2_TRY {
69 
70  ASSERT(IrpContext != NULL);
71 
72  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
73  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
74 
76 
77  DeviceObject = IrpContext->DeviceObject;
78 
82  }
83 
84  Irp = IrpContext->Irp;
86 
87  Vcb = (PRFSD_VCB) IrpSp->FileObject->FsContext;
88 
89  if (!((Vcb) && (Vcb->Identifier.Type == RFSDVCB) &&
90  (Vcb->Identifier.Size == sizeof(RFSD_VCB)))) {
93  }
94 
95  TargetDeviceObject = Vcb->TargetDeviceObject;
96 
97  //
98  // Pass on the IOCTL to the driver below
99  //
100 
102 
103  NextIrpSp = IoGetNextIrpStackLocation( Irp );
104  *NextIrpSp = *IrpSp;
105 
107  Irp,
109  NULL,
110  FALSE,
111  TRUE,
112  TRUE );
113 
115 
116  } _SEH2_FINALLY {
117 
118  if (!IrpContext->ExceptionInProgress) {
119  if (IrpContext) {
120  if (!CompleteRequest) {
121  IrpContext->Irp = NULL;
122  }
123 
124  RfsdCompleteIrpContext(IrpContext, Status);
125  }
126  }
127  } _SEH2_END;
128 
129  return Status;
130 }
NTSTATUS RfsdCompleteIrpContext(IN PRFSD_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: memory.c:160
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
Definition: rfsd.h:323
PDEVICE_OBJECT DeviceObject
Definition: rfsd.h:407
_SEH2_TRY
Definition: create.c:4250
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:498
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: rfsd.h:326
struct _RFSD_VCB * PRFSD_VCB
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define Vcb
Definition: cdprocs.h:1425
NTSTATUS NTAPI RfsdDeviceControlCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: devctl.c:40
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: dispatch.c:19
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_SEH2_END
Definition: create.c:4424
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define _SEH2_LEAVE
Definition: filesup.c:20
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
Definition: fatprocs.h:1664
#define PAGED_CODE()

Referenced by RfsdDeviceControl().

Variable Documentation

◆ RfsdGlobal

PRFSD_GLOBAL RfsdGlobal

Definition at line 17 of file init.c.

Referenced by RfsdDeviceControlNormal().