mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[FASTFAT]
Misc fixes: - Only set file attributes if they changed - Fail to set attributes if directory attribute is asked for a file - Perform file attributes setting before dates to allow safe fail svn path=/trunk/; revision=75917
This commit is contained in:
parent
d8753f3e88
commit
8e33b21e34
1 changed files with 30 additions and 12 deletions
|
@ -165,6 +165,36 @@ VfatSetBasicInformation(
|
|||
/* Check volume label bit */
|
||||
ASSERT(0 == (*FCB->Attributes & _A_VOLID));
|
||||
|
||||
if (BasicInfo->FileAttributes != 0)
|
||||
{
|
||||
UCHAR Attributes;
|
||||
|
||||
Attributes = (BasicInfo->FileAttributes & (FILE_ATTRIBUTE_ARCHIVE |
|
||||
FILE_ATTRIBUTE_SYSTEM |
|
||||
FILE_ATTRIBUTE_HIDDEN |
|
||||
FILE_ATTRIBUTE_DIRECTORY |
|
||||
FILE_ATTRIBUTE_READONLY));
|
||||
|
||||
if (vfatFCBIsDirectory(FCB))
|
||||
{
|
||||
Attributes |= FILE_ATTRIBUTE_DIRECTORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BooleanFlagOn(BasicInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
DPRINT("Setting directory attribute on a file!\n");
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
if (Attributes != *FCB->Attributes)
|
||||
{
|
||||
*FCB->Attributes = Attributes;
|
||||
DPRINT("Setting attributes 0x%02x\n", *FCB->Attributes);
|
||||
}
|
||||
}
|
||||
|
||||
if (vfatVolumeIsFatX(DeviceExt))
|
||||
{
|
||||
if (BasicInfo->CreationTime.QuadPart != 0 && BasicInfo->CreationTime.QuadPart != -1)
|
||||
|
@ -218,18 +248,6 @@ VfatSetBasicInformation(
|
|||
}
|
||||
}
|
||||
|
||||
if (BasicInfo->FileAttributes)
|
||||
{
|
||||
*FCB->Attributes = (unsigned char)((*FCB->Attributes &
|
||||
(FILE_ATTRIBUTE_DIRECTORY | 0x48)) |
|
||||
(BasicInfo->FileAttributes &
|
||||
(FILE_ATTRIBUTE_ARCHIVE |
|
||||
FILE_ATTRIBUTE_SYSTEM |
|
||||
FILE_ATTRIBUTE_HIDDEN |
|
||||
FILE_ATTRIBUTE_READONLY)));
|
||||
DPRINT("Setting attributes 0x%02x\n", *FCB->Attributes);
|
||||
}
|
||||
|
||||
VfatUpdateEntry(FCB, vfatVolumeIsFatX(DeviceExt));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue