From: Hartmut Birr Date: Sun, 27 Nov 2005 15:44:36 +0000 (+0000) Subject: - Lock the MainResource if we overwrite or supersede an existing file. X-Git-Tag: backups/ros-branch-0_2_9@19949~242 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=2229e54a1233ded798ded521b11628d721d0639c - Lock the MainResource if we overwrite or supersede an existing file. - Use given allocation size, if we overwrite or supersede an existing file. svn path=/trunk/; revision=19689 --- diff --git a/reactos/drivers/fs/vfat/create.c b/reactos/drivers/fs/vfat/create.c index c8548f90cb0..1ab211b576a 100644 --- a/reactos/drivers/fs/vfat/create.c +++ b/reactos/drivers/fs/vfat/create.c @@ -442,7 +442,6 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) PVFATFCB ParentFcb; PWCHAR c, last; BOOLEAN PagingFileCreate = FALSE; - LARGE_INTEGER AllocationSize; BOOLEAN Dots; UNICODE_STRING FileNameU; UNICODE_STRING PathNameU; @@ -565,9 +564,9 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) if (!NT_SUCCESS (Status)) { if (RequestedDisposition == FILE_CREATE || - RequestedDisposition == FILE_OPEN_IF || - RequestedDisposition == FILE_OVERWRITE_IF || - RequestedDisposition == FILE_SUPERSEDE) + RequestedDisposition == FILE_OPEN_IF || + RequestedDisposition == FILE_OVERWRITE_IF || + RequestedDisposition == FILE_SUPERSEDE) { ULONG Attributes; Attributes = Stack->Parameters.Create.FileAttributes; @@ -586,7 +585,6 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) } Irp->IoStatus.Information = FILE_CREATED; - VfatSetAllocationSizeInformation(FileObject, pFcb, DeviceExt, @@ -691,13 +689,15 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) if (RequestedDisposition == FILE_OVERWRITE || - RequestedDisposition == FILE_OVERWRITE_IF) + RequestedDisposition == FILE_OVERWRITE_IF || + RequestedDisposition == FILE_SUPERSEDE) { - AllocationSize.QuadPart = 0; + ExAcquireResourceExclusiveLite(&(pFcb->MainResource), TRUE); Status = VfatSetAllocationSizeInformation (FileObject, - pFcb, - DeviceExt, - &AllocationSize); + pFcb, + DeviceExt, + &Irp->Overlay.AllocationSize); + ExReleaseResourceLite(&(pFcb->MainResource)); if (!NT_SUCCESS (Status)) { VfatCloseFile (DeviceExt, FileObject); @@ -705,15 +705,12 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) } } - - /* Supersede the file */ if (RequestedDisposition == FILE_SUPERSEDE) { - AllocationSize.QuadPart = 0; - VfatSetAllocationSizeInformation(FileObject, pFcb, DeviceExt, &AllocationSize); Irp->IoStatus.Information = FILE_SUPERSEDED; } - else if (RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF) + else if (RequestedDisposition == FILE_OVERWRITE || + RequestedDisposition == FILE_OVERWRITE_IF) { Irp->IoStatus.Information = FILE_OVERWRITTEN; }