sys,dll: Cleanup/TruncateOnClose overhaul

This commit is contained in:
Bill Zissimopoulos
2016-12-21 16:09:24 -08:00
parent 8d6314e2db
commit c897ddd864
13 changed files with 203 additions and 69 deletions

View File

@ -195,6 +195,7 @@ static NTSTATUS FspFsvolWriteCached(
{
ASSERT(CanWait);
/* send EndOfFileInformation IRP; this will also set TruncateOnClose, etc. */
EndOfFileInformation.EndOfFile.QuadPart = WriteEndOffset;
Result = FspSendSetInformationIrp(FsvolDeviceObject/* bypass filters */, FileObject,
FileEndOfFileInformation, &EndOfFileInformation, sizeof EndOfFileInformation);
@ -471,11 +472,14 @@ NTSTATUS FspFsvolWriteComplete(
/* update file info */
FspFileNodeSetFileInfo(FileNode, FileObject, &Response->Rsp.Write.FileInfo);
if (OriginalFileSize != Response->Rsp.Write.FileInfo.FileSize)
if (!PagingIo && OriginalFileSize != Response->Rsp.Write.FileInfo.FileSize)
{
FileNode->TruncateOnClose = TRUE;
FspFileNodeNotifyChange(FileNode, FILE_NOTIFY_CHANGE_SIZE, FILE_ACTION_MODIFIED);
}
/* update the current file offset if synchronous I/O (and not paging I/O) */
if (SynchronousIo && !PagingIo)
if (!PagingIo && SynchronousIo)
FileObject->CurrentByteOffset.QuadPart = WriteToEndOfFile ?
Response->Rsp.Write.FileInfo.FileSize :
WriteOffset.QuadPart + Response->IoStatus.Information;