ReactOS  0.4.13-dev-544-gede3fdd
devctl.c File Reference
#include "ntifs.h"
#include "ffsdrv.h"
Include dependency graph for devctl.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI FFSDeviceControlCompletion (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSDeviceControlNormal (IN PFFS_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSDeviceControl (IN PFFS_IRP_CONTEXT IrpContext)
 

Variables

PFFS_GLOBAL FFSGlobal
 

Function Documentation

◆ FFSDeviceControl()

__drv_mustHoldCriticalRegion NTSTATUS FFSDeviceControl ( IN PFFS_IRP_CONTEXT  IrpContext)

Definition at line 263 of file devctl.c.

265 {
266  PIRP Irp;
267  PIO_STACK_LOCATION IoStackLocation;
270 
271  PAGED_CODE();
272 
273  ASSERT(IrpContext);
274 
275  ASSERT((IrpContext->Identifier.Type == FFSICX) &&
276  (IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
277 
278  Irp = IrpContext->Irp;
279 
280  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
281 
282  IoControlCode =
283  IoStackLocation->Parameters.DeviceIoControl.IoControlCode;
284 
285  switch (IoControlCode)
286  {
287 #if FFS_UNLOAD
288  case IOCTL_PREPARE_TO_UNLOAD:
289  Status = FFSPrepareToUnload(IrpContext);
290  break;
291 #endif
292 
294  Status = FFSSelectBSDPartition(IrpContext);
295  break;
296 
297  default:
298  Status = FFSDeviceControlNormal(IrpContext);
299  }
300 
301  return Status;
302 }
__drv_mustHoldCriticalRegion NTSTATUS FFSSelectBSDPartition(IN PFFS_IRP_CONTEXT IrpContext)
Definition: fsctl.c:1610
_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
Definition: ffsdrv.h:283
#define PAGED_CODE()
Definition: video.h:57
__drv_mustHoldCriticalRegion NTSTATUS FFSDeviceControlNormal(IN PFFS_IRP_CONTEXT IrpContext)
Definition: devctl.c:61
#define IOCTL_SELECT_BSD_PARTITION
Definition: ffsdrv.h:125
__drv_mustHoldCriticalRegion NTSTATUS FFSPrepareToUnload(IN PFFS_IRP_CONTEXT IrpContext)
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
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771

Referenced by FFSDispatchRequest().

◆ FFSDeviceControlCompletion()

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

Definition at line 45 of file devctl.c.

49 {
50  if (Irp->PendingReturned)
51  {
53  }
54 
55  return STATUS_SUCCESS;
56 }
_In_ PIRP Irp
Definition: csq.h:116
return STATUS_SUCCESS
Definition: btrfs.c:2777
IoMarkIrpPending(Irp)

Referenced by FFSDeviceControlNormal().

◆ FFSDeviceControlNormal()

__drv_mustHoldCriticalRegion NTSTATUS FFSDeviceControlNormal ( IN PFFS_IRP_CONTEXT  IrpContext)

Definition at line 61 of file devctl.c.

63 {
67 
68  PFFS_VCB Vcb;
69 
70  PIRP Irp;
72  PIO_STACK_LOCATION NextIrpSp;
73 
75 
76  PAGED_CODE();
77 
78  _SEH2_TRY
79  {
80  ASSERT(IrpContext != NULL);
81 
82  ASSERT((IrpContext->Identifier.Type == FFSICX) &&
83  (IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
84 
86 
87  DeviceObject = IrpContext->DeviceObject;
88 
90  {
92 
94  }
95 
96  Irp = IrpContext->Irp;
98 
99  Vcb = (PFFS_VCB)IrpSp->FileObject->FsContext;
100 
101  if (!((Vcb) && (Vcb->Identifier.Type == FFSVCB) &&
102  (Vcb->Identifier.Size == sizeof(FFS_VCB))
103  )
104  )
105  {
107  _SEH2_LEAVE;
108  }
109 
110  TargetDeviceObject = Vcb->TargetDeviceObject;
111 
112  //
113  // Pass on the IOCTL to the driver below
114  //
115 
117 
118  NextIrpSp = IoGetNextIrpStackLocation(Irp);
119  *NextIrpSp = *IrpSp;
120 
122  Irp,
124  NULL,
125  FALSE,
126  TRUE,
127  TRUE);
128 
130  }
131 
133  {
134  if (!IrpContext->ExceptionInProgress)
135  {
136  if (IrpContext)
137  {
138  if (!CompleteRequest)
139  {
140  IrpContext->Irp = NULL;
141  }
142 
143  FFSCompleteIrpContext(IrpContext, Status);
144  }
145  }
146  } _SEH2_END;
147 
148  return Status;
149 }
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
Definition: ffsdrv.h:283
PDEVICE_OBJECT DeviceObject
Definition: ffsdrv.h:371
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
NTSTATUS NTAPI FFSDeviceControlCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: devctl.c:45
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
struct _FFS_VCB * PFFS_VCB
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define Vcb
Definition: cdprocs.h:1425
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_mustHoldCriticalRegion NTSTATUS FFSCompleteIrpContext(IN PFFS_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:53
Definition: ffsdrv.h:280
__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:2812
_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

Referenced by FFSDeviceControl().

Variable Documentation

◆ FFSGlobal

PFFS_GLOBAL FFSGlobal

Definition at line 22 of file init.c.

Referenced by FFSDeviceControlNormal().