mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-14 15:52:47 -05:00
sys: cached read/write testing
This commit is contained in:
@ -438,33 +438,17 @@ static NTSTATUS Read(FSP_FILE_SYSTEM *FileSystem,
|
||||
|
||||
static NTSTATUS Write(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, PVOID Buffer, UINT64 Offset, ULONG Length, BOOLEAN Constrained,
|
||||
PVOID FileNode0, PVOID Buffer, UINT64 Offset, ULONG Length, BOOLEAN WriteToEndOfFile,
|
||||
PULONG PBytesTransferred, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
|
||||
UINT64 EndOffset;
|
||||
|
||||
if ((UINT64)-1LL == Offset)
|
||||
if (WriteToEndOfFile)
|
||||
Offset = FileNode->FileInfo.FileSize;
|
||||
|
||||
if (Constrained)
|
||||
{
|
||||
if (Offset >= FileNode->FileInfo.FileSize)
|
||||
{
|
||||
*PBytesTransferred = 0;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
EndOffset = Offset + Length;
|
||||
if (EndOffset > FileNode->FileInfo.FileSize)
|
||||
EndOffset = FileNode->FileInfo.FileSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
EndOffset = Offset + Length;
|
||||
if (EndOffset > FileNode->FileInfo.FileSize)
|
||||
SetFileSize(FileSystem, Request, FileNode, EndOffset, FileInfo);
|
||||
}
|
||||
EndOffset = Offset + Length;
|
||||
if (EndOffset > FileNode->FileInfo.FileSize)
|
||||
SetFileSize(FileSystem, Request, FileNode, EndOffset, FileInfo);
|
||||
|
||||
memcpy((PUINT8)FileNode->FileData + Offset, Buffer, EndOffset - Offset);
|
||||
|
||||
|
Reference in New Issue
Block a user