ReactOS  0.4.15-dev-1171-gab82533
misc.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * FILE: drivers/fs/vfat/misc.c
5  * PURPOSE: VFAT Filesystem
6  * PROGRAMMER:
7  *
8  */
9 
10 /* INCLUDES *****************************************************************/
11 
12 #include "vfat.h"
13 
14 #define NDEBUG
15 #include <debug.h>
16 
17 /* GLOBALS ******************************************************************/
18 
19 const char* MajorFunctionNames[] =
20 {
21  "IRP_MJ_CREATE",
22  "IRP_MJ_CREATE_NAMED_PIPE",
23  "IRP_MJ_CLOSE",
24  "IRP_MJ_READ",
25  "IRP_MJ_WRITE",
26  "IRP_MJ_QUERY_INFORMATION",
27  "IRP_MJ_SET_INFORMATION",
28  "IRP_MJ_QUERY_EA",
29  "IRP_MJ_SET_EA",
30  "IRP_MJ_FLUSH_BUFFERS",
31  "IRP_MJ_QUERY_VOLUME_INFORMATION",
32  "IRP_MJ_SET_VOLUME_INFORMATION",
33  "IRP_MJ_DIRECTORY_CONTROL",
34  "IRP_MJ_FILE_SYSTEM_CONTROL",
35  "IRP_MJ_DEVICE_CONTROL",
36  "IRP_MJ_INTERNAL_DEVICE_CONTROL",
37  "IRP_MJ_SHUTDOWN",
38  "IRP_MJ_LOCK_CONTROL",
39  "IRP_MJ_CLEANUP",
40  "IRP_MJ_CREATE_MAILSLOT",
41  "IRP_MJ_QUERY_SECURITY",
42  "IRP_MJ_SET_SECURITY",
43  "IRP_MJ_POWER",
44  "IRP_MJ_SYSTEM_CONTROL",
45  "IRP_MJ_DEVICE_CHANGE",
46  "IRP_MJ_QUERY_QUOTA",
47  "IRP_MJ_SET_QUOTA",
48  "IRP_MJ_PNP",
49  "IRP_MJ_MAXIMUM_FUNCTION"
50 };
51 
52 static LONG QueueCount = 0;
53 
57 
58 /* FUNCTIONS ****************************************************************/
59 
60 static
63  IN PVFAT_IRP_CONTEXT IrpContext)
64 {
65  PVFATFCB Fcb;
67 
68  DPRINT("VfatLockControl(IrpContext %p)\n", IrpContext);
69 
70  ASSERT(IrpContext);
71 
72  Fcb = (PVFATFCB)IrpContext->FileObject->FsContext;
73 
74  if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
75  {
77  }
78 
80  {
82  }
83 
84  IrpContext->Flags &= ~IRPCONTEXT_COMPLETE;
86  IrpContext->Irp,
87  NULL);
88  return Status;
89 }
90 
91 static
94  IN PVFAT_IRP_CONTEXT IrpContext)
95 {
96  IoSkipCurrentIrpStackLocation(IrpContext->Irp);
97 
98  IrpContext->Flags &= ~IRPCONTEXT_COMPLETE;
99 
100  return IoCallDriver(IrpContext->DeviceExt->StorageDevice, IrpContext->Irp);
101 }
102 
103 static
104 NTSTATUS
106  IN PVFAT_IRP_CONTEXT IrpContext)
107 {
109  BOOLEAN QueueIrp, CompleteIrp;
110 
111  DPRINT("VfatDispatchRequest (IrpContext %p), is called for %s\n", IrpContext,
112  IrpContext->MajorFunction >= IRP_MJ_MAXIMUM_FUNCTION ? "????" : MajorFunctionNames[IrpContext->MajorFunction]);
113 
114  ASSERT(IrpContext);
115 
117 
118  switch (IrpContext->MajorFunction)
119  {
120  case IRP_MJ_CLOSE:
121  Status = VfatClose(IrpContext);
122  break;
123 
124  case IRP_MJ_CREATE:
125  Status = VfatCreate(IrpContext);
126  break;
127 
128  case IRP_MJ_READ:
129  Status = VfatRead(IrpContext);
130  break;
131 
132  case IRP_MJ_WRITE:
133  Status = VfatWrite(&IrpContext);
134  break;
135 
137  Status = VfatFileSystemControl(IrpContext);
138  break;
139 
141  Status = VfatQueryInformation(IrpContext);
142  break;
143 
145  Status = VfatSetInformation(IrpContext);
146  break;
147 
149  Status = VfatDirectoryControl(IrpContext);
150  break;
151 
153  Status = VfatQueryVolumeInformation(IrpContext);
154  break;
155 
157  Status = VfatSetVolumeInformation(IrpContext);
158  break;
159 
160  case IRP_MJ_LOCK_CONTROL:
161  Status = VfatLockControl(IrpContext);
162  break;
163 
165  Status = VfatDeviceControl(IrpContext);
166  break;
167 
168  case IRP_MJ_CLEANUP:
169  Status = VfatCleanup(IrpContext);
170  break;
171 
173  Status = VfatFlush(IrpContext);
174  break;
175 
176  case IRP_MJ_PNP:
177  Status = VfatPnp(IrpContext);
178  break;
179 
180  default:
181  DPRINT1("Unexpected major function %x\n", IrpContext->MajorFunction);
183  }
184 
185  if (IrpContext != NULL)
186  {
187  QueueIrp = BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_QUEUE);
188  CompleteIrp = BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_COMPLETE);
189 
190  ASSERT((!CompleteIrp && !QueueIrp) ||
191  (CompleteIrp && !QueueIrp) ||
192  (!CompleteIrp && QueueIrp));
193 
194  if (CompleteIrp)
195  {
196  IrpContext->Irp->IoStatus.Status = Status;
197  IoCompleteRequest(IrpContext->Irp, IrpContext->PriorityBoost);
198  }
199 
200  if (QueueIrp)
201  {
202  /* Reset our status flags before queueing the IRP */
203  IrpContext->Flags |= IRPCONTEXT_COMPLETE;
204  IrpContext->Flags &= ~IRPCONTEXT_QUEUE;
205  Status = VfatQueueRequest(IrpContext);
206  }
207  else
208  {
209  /* Unless the IRP was queued, always free the IRP context */
210  VfatFreeIrpContext(IrpContext);
211  }
212  }
213 
215 
216  return Status;
217 }
218 
219 VOID
220 NTAPI
222  IN PVOID IrpContext,
223  IN PVOID Unused)
224 {
226 }
227 
228 NTSTATUS
229 NTAPI
232  IN PIRP Irp)
233 {
235  PVFAT_IRP_CONTEXT IrpContext;
236 
237  DPRINT("VfatBuildRequest (DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
238 
240  ASSERT(Irp);
241 
242  IrpContext = VfatAllocateIrpContext(DeviceObject, Irp);
243  if (IrpContext == NULL)
244  {
246  Irp->IoStatus.Status = Status;
248  }
249  else
250  {
251  Status = VfatDispatchRequest(IrpContext);
252  }
253  return Status;
254 }
255 
256 static
257 VOID
259  PVFAT_IRP_CONTEXT IrpContext)
260 {
261  ASSERT(IrpContext);
262  ExFreeToNPagedLookasideList(&VfatGlobalData->IrpContextLookasideList, IrpContext);
263 }
264 
265 static
269  PIRP Irp)
270 {
271  PVFAT_IRP_CONTEXT IrpContext;
272  /*PIO_STACK_LOCATION Stack;*/
273  UCHAR MajorFunction;
274 
275  DPRINT("VfatAllocateIrpContext(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
276 
278  ASSERT(Irp);
279 
280  IrpContext = ExAllocateFromNPagedLookasideList(&VfatGlobalData->IrpContextLookasideList);
281  if (IrpContext)
282  {
283  RtlZeroMemory(IrpContext, sizeof(VFAT_IRP_CONTEXT));
284  IrpContext->Irp = Irp;
285  IrpContext->DeviceObject = DeviceObject;
286  IrpContext->DeviceExt = DeviceObject->DeviceExtension;
287  IrpContext->Stack = IoGetCurrentIrpStackLocation(Irp);
288  ASSERT(IrpContext->Stack);
289  MajorFunction = IrpContext->MajorFunction = IrpContext->Stack->MajorFunction;
290  IrpContext->MinorFunction = IrpContext->Stack->MinorFunction;
291  IrpContext->FileObject = IrpContext->Stack->FileObject;
292  IrpContext->Flags = IRPCONTEXT_COMPLETE;
293 
294  /* Easy cases that can wait */
295  if (MajorFunction == IRP_MJ_CLEANUP ||
296  MajorFunction == IRP_MJ_CREATE ||
297  MajorFunction == IRP_MJ_SHUTDOWN ||
298  MajorFunction == IRP_MJ_CLOSE /* likely to be fixed */)
299  {
300  SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
301  }
302  /* Cases that can wait if synchronous IRP */
303  else if ((MajorFunction == IRP_MJ_DEVICE_CONTROL ||
304  MajorFunction == IRP_MJ_QUERY_INFORMATION ||
305  MajorFunction == IRP_MJ_SET_INFORMATION ||
306  MajorFunction == IRP_MJ_FLUSH_BUFFERS ||
307  MajorFunction == IRP_MJ_LOCK_CONTROL ||
308  MajorFunction == IRP_MJ_QUERY_VOLUME_INFORMATION ||
309  MajorFunction == IRP_MJ_SET_VOLUME_INFORMATION ||
310  MajorFunction == IRP_MJ_DIRECTORY_CONTROL ||
311  MajorFunction == IRP_MJ_WRITE ||
312  MajorFunction == IRP_MJ_READ) &&
314  {
315  SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
316  }
317  /* Cases that can wait if synchronous or if no FO */
318  else if ((MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL ||
319  MajorFunction == IRP_MJ_PNP) &&
322  {
323  SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
324  }
325 
327  IrpContext->RefCount = 0;
328  IrpContext->PriorityBoost = IO_NO_INCREMENT;
329  }
330  return IrpContext;
331 }
332 
333 static WORKER_THREAD_ROUTINE VfatDoRequest;
334 
335 static
336 VOID
337 NTAPI
339  PVOID IrpContext)
340 {
342  DPRINT("VfatDoRequest(IrpContext %p), MajorFunction %x, %d\n",
343  IrpContext, ((PVFAT_IRP_CONTEXT)IrpContext)->MajorFunction, QueueCount);
345 }
346 
347 static
348 NTSTATUS
350  PVFAT_IRP_CONTEXT IrpContext)
351 {
353  DPRINT("VfatQueueRequest(IrpContext %p), %d\n", IrpContext, QueueCount);
354 
355  ASSERT(IrpContext != NULL);
356  ASSERT(IrpContext->Irp != NULL);
357  ASSERT(!(IrpContext->Flags & IRPCONTEXT_QUEUE) &&
358  (IrpContext->Flags & IRPCONTEXT_COMPLETE));
359 
360  IrpContext->Flags |= IRPCONTEXT_CANWAIT;
361  IoMarkIrpPending(IrpContext->Irp);
362  ExInitializeWorkItem(&IrpContext->WorkQueueItem, VfatDoRequest, IrpContext);
364  return STATUS_PENDING;
365 }
366 
367 PVOID
369  IN PIRP Irp,
370  IN BOOLEAN Paging)
371 {
372  ASSERT(Irp);
373 
374  if (Irp->MdlAddress)
375  {
376  return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, (Paging ? HighPagePriority : NormalPagePriority));
377  }
378  else
379  {
380  return Irp->UserBuffer;
381  }
382 }
383 
384 NTSTATUS
386  IN PIRP Irp,
387  IN ULONG Length,
389 {
390  ASSERT(Irp);
391 
392  if (Irp->MdlAddress)
393  {
394  return STATUS_SUCCESS;
395  }
396 
397  IoAllocateMdl(Irp->UserBuffer, Length, FALSE, FALSE, Irp);
398 
399  if (!Irp->MdlAddress)
400  {
402  }
403 
404  _SEH2_TRY
405  {
406  MmProbeAndLockPages(Irp->MdlAddress, Irp->RequestorMode, Operation);
407  }
409  {
410  IoFreeMdl(Irp->MdlAddress);
411  Irp->MdlAddress = NULL;
413  }
414  _SEH2_END;
415 
416  return STATUS_SUCCESS;
417 }
418 
419 BOOLEAN
421  IN PDEVICE_EXTENSION DeviceExt,
422  IN BOOLEAN Force)
423 {
424  KIRQL OldIrql;
425  ULONG UnCleanCount;
426  PVPB Vpb;
427  BOOLEAN Delete;
428 
429  DPRINT1("VfatCheckForDismount(%p, %u)\n", DeviceExt, Force);
430 
431  /* If the VCB is OK (not under uninitialization) and we don't force dismount, do nothing */
432  if (BooleanFlagOn(DeviceExt->Flags, VCB_GOOD) && !Force)
433  {
434  return FALSE;
435  }
436 
437  /*
438  * NOTE: In their *CheckForDismount() function, our 3rd-party FS drivers
439  * as well as MS' fastfat, perform a comparison check of the current VCB's
440  * VPB ReferenceCount with some sort of "dangling"/"residual" open count,
441  * depending on whether or not we are in IRP_MJ_CREATE.
442  * It seems to be related to the fact that the volume root directory as
443  * well as auxiliary data stream(s) are still opened, and only these are
444  * allowed to be opened at that moment. After analysis it appears that for
445  * the ReactOS' fastfat, this number is equal to "2".
446  */
447  UnCleanCount = 2;
448 
449  /* Lock VPB */
451 
452  /* Reference it and check if a create is being done */
453  Vpb = DeviceExt->IoVPB;
454  DPRINT("Vpb->ReferenceCount = %d\n", Vpb->ReferenceCount);
455  if (Vpb->ReferenceCount != UnCleanCount || DeviceExt->OpenHandleCount != 0)
456  {
457  /* If we force-unmount, copy the VPB to our local own to prepare later dismount */
458  if (Force && Vpb->RealDevice->Vpb == Vpb && DeviceExt->SpareVPB != NULL)
459  {
460  RtlZeroMemory(DeviceExt->SpareVPB, sizeof(VPB));
461  DeviceExt->SpareVPB->Type = IO_TYPE_VPB;
462  DeviceExt->SpareVPB->Size = sizeof(VPB);
463  DeviceExt->SpareVPB->RealDevice = DeviceExt->IoVPB->RealDevice;
464  DeviceExt->SpareVPB->DeviceObject = NULL;
465  DeviceExt->SpareVPB->Flags = DeviceExt->IoVPB->Flags & VPB_REMOVE_PENDING;
466  DeviceExt->IoVPB->RealDevice->Vpb = DeviceExt->SpareVPB;
467  DeviceExt->SpareVPB = NULL;
468  DeviceExt->IoVPB->Flags |= VPB_PERSISTENT;
469 
470  /* We are uninitializing, the VCB cannot be used anymore */
471  ClearFlag(DeviceExt->Flags, VCB_GOOD);
472  }
473 
474  /* Don't do anything for now */
475  Delete = FALSE;
476  }
477  else
478  {
479  /* Otherwise, delete the volume */
480  Delete = TRUE;
481 
482  /* Swap the VPB with our local own */
483  if (Vpb->RealDevice->Vpb == Vpb && DeviceExt->SpareVPB != NULL)
484  {
485  RtlZeroMemory(DeviceExt->SpareVPB, sizeof(VPB));
486  DeviceExt->SpareVPB->Type = IO_TYPE_VPB;
487  DeviceExt->SpareVPB->Size = sizeof(VPB);
488  DeviceExt->SpareVPB->RealDevice = DeviceExt->IoVPB->RealDevice;
489  DeviceExt->SpareVPB->DeviceObject = NULL;
490  DeviceExt->SpareVPB->Flags = DeviceExt->IoVPB->Flags & VPB_REMOVE_PENDING;
491  DeviceExt->IoVPB->RealDevice->Vpb = DeviceExt->SpareVPB;
492  DeviceExt->SpareVPB = NULL;
493  DeviceExt->IoVPB->Flags |= VPB_PERSISTENT;
494 
495  /* We are uninitializing, the VCB cannot be used anymore */
496  ClearFlag(DeviceExt->Flags, VCB_GOOD);
497  }
498 
499  /*
500  * We defer setting the VPB's DeviceObject to NULL for later because
501  * we want to handle the closing of the internal opened meta-files.
502  */
503 
504  /* Clear the mounted and locked flags in the VPB */
505  ClearFlag(Vpb->Flags, VPB_MOUNTED | VPB_LOCKED);
506  }
507 
508  /* Release lock and return status */
510 
511  /* If we were to delete, delete volume */
512  if (Delete)
513  {
514  LARGE_INTEGER Zero = {{0,0}};
515  PVFATFCB Fcb;
516 
517  /* We are uninitializing, the VCB cannot be used anymore */
518  ClearFlag(DeviceExt->Flags, VCB_GOOD);
519 
520  /* Invalidate and close the internal opened meta-files */
521  if (DeviceExt->RootFcb)
522  {
523  Fcb = DeviceExt->RootFcb;
525  &Zero,
526  NULL);
528  DeviceExt->RootFcb = NULL;
530  }
531  if (DeviceExt->VolumeFcb)
532  {
533  Fcb = DeviceExt->VolumeFcb;
534 #ifndef VOLUME_IS_NOT_CACHED_WORK_AROUND_IT
536  &Zero,
537  NULL);
539 #endif
540  DeviceExt->VolumeFcb = NULL;
542  }
543  if (DeviceExt->FATFileObject)
544  {
545  Fcb = DeviceExt->FATFileObject->FsContext;
546  CcUninitializeCacheMap(DeviceExt->FATFileObject,
547  &Zero,
548  NULL);
549  DeviceExt->FATFileObject->FsContext = NULL;
550  ObDereferenceObject(DeviceExt->FATFileObject);
551  DeviceExt->FATFileObject = NULL;
553  }
554 
555  /*
556  * Now that the closing of the internal opened meta-files has been
557  * handled, we can now set the VPB's DeviceObject to NULL.
558  */
559  Vpb->DeviceObject = NULL;
560 
561  /* If we have a local VPB, we'll have to delete it
562  * but we won't dismount us - something went bad before
563  */
564  if (DeviceExt->SpareVPB)
565  {
566  ExFreePool(DeviceExt->SpareVPB);
567  }
568  /* Otherwise, delete any of the available VPB if its reference count is zero */
569  else if (DeviceExt->IoVPB->ReferenceCount == 0)
570  {
571  ExFreePool(DeviceExt->IoVPB);
572  }
573 
574  /* Remove the volume from the list */
576  RemoveEntryList(&DeviceExt->VolumeListEntry);
578 
579  /* Uninitialize the notify synchronization object */
580  FsRtlNotifyUninitializeSync(&DeviceExt->NotifySync);
581 
582  /* Release resources */
583  ExFreePoolWithTag(DeviceExt->Statistics, TAG_STATS);
584  ExDeleteResourceLite(&DeviceExt->DirResource);
585  ExDeleteResourceLite(&DeviceExt->FatResource);
586 
587  /* Dismount our device if possible */
588  ObDereferenceObject(DeviceExt->StorageDevice);
589  IoDeleteDevice(DeviceExt->VolumeDevice);
590  }
591 
592  return Delete;
593 }
NTSTATUS VfatCreate(PVFAT_IRP_CONTEXT IrpContext)
Definition: create.c:1088
FILE_LOCK FileLock
Definition: fatstruc.h:1070
_Must_inspect_result_ typedef _In_ PVOID Unused
Definition: iotypes.h:1149
#define IN
Definition: typedefs.h:39
const char * MajorFunctionNames[]
Definition: misc.c:19
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define FsRtlEnterFileSystem
#define IRP_MJ_FLUSH_BUFFERS
#define FsRtlExitFileSystem
Definition: vfat.h:441
#define IRPCONTEXT_COMPLETE
Definition: vfat.h:570
PFILE_OBJECT FileObject
Definition: ntfs.h:516
PDEVICE_EXTENSION DeviceExt
Definition: vfat.h:579
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
static NTSTATUS VfatDeviceControl(IN PVFAT_IRP_CONTEXT IrpContext)
Definition: misc.c:93
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
static PVFAT_IRP_CONTEXT VfatAllocateIrpContext(PDEVICE_OBJECT, PIRP)
Definition: misc.c:267
NTSTATUS VfatCleanup(PVFAT_IRP_CONTEXT IrpContext)
Definition: cleanup.c:177
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define IRP_MJ_MAXIMUM_FUNCTION
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS VfatQueryVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
Definition: volume.c:431
#define IRP_MJ_SET_VOLUME_INFORMATION
static VOID VfatFreeIrpContext(PVFAT_IRP_CONTEXT)
Definition: misc.c:258
NTSTATUS NTAPI VfatBuildRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: misc.c:230
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
FORCEINLINE BOOLEAN vfatFCBIsDirectory(PVFATFCB FCB)
Definition: vfat.h:631
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
Definition: volume.c:1209
PVPB Vpb
Definition: cdstruc.h:517
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define VPB_PERSISTENT
Definition: iotypes.h:1789
static WORKER_THREAD_ROUTINE VfatDoRequest
Definition: misc.c:333
BOOLEAN NTAPI IoIsOperationSynchronous(IN PIRP Irp)
Definition: irp.c:1882
NPAGED_LOOKASIDE_LIST IrpContextLookasideList
Definition: vfat.h:413
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
PFILE_OBJECT FileObject
Definition: vfat.h:585
VOID CompleteIrp(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: pnp.c:12
_SEH2_TRY
Definition: create.c:4226
ULONG RefCount
Definition: vfat.h:586
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
UCHAR KIRQL
Definition: env_spec_w32.h:591
static NTSTATUS VfatQueueRequest(PVFAT_IRP_CONTEXT)
Definition: misc.c:349
CCHAR PriorityBoost
Definition: vfat.h:588
NTSTATUS VfatSetInformation(PVFAT_IRP_CONTEXT IrpContext)
Definition: finfo.c:1563
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define VPB_LOCKED
Definition: iotypes.h:1788
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
KEVENT Event
Definition: vfat.h:587
#define IRPCONTEXT_QUEUE
Definition: vfat.h:571
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS VfatQueryInformation(PVFAT_IRP_CONTEXT IrpContext)
Definition: finfo.c:1436
#define IRPCONTEXT_CANWAIT
Definition: vfat.h:569
static NTSTATUS VfatDispatchRequest(IN PVFAT_IRP_CONTEXT IrpContext)
Definition: misc.c:105
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
PVOID VfatGetUserBuffer(IN PIRP Irp, IN BOOLEAN Paging)
Definition: misc.c:368
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
#define VPB_REMOVE_PENDING
Definition: ntifs_ex.h:428
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
PDEVICE_OBJECT DeviceObject
Definition: vfat.h:406
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IRP_MJ_FILE_SYSTEM_CONTROL
NTSTATUS VfatClose(PVFAT_IRP_CONTEXT IrpContext)
Definition: close.c:213
VOID vfatDestroyFCB(PVFATFCB pFCB)
Definition: fcb.c:269
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_DRIVER_INTERNAL_ERROR
Definition: udferr_usr.h:177
unsigned char UCHAR
Definition: xmlstorage.h:181
static NTSTATUS VfatLockControl(IN PVFAT_IRP_CONTEXT IrpContext)
Definition: misc.c:62
#define VCB_GOOD
Definition: vfat.h:247
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
Status
Definition: gdiplustypes.h:24
#define InterlockedDecrement
Definition: armddk.h:52
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
NTSTATUS VfatFlush(PVFAT_IRP_CONTEXT IrpContext)
Definition: flush.c:149
UCHAR MinorFunction
Definition: vfat.h:584
NTSTATUS VfatSetVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
Definition: volume.c:510
BOOLEAN VfatCheckForDismount(IN PDEVICE_EXTENSION DeviceExt, IN BOOLEAN Force)
Definition: misc.c:420
NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext)
Definition: fsctl.c:1390
#define IO_TYPE_VPB
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
struct _VFATFCB * PVFATFCB
struct _VPB VPB
NTSTATUS NTAPI FsRtlProcessFileLock(IN PFILE_LOCK FileLock, IN PIRP Irp, IN PVOID Context OPTIONAL)
Definition: filelock.c:1153
#define TAG_STATS
Definition: vfat.h:544
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
PVFAT_GLOBAL_DATA VfatGlobalData
Definition: iface.c:40
NTSTATUS VfatDirectoryControl(PVFAT_IRP_CONTEXT IrpContext)
Definition: dir.c:728
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:3148
_SEH2_END
Definition: create.c:4400
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InterlockedIncrement
Definition: armddk.h:53
NTSTATUS VfatPnp(PVFAT_IRP_CONTEXT IrpContext)
Definition: pnp.c:20
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
enum _LOCK_OPERATION LOCK_OPERATION
NTSTATUS VfatRead(PVFAT_IRP_CONTEXT IrpContext)
Definition: rw.c:710
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:286
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
PDEVICE_OBJECT DeviceObject
Definition: vfat.h:578
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
UCHAR MajorFunction
Definition: vfat.h:583
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
Definition: fatprocs.h:411
#define DPRINT1
Definition: precomp.h:8
#define IRP_MJ_READ
Definition: rdpdr.c:46
ERESOURCE VolumeListLock
Definition: vfat.h:409
#define IRP_MJ_CLEANUP
Definition: iotypes.h:168
VOID NTAPI VfatHandleDeferredWrite(IN PVOID IrpContext, IN PVOID Unused)
Definition: misc.c:221
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
ULONG Flags
Definition: vfat.h:580
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
VOID NTAPI FsRtlNotifyUninitializeSync(IN PNOTIFY_SYNC *NotifySync)
Definition: notify.c:1639
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_In_ PFCB Fcb
Definition: cdprocs.h:159
PIO_STACK_LOCATION Stack
Definition: vfat.h:582
return STATUS_SUCCESS
Definition: btrfs.c:3014
NTSTATUS VfatLockUserBuffer(IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation)
Definition: misc.c:385
IoMarkIrpPending(Irp)
#define VPB_MOUNTED
Definition: iotypes.h:1787
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
NTSTATUS VfatWrite(PVFAT_IRP_CONTEXT *pIrpContext)
Definition: rw.c:875
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
Definition: volume.c:1220
static LONG QueueCount
Definition: misc.c:52
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1673
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
WORK_QUEUE_ITEM WorkQueueItem
Definition: vfat.h:581
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
_Inout_ PVCB _In_ BOOLEAN Force
Definition: cdprocs.h:1415