From cb98f711f7c6ea9fdeccccf1cc3ac9e55838fbac Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Fri, 21 Jan 2022 17:54:08 +0000 Subject: [PATCH] tst: ntptfs: fix ea size for NTFS compatibility --- tst/ntptfs/lfs.c | 2 +- tst/ntptfs/ptfs.c | 2 +- tst/ntptfs/ptfs.h | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tst/ntptfs/lfs.c b/tst/ntptfs/lfs.c index 6f9d2678..19544a7c 100644 --- a/tst/ntptfs/lfs.c +++ b/tst/ntptfs/lfs.c @@ -150,7 +150,7 @@ NTSTATUS LfsGetFileInfo( FileInfo->ChangeTime = FileAllInfo.V.BasicInformation.ChangeTime.QuadPart; FileInfo->IndexNumber = FileAllInfo.V.InternalInformation.IndexNumber.QuadPart; FileInfo->HardLinks = 0; - FileInfo->EaSize = FileAllInfo.V.EaInformation.EaSize; + FileInfo->EaSize = LfsGetEaSize(FileAllInfo.V.EaInformation.EaSize); if (0 != OpenFileInfo && OpenFileInfo->NormalizedNameSize > sizeof(WCHAR) + FileAllInfo.V.NameInformation.FileNameLength && diff --git a/tst/ntptfs/ptfs.c b/tst/ntptfs/ptfs.c index fc942920..85acc388 100644 --- a/tst/ntptfs/ptfs.c +++ b/tst/ntptfs/ptfs.c @@ -736,7 +736,7 @@ static inline VOID CopyQueryInfoToDirInfo( DirInfo->FileInfo.IndexNumber = QueryInfo->FileId.QuadPart; DirInfo->FileInfo.HardLinks = 0; DirInfo->FileInfo.EaSize = 0 != (FILE_ATTRIBUTE_REPARSE_POINT & QueryInfo->FileAttributes) ? - 0 : QueryInfo->EaSize; + 0 : LfsGetEaSize(QueryInfo->EaSize); } static NTSTATUS BufferedReadDirectory(FSP_FILE_SYSTEM *FileSystem, diff --git a/tst/ntptfs/ptfs.h b/tst/ntptfs/ptfs.h index 9c8f2f8c..84232d7b 100644 --- a/tst/ntptfs/ptfs.h +++ b/tst/ntptfs/ptfs.h @@ -127,6 +127,11 @@ NTSTATUS LfsFsControlFile( PVOID OutputBuffer, ULONG OutputBufferLength, PULONG PBytesTransferred); +static inline +ULONG LfsGetEaSize(ULONG EaSize) +{ + return 0 != EaSize ? EaSize - 4 : 0; +} /*