mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-31 06:45:06 -05:00
dll,tst: do not add dot entries for root directory
This commit is contained in:
@@ -1150,15 +1150,20 @@ static NTSTATUS ReadDirectory(FSP_FILE_SYSTEM *FileSystem,
|
||||
Context.PBytesTransferred = PBytesTransferred;
|
||||
Context.OffsetFound = FALSE;
|
||||
|
||||
if (0 == Offset)
|
||||
if (!AddDirInfo(FileNode, L".", Buffer, Length, PBytesTransferred))
|
||||
return STATUS_SUCCESS;
|
||||
if (0 == Offset || FileNode->FileInfo.IndexNumber == Offset)
|
||||
if (L'\0' != FileNode->FileName[1])
|
||||
{
|
||||
Context.OffsetFound = FileNode->FileInfo.IndexNumber == Context.Offset;
|
||||
/* if this is not the root directory add the dot entries */
|
||||
|
||||
if (!AddDirInfo(ParentNode, L"..", Buffer, Length, PBytesTransferred))
|
||||
return STATUS_SUCCESS;
|
||||
if (0 == Offset)
|
||||
if (!AddDirInfo(FileNode, L".", Buffer, Length, PBytesTransferred))
|
||||
return STATUS_SUCCESS;
|
||||
if (0 == Offset || FileNode->FileInfo.IndexNumber == Offset)
|
||||
{
|
||||
Context.OffsetFound = FileNode->FileInfo.IndexNumber == Context.Offset;
|
||||
|
||||
if (!AddDirInfo(ParentNode, L"..", Buffer, Length, PBytesTransferred))
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (MemfsFileNodeMapEnumerateChildren(Memfs->FileNodeMap, FileNode, ReadDirectoryEnumFn, &Context))
|
||||
|
@@ -48,6 +48,33 @@ static void querydir_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout, UL
|
||||
DWORD times[2];
|
||||
times[0] = GetTickCount();
|
||||
|
||||
if (-1 != Flags)
|
||||
{
|
||||
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\*",
|
||||
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||
Handle = FindFirstFileW(FilePath, &FindData);
|
||||
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
||||
|
||||
FileCount = 0;
|
||||
do
|
||||
{
|
||||
ASSERT(
|
||||
0 == mywcscmp(FindData.cFileName, 4, L"file", 4) ||
|
||||
0 == mywcscmp(FindData.cFileName, 3, L"dir", 3));
|
||||
|
||||
FileCount++;
|
||||
|
||||
if (0 < SleepTimeout && 5 == FileCount)
|
||||
Sleep(SleepTimeout);
|
||||
} while (FindNextFileW(Handle, &FindData));
|
||||
ASSERT(ERROR_NO_MORE_FILES == GetLastError());
|
||||
|
||||
ASSERT(110 == FileCount);
|
||||
|
||||
Success = FindClose(Handle);
|
||||
ASSERT(Success);
|
||||
}
|
||||
|
||||
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\dir5\\*",
|
||||
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||
Handle = FindFirstFileW(FilePath, &FindData);
|
||||
|
Reference in New Issue
Block a user