mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
- 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
This commit is contained in:
parent
420ab98250
commit
2229e54a12
1 changed files with 12 additions and 15 deletions
|
@ -442,7 +442,6 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
|
||||||
PVFATFCB ParentFcb;
|
PVFATFCB ParentFcb;
|
||||||
PWCHAR c, last;
|
PWCHAR c, last;
|
||||||
BOOLEAN PagingFileCreate = FALSE;
|
BOOLEAN PagingFileCreate = FALSE;
|
||||||
LARGE_INTEGER AllocationSize;
|
|
||||||
BOOLEAN Dots;
|
BOOLEAN Dots;
|
||||||
UNICODE_STRING FileNameU;
|
UNICODE_STRING FileNameU;
|
||||||
UNICODE_STRING PathNameU;
|
UNICODE_STRING PathNameU;
|
||||||
|
@ -565,9 +564,9 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
if (RequestedDisposition == FILE_CREATE ||
|
if (RequestedDisposition == FILE_CREATE ||
|
||||||
RequestedDisposition == FILE_OPEN_IF ||
|
RequestedDisposition == FILE_OPEN_IF ||
|
||||||
RequestedDisposition == FILE_OVERWRITE_IF ||
|
RequestedDisposition == FILE_OVERWRITE_IF ||
|
||||||
RequestedDisposition == FILE_SUPERSEDE)
|
RequestedDisposition == FILE_SUPERSEDE)
|
||||||
{
|
{
|
||||||
ULONG Attributes;
|
ULONG Attributes;
|
||||||
Attributes = Stack->Parameters.Create.FileAttributes;
|
Attributes = Stack->Parameters.Create.FileAttributes;
|
||||||
|
@ -586,7 +585,6 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = FILE_CREATED;
|
Irp->IoStatus.Information = FILE_CREATED;
|
||||||
|
|
||||||
VfatSetAllocationSizeInformation(FileObject,
|
VfatSetAllocationSizeInformation(FileObject,
|
||||||
pFcb,
|
pFcb,
|
||||||
DeviceExt,
|
DeviceExt,
|
||||||
|
@ -691,13 +689,15 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
|
||||||
|
|
||||||
|
|
||||||
if (RequestedDisposition == FILE_OVERWRITE ||
|
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,
|
Status = VfatSetAllocationSizeInformation (FileObject,
|
||||||
pFcb,
|
pFcb,
|
||||||
DeviceExt,
|
DeviceExt,
|
||||||
&AllocationSize);
|
&Irp->Overlay.AllocationSize);
|
||||||
|
ExReleaseResourceLite(&(pFcb->MainResource));
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
VfatCloseFile (DeviceExt, FileObject);
|
VfatCloseFile (DeviceExt, FileObject);
|
||||||
|
@ -705,15 +705,12 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Supersede the file */
|
|
||||||
if (RequestedDisposition == FILE_SUPERSEDE)
|
if (RequestedDisposition == FILE_SUPERSEDE)
|
||||||
{
|
{
|
||||||
AllocationSize.QuadPart = 0;
|
|
||||||
VfatSetAllocationSizeInformation(FileObject, pFcb, DeviceExt, &AllocationSize);
|
|
||||||
Irp->IoStatus.Information = FILE_SUPERSEDED;
|
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;
|
Irp->IoStatus.Information = FILE_OVERWRITTEN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue