mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 08:53:01 -05:00
dll,tst: do not add dot entries for root directory
This commit is contained in:
parent
e0b0b1b367
commit
23dadcf8a0
@ -600,7 +600,8 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
|||||||
* Offset within the directory to read from. The kernel does not interpret this value
|
* Offset within the directory to read from. The kernel does not interpret this value
|
||||||
* which is used solely by the file system to locate directory entries. However the
|
* which is used solely by the file system to locate directory entries. However the
|
||||||
* special value 0 indicates that the read should start from the first entries. The first
|
* special value 0 indicates that the read should start from the first entries. The first
|
||||||
* two entries returned by ReadDirectory should always be the "." and ".." entries.
|
* two entries returned by ReadDirectory should always be the "." and ".." entries,
|
||||||
|
* except for the root directory which does not have these entries.
|
||||||
* @param Length
|
* @param Length
|
||||||
* Length of data to read.
|
* Length of data to read.
|
||||||
* @param Pattern
|
* @param Pattern
|
||||||
|
@ -1735,6 +1735,15 @@ static NTSTATUS fsp_fuse_intf_ReadDirectory(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
if (sizeof(struct fsp_fuse_dirinfo) > di->Size)
|
if (sizeof(struct fsp_fuse_dirinfo) > di->Size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if ('/' == filedesc->PosixPath[0] && '\0' == filedesc->PosixPath[1])
|
||||||
|
{
|
||||||
|
/* if this is the root directory do not add the dot entries */
|
||||||
|
|
||||||
|
if ('.' == di->PosixNameBuf[0] && ('\0' == di->PosixNameBuf[1] ||
|
||||||
|
('.' == di->PosixNameBuf[1] && '\0' == di->PosixNameBuf[2])))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!di->FileInfoValid)
|
if (!di->FileInfoValid)
|
||||||
{
|
{
|
||||||
if (0 == PosixPath)
|
if (0 == PosixPath)
|
||||||
|
@ -1150,6 +1150,10 @@ static NTSTATUS ReadDirectory(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
Context.PBytesTransferred = PBytesTransferred;
|
Context.PBytesTransferred = PBytesTransferred;
|
||||||
Context.OffsetFound = FALSE;
|
Context.OffsetFound = FALSE;
|
||||||
|
|
||||||
|
if (L'\0' != FileNode->FileName[1])
|
||||||
|
{
|
||||||
|
/* if this is not the root directory add the dot entries */
|
||||||
|
|
||||||
if (0 == Offset)
|
if (0 == Offset)
|
||||||
if (!AddDirInfo(FileNode, L".", Buffer, Length, PBytesTransferred))
|
if (!AddDirInfo(FileNode, L".", Buffer, Length, PBytesTransferred))
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
@ -1160,6 +1164,7 @@ static NTSTATUS ReadDirectory(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
if (!AddDirInfo(ParentNode, L"..", Buffer, Length, PBytesTransferred))
|
if (!AddDirInfo(ParentNode, L"..", Buffer, Length, PBytesTransferred))
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (MemfsFileNodeMapEnumerateChildren(Memfs->FileNodeMap, FileNode, ReadDirectoryEnumFn, &Context))
|
if (MemfsFileNodeMapEnumerateChildren(Memfs->FileNodeMap, FileNode, ReadDirectoryEnumFn, &Context))
|
||||||
FspFileSystemAddDirInfo(0, Buffer, Length, PBytesTransferred);
|
FspFileSystemAddDirInfo(0, Buffer, Length, PBytesTransferred);
|
||||||
|
@ -48,6 +48,33 @@ static void querydir_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout, UL
|
|||||||
DWORD times[2];
|
DWORD times[2];
|
||||||
times[0] = GetTickCount();
|
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\\*",
|
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\dir5\\*",
|
||||||
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||||
Handle = FindFirstFileW(FilePath, &FindData);
|
Handle = FindFirstFileW(FilePath, &FindData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user