[RDBSS]
authorPierre Schweitzer <pierre@reactos.org>
Fri, 4 Aug 2017 19:23:42 +0000 (19:23 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 4 Aug 2017 19:23:42 +0000 (19:23 +0000)
Implement RxSetDispositionInfo(): this allows deleting files on a remote NFS share!

CORE-8204
CORE-11327
CORE-13636

svn path=/trunk/; revision=75482

reactos/sdk/lib/drivers/rdbsslib/rdbss.c

index 0d1863d..904befe 100644 (file)
@@ -8605,12 +8605,47 @@ RxSetBasicInfo(
     return Status;
 }
 
+/*
+ * @implemented
+ */
 NTSTATUS
 RxSetDispositionInfo(
     PRX_CONTEXT RxContext)
 {
-    UNIMPLEMENTED;
-    return STATUS_NOT_IMPLEMENTED;
+    NTSTATUS Status;
+
+    PAGED_CODE();
+
+    /* First, make the mini-rdr work! */
+    Status = RxpSetInfoMiniRdr(RxContext, FileDispositionInformation);
+    /* If it succeed, we'll keep track of the change */
+    if (NT_SUCCESS(Status))
+    {
+        PFCB Fcb;
+        PFILE_OBJECT FileObject;
+        PFILE_DISPOSITION_INFORMATION FileDispo;
+
+        Fcb = (PFCB)RxContext->pFcb;
+        FileObject = RxContext->CurrentIrpSp->FileObject;
+        FileDispo = RxContext->CurrentIrp->AssociatedIrp.SystemBuffer;
+        /* Caller asks for deletion: mark as delete on close */
+        if (FileDispo->DeleteFile)
+        {
+            SetFlag(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE);
+            FileObject->DeletePending = TRUE;
+        }
+        /* Otherwise, clear it */
+        else
+        {
+            ClearFlag(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE);
+            FileObject->DeletePending = FALSE;
+        }
+
+        /* Sanitize output */
+        Status = STATUS_SUCCESS;
+    }
+
+    return Status;
 }
 
 NTSTATUS