ReactOS  0.4.14-dev-50-g13bb5e2
shutdown.c
Go to the documentation of this file.
1 /*
2  * FFS File System Driver for Windows
3  *
4  * read.c
5  *
6  * 2004.5.6 ~
7  *
8  * Lee Jae-Hong, http://www.pyrasis.com
9  *
10  * See License.txt
11  *
12  */
13 
14 #include "ntifs.h"
15 #include "ffsdrv.h"
16 
17 /* Globals */
18 
19 extern PFFS_GLOBAL FFSGlobal;
20 
21 
22 /* Definitions */
23 
24 #ifdef ALLOC_PRAGMA
25 #pragma alloc_text(PAGE, FFSShutDown)
26 #endif
27 
28 
32  IN PFFS_IRP_CONTEXT IrpContext)
33 {
35 
36 #ifndef __REACTOS__
37  PKEVENT Event;
38 #endif
39 
40  PIRP Irp;
42 
43  PFFS_VCB Vcb;
44  PLIST_ENTRY ListEntry;
45 
46  BOOLEAN GlobalResourceAcquired = FALSE;
47 
48  PAGED_CODE();
49 
50  _SEH2_TRY
51  {
52  ASSERT(IrpContext);
53 
54  ASSERT((IrpContext->Identifier.Type == FFSICX) &&
55  (IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
56 
58 
59  Irp = IrpContext->Irp;
60 
62 #ifdef _MSC_VER
63 #pragma prefast( suppress: 28137, "by design" )
64 #endif
67  IrpContext->IsSynchronous))
68  {
71  }
72 
73  GlobalResourceAcquired = TRUE;
74 
75 #ifndef __REACTOS__
78 #endif
79 
80  for (ListEntry = FFSGlobal->VcbList.Flink;
81  ListEntry != &(FFSGlobal->VcbList);
82  ListEntry = ListEntry->Flink)
83  {
84  Vcb = CONTAINING_RECORD(ListEntry, FFS_VCB, Next);
85 
87  &Vcb->MainResource,
88  TRUE))
89  {
90 
92  if(!NT_SUCCESS(Status))
93  {
94  FFSBreakPoint();
95  }
96 
98 
99  if(!NT_SUCCESS(Status))
100  {
101  FFSBreakPoint();
102  }
103 
105 
107  &Vcb->MainResource,
109  }
110  }
111 
112  /*
113  IoUnregisterFileSystem(FFSGlobal->DeviceObject);
114  */
115  }
116 
118  {
119  if (GlobalResourceAcquired)
120  {
124  }
125 
126  if (!IrpContext->ExceptionInProgress)
127  {
128  if (Status == STATUS_PENDING)
129  {
130  FFSQueueRequest(IrpContext);
131  }
132  else
133  {
134  FFSCompleteIrpContext(IrpContext, Status);
135  }
136  }
137  } _SEH2_END;
138 
139  return Status;
140 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
NTSTATUS FFSQueueRequest(IN PFFS_IRP_CONTEXT IrpContext)
Definition: dispatch.c:33
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
_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 FFSFlushVolume(IN PFFS_VCB Vcb, BOOLEAN bShutDown)
Definition: flush.c:107
_SEH2_TRY
Definition: create.c:4250
#define FFSBreakPoint()
Definition: ffsdrv.h:43
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
unsigned char BOOLEAN
__drv_mustHoldCriticalRegion NTSTATUS FFSFlushFiles(IN PFFS_VCB Vcb, BOOLEAN bShutDown)
Definition: flush.c:54
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define Vcb
Definition: cdprocs.h:1425
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
__drv_mustHoldCriticalRegion NTSTATUS FFSCompleteIrpContext(IN PFFS_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:53
LIST_ENTRY VcbList
Definition: ffsdrv.h:374
Definition: typedefs.h:117
#define FFS_POOL_TAG
Definition: ffsdrv.h:817
__drv_mustHoldCriticalRegion NTSTATUS FFSShutDown(IN PFFS_IRP_CONTEXT IrpContext)
Definition: shutdown.c:31
Status
Definition: gdiplustypes.h:24
NTSTATUS FFSDiskShutDown(PFFS_VCB Vcb)
Definition: block.c:648
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
ERESOURCE Resource
Definition: ffsdrv.h:352
_SEH2_END
Definition: create.c:4424
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define _SEH2_LEAVE
Definition: filesup.c:20
return STATUS_SUCCESS
Definition: btrfs.c:2966