Don't check the share access for directories.
[reactos.git] / reactos / drivers / fs / vfat / create.c
index 800a66a..dbcef14 100644 (file)
@@ -16,8 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id$
- *
+/*
  * PROJECT:          ReactOS kernel
  * FILE:             drivers/fs/vfat/create.c
  * PURPOSE:          VFAT Filesystem
@@ -38,7 +37,7 @@ void  vfat8Dot3ToString (PFAT_DIR_ENTRY pEntry, PUNICODE_STRING NameU)
   USHORT Length;
   CHAR  cString[12];
 
-  RtlCopyMemory(cString, pEntry->Filename, 11);
+  RtlCopyMemory(cString, pEntry->ShortName, 11);
   cString[11] = 0;
   if (cString[0] == 0x05)
     {
@@ -564,7 +563,12 @@ VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
           vfatReleaseFCB (DeviceExt, ParentFcb);
          if (NT_SUCCESS (Status))
            {
-              vfatAttachFCBToFileObject (DeviceExt, pFcb, FileObject);
+              Status = vfatAttachFCBToFileObject (DeviceExt, pFcb, FileObject);
+              if ( !NT_SUCCESS(Status) )
+              {
+                 vfatReleaseFCB (DeviceExt, pFcb);
+                 return Status;
+              }
 
              Irp->IoStatus.Information = FILE_CREATED;
 
@@ -608,7 +612,8 @@ VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
       pFcb = FileObject->FsContext;
 
-      if (pFcb->OpenHandleCount != 0)
+      if (pFcb->OpenHandleCount != 0 &&
+          !(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY))
         {
           Status = IoCheckShareAccess(Stack->Parameters.Create.SecurityContext->DesiredAccess,
                                       Stack->Parameters.Create.ShareAccess,
@@ -690,8 +695,7 @@ VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
       /* Supersede the file */
       if (RequestedDisposition == FILE_SUPERSEDE)
        {
-         LARGE_INTEGER AllocationSize;
-         AllocationSize.QuadPart = 0LL;
+         AllocationSize.QuadPart = 0;
           VfatSetAllocationSizeInformation(FileObject, pFcb, DeviceExt, &AllocationSize);
          Irp->IoStatus.Information = FILE_SUPERSEDED;
        }
@@ -705,7 +709,8 @@ VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
        }
     }
 
-  if (pFcb->OpenHandleCount == 0)
+  if (pFcb->OpenHandleCount == 0 &&
+      !(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY))
   {
       IoSetShareAccess(Stack->Parameters.Create.SecurityContext->DesiredAccess,
                    Stack->Parameters.Create.ShareAccess,