From a6b8f0a3534bed6cd43043c86ea75b42ecc42c70 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 16 May 2013 21:21:46 +0000 Subject: [PATCH] [FASTFAT] Allow only readonly, hidden, system and archive files attributes to be set for existing files. Other file attributes must be ignored. This fixes several tests. svn path=/trunk/; revision=59022 --- reactos/drivers/filesystems/fastfat/create.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat/create.c b/reactos/drivers/filesystems/fastfat/create.c index 825facd3717..5f782d4a8bb 100644 --- a/reactos/drivers/filesystems/fastfat/create.c +++ b/reactos/drivers/filesystems/fastfat/create.c @@ -426,6 +426,7 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) BOOLEAN Dots; UNICODE_STRING FileNameU; UNICODE_STRING PathNameU; + ULONG Attributes; /* Unpack the various parameters. */ Stack = IoGetCurrentIrpStackLocation (Irp); @@ -436,6 +437,9 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) FileObject = Stack->FileObject; DeviceExt = DeviceObject->DeviceExtension; + Attributes = Stack->Parameters.Create.FileAttributes; + Attributes &= (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE); + /* Check their validity. */ if (RequestedOptions & FILE_DIRECTORY_FILE && RequestedDisposition == FILE_SUPERSEDE) @@ -544,10 +548,6 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) RequestedDisposition == FILE_OVERWRITE_IF || RequestedDisposition == FILE_SUPERSEDE) { - ULONG Attributes; - Attributes = Stack->Parameters.Create.FileAttributes; - Attributes &= (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE); - vfatSplitPathName(&PathNameU, NULL, &FileNameU); Status = VfatAddEntry (DeviceExt, &FileNameU, &pFcb, ParentFcb, RequestedOptions, (UCHAR)(Attributes | FILE_ATTRIBUTE_ARCHIVE)); @@ -690,6 +690,8 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) RequestedDisposition == FILE_SUPERSEDE) { ExAcquireResourceExclusiveLite(&(pFcb->MainResource), TRUE); + *pFcb->Attributes = Attributes | FILE_ATTRIBUTE_ARCHIVE; + Status = VfatSetAllocationSizeInformation (FileObject, pFcb, DeviceExt,