From 7e1861a9f56a3f76f5719b3ab5005de5ea38f98f Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Tue, 4 Oct 2016 23:00:42 -0700 Subject: [PATCH] tst: memfs: GetSecurityByName: fix FileAttributes for streams on directories --- tst/memfs/memfs.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tst/memfs/memfs.cpp b/tst/memfs/memfs.cpp index 605a7d28..40b363fd 100644 --- a/tst/memfs/memfs.cpp +++ b/tst/memfs/memfs.cpp @@ -418,12 +418,19 @@ static NTSTATUS GetSecurityByName(FSP_FILE_SYSTEM *FileSystem, } #if defined(MEMFS_NAMED_STREAMS) + UINT32 FileAttributesMask = ~0; if (0 != FileNode->MainFileNode) + { + FileAttributesMask = ~FILE_ATTRIBUTE_DIRECTORY; FileNode = FileNode->MainFileNode; -#endif + } + if (0 != PFileAttributes) + *PFileAttributes = FileNode->FileInfo.FileAttributes & FileAttributesMask; +#else if (0 != PFileAttributes) *PFileAttributes = FileNode->FileInfo.FileAttributes; +#endif if (0 != PSecurityDescriptorSize) {