- Update to r53061
[reactos.git] / drivers / filesystems / fastfat / create.c
index 514084e..3a2f5be 100644 (file)
@@ -372,20 +372,6 @@ VfatOpenFile (
                        0,
                        FALSE);
 
-               if (Status == STATUS_VERIFY_REQUIRED)
-
-               {
-                       PDEVICE_OBJECT DeviceToVerify;
-
-                       DPRINT ("Media change detected!\n");
-                       DPRINT ("Device %p\n", DeviceExt->StorageDevice);
-
-                        /* Find the device to verify and reset the thread field to empty value again. */
-                       DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ());
-                       IoSetDeviceToVerify (PsGetCurrentThread (), NULL);
-                       Status = IoVerifyVolume (DeviceToVerify,
-                               FALSE);
-               }
                if (!NT_SUCCESS(Status))
                {
                        DPRINT ("Status %lx\n", Status);
@@ -433,7 +419,6 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
        NTSTATUS Status = STATUS_SUCCESS;
        PDEVICE_EXTENSION DeviceExt;
        ULONG RequestedDisposition, RequestedOptions;
-       PVFATCCB pCcb;
        PVFATFCB pFcb = NULL;
        PVFATFCB ParentFcb = NULL;
        PWCHAR c, last;
@@ -468,9 +453,8 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
        if (FileObject->FileName.Length == 0 &&
                (FileObject->RelatedFileObject == NULL || FileObject->RelatedFileObject->FsContext2 != NULL))
        {
-               if (RequestedDisposition == FILE_CREATE ||
-                       RequestedDisposition == FILE_OVERWRITE_IF ||
-                       RequestedDisposition == FILE_SUPERSEDE)
+               if (RequestedDisposition != FILE_OPEN ||
+                       RequestedDisposition != FILE_OPEN_IF)
                {
                        return(STATUS_ACCESS_DENIED);
                }
@@ -481,16 +465,9 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
                        return(STATUS_NOT_A_DIRECTORY);
                }
 #endif
+
                pFcb = DeviceExt->VolumeFcb;
-               pCcb = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList);
-               if (pCcb == NULL)
-               {
-                       return (STATUS_INSUFFICIENT_RESOURCES);
-               }
-               RtlZeroMemory(pCcb, sizeof(VFATCCB));
-               FileObject->SectionObjectPointer = &pFcb->SectionObjectPointers;
-               FileObject->FsContext = pFcb;
-               FileObject->FsContext2 = pCcb;
+               vfatAttachFCBToFileObject(DeviceExt, pFcb, FileObject);
                pFcb->RefCount++;
 
                Irp->IoStatus.Information = FILE_OPENED;
@@ -568,7 +545,7 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
                    RequestedDisposition == FILE_SUPERSEDE)
                {
                        ULONG Attributes;
-                       Attributes = Stack->Parameters.Create.FileAttributes;
+                       Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL;
 
                        vfatSplitPathName(&PathNameU, NULL, &FileNameU);
                        Status = VfatAddEntry (DeviceExt, &FileNameU, &pFcb, ParentFcb, RequestedOptions,