[FASTFAT]
authorThomas Faber <thomas.faber@reactos.org>
Tue, 2 May 2017 19:33:14 +0000 (19:33 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Tue, 2 May 2017 19:33:14 +0000 (19:33 +0000)
- Add support for FILE_DELETE_ON_CLOSE
CORE-6931 #resolve

svn path=/trunk/; revision=74450

reactos/drivers/filesystems/fastfat/cleanup.c
reactos/drivers/filesystems/fastfat/create.c
reactos/drivers/filesystems/fastfat/vfat.h

index 388f43d..07e2eb5 100644 (file)
@@ -24,6 +24,7 @@ VfatCleanupFile(
     PVFAT_IRP_CONTEXT IrpContext)
 {
     PVFATFCB pFcb;
+    PVFATCCB pCcb;
     PDEVICE_EXTENSION DeviceExt = IrpContext->DeviceExt;
     PFILE_OBJECT FileObject = IrpContext->FileObject;
 
@@ -58,6 +59,12 @@ VfatCleanupFile(
             return STATUS_PENDING;
         }
 
+        pCcb = FileObject->FsContext2;
+        if (BooleanFlagOn(pCcb->Flags, CCB_DELETE_ON_CLOSE))
+        {
+            pFcb->Flags |= FCB_DELETE_PENDING;
+        }
+
         /* Notify about the cleanup */
         FsRtlNotifyCleanup(IrpContext->DeviceExt->NotifySync,
                            &(IrpContext->DeviceExt->NotifyList),
index 96f9a18..3635804 100644 (file)
@@ -394,6 +394,7 @@ VfatCreateFile(
     ULONG RequestedDisposition, RequestedOptions;
     PVFATFCB pFcb = NULL;
     PVFATFCB ParentFcb = NULL;
+    PVFATCCB pCcb = NULL;
     PWCHAR c, last;
     BOOLEAN PagingFileCreate;
     BOOLEAN Dots;
@@ -657,6 +658,12 @@ VfatCreateFile(
                 }
             }
 
+            pCcb = FileObject->FsContext2;
+            if (BooleanFlagOn(RequestedOptions, FILE_DELETE_ON_CLOSE))
+            {
+                pCcb->Flags |= CCB_DELETE_ON_CLOSE;
+            }
+
             pFcb->OpenHandleCount++;
             DeviceExt->OpenHandleCount++;
         }
@@ -906,6 +913,12 @@ VfatCreateFile(
                             &pFcb->FCBShareAccess);
     }
 
+    pCcb = FileObject->FsContext2;
+    if (BooleanFlagOn(RequestedOptions, FILE_DELETE_ON_CLOSE))
+    {
+        pCcb->Flags |= CCB_DELETE_ON_CLOSE;
+    }
+
     if (Irp->IoStatus.Information == FILE_CREATED)
     {
         FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
index 7887945..e53ca82 100644 (file)
@@ -486,9 +486,12 @@ typedef struct _VFATFCB
     ULONG LastOffset;
 } VFATFCB, *PVFATFCB;
 
+#define CCB_DELETE_ON_CLOSE     0x0001
+
 typedef struct _VFATCCB
 {
     LARGE_INTEGER  CurrentByteOffset;
+    ULONG Flags;
     /* for DirectoryControl */
     ULONG Entry;
     /* for DirectoryControl */