IoCreateFile(): Filled in Irp->Flags; not needed
[reactos.git] / ntoskrnl / io / create.c
index cf0553d..557ef37 100644 (file)
@@ -409,6 +409,12 @@ IoCreateFile(OUT   PHANDLE                 FileHandle,
        return (STATUS_UNSUCCESSFUL);
      }
      
+#ifdef LIBCAPTIVE
+   /* Is it needed? What it means? It was seen in NT-5.1sp1 as
+    *  IRP_DEFER_IO_COMPLETION | IRP_CREATE_OPERATION | IRP_SYNCHRONOUS_API
+    */
+   Irp->Flags = IRP_SYNCHRONOUS_API;
+#endif /* LIBCAPTIVE */
    Irp->UserIosb = &IoSB;   //return iostatus
    Irp->AssociatedIrp.SystemBuffer = EaBuffer;
    Irp->Tail.Overlay.AuxiliaryBuffer = (PCHAR)ExtraCreateParameters;
@@ -418,6 +424,8 @@ IoCreateFile(OUT    PHANDLE                 FileHandle,
    {
       Irp->Overlay.AllocationSize = *AllocationSize;
    }
+   /* Is it needed? What it means? It was seen in NT-5.1sp1 */
+   Irp->Tail.Overlay.OriginalFileObject = FileObject;
    
    /*
     * Get the stack location for the new
@@ -451,6 +459,34 @@ IoCreateFile(OUT   PHANDLE                 FileHandle,
    StackLoc->Parameters.Create.ShareAccess = ShareAccess;
    StackLoc->Parameters.Create.EaLength = EaLength;
    
+#ifdef LIBCAPTIVE
+   /* Needed from libcaptive/client/init.c/dismount_volume()
+    * as we cannot pass just "\Devicename" as it would open the device
+    * itself instead of the filesystem; If passed "\Devicename\", the
+    * trailing '\' will remain in RemainingPath and such open will not
+    * be the VolumeOpen type we need for unmount.
+    */
+   if (FileObject->FileName.Length==13*2
+       && FileObject->FileName.Buffer[ 0]==L'\\'
+       && FileObject->FileName.Buffer[ 1]==L'!'
+       && FileObject->FileName.Buffer[ 2]==L'C'
+       && FileObject->FileName.Buffer[ 3]==L'a'
+       && FileObject->FileName.Buffer[ 4]==L'p'
+       && FileObject->FileName.Buffer[ 5]==L't'
+       && FileObject->FileName.Buffer[ 6]==L'i'
+       && FileObject->FileName.Buffer[ 7]==L'v'
+       && FileObject->FileName.Buffer[ 8]==L'e'
+       && FileObject->FileName.Buffer[ 9]==L'!'
+       && FileObject->FileName.Buffer[10]==L'd'
+       && FileObject->FileName.Buffer[11]==L'e'
+       && FileObject->FileName.Buffer[12]==L'l'
+       && FileObject->FileName.Buffer[13]==0)
+     {
+       FileObject->FileName.Length=0;
+       FileObject->FileName.Buffer=NULL;
+     }
+#endif /* LIBCAPTIVE */
+
    /*
     * Now call the driver and 
     * possibly wait if it can