mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-07 20:42:09 -05:00
sys: FspFsvolQueryDirectoryRetry: early exit when pattern not wild
This commit is contained in:
parent
8ce6836674
commit
c32b1c19c2
@ -463,7 +463,7 @@ static NTSTATUS FspFsvolQueryDirectoryRetry(
|
|||||||
PVOID DirInfoBuffer;
|
PVOID DirInfoBuffer;
|
||||||
ULONG DirInfoSize;
|
ULONG DirInfoSize;
|
||||||
FSP_FSCTL_TRANSACT_REQ *Request = FspIrpRequest(Irp);
|
FSP_FSCTL_TRANSACT_REQ *Request = FspIrpRequest(Irp);
|
||||||
BOOLEAN PassQueryDirectoryPattern, PatternIsFileName;
|
BOOLEAN PassQueryDirectoryPattern, PatternIsWild, PatternIsFileName;
|
||||||
BOOLEAN Success;
|
BOOLEAN Success;
|
||||||
|
|
||||||
ASSERT(FileNode == FileDesc->FileNode);
|
ASSERT(FileNode == FileDesc->FileNode);
|
||||||
@ -520,6 +520,14 @@ static NTSTATUS FspFsvolQueryDirectoryRetry(
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if the pattern does not contain wildcards and we already returned a result, bail now! */
|
||||||
|
PatternIsWild = FsRtlDoesNameContainWildCards(&FileDesc->DirectoryPattern);
|
||||||
|
if (!PatternIsWild && FileDesc->DirectoryHasSuchFile)
|
||||||
|
{
|
||||||
|
FspFileNodeRelease(FileNode, Full);
|
||||||
|
return STATUS_NO_MORE_FILES;
|
||||||
|
}
|
||||||
|
|
||||||
/* see if the required information is still in the cache and valid! */
|
/* see if the required information is still in the cache and valid! */
|
||||||
if (FspFileNodeReferenceDirInfo(FileNode, &DirInfoBuffer, &DirInfoSize))
|
if (FspFileNodeReferenceDirInfo(FileNode, &DirInfoBuffer, &DirInfoSize))
|
||||||
{
|
{
|
||||||
@ -545,19 +553,10 @@ static NTSTATUS FspFsvolQueryDirectoryRetry(
|
|||||||
|
|
||||||
/* special handling when pattern is filename */
|
/* special handling when pattern is filename */
|
||||||
PatternIsFileName = FsvolDeviceExtension->VolumeParams.PassQueryDirectoryFileName &&
|
PatternIsFileName = FsvolDeviceExtension->VolumeParams.PassQueryDirectoryFileName &&
|
||||||
!FsRtlDoesNameContainWildCards(&FileDesc->DirectoryPattern);
|
!PatternIsWild;
|
||||||
PassQueryDirectoryPattern = PatternIsFileName ||
|
PassQueryDirectoryPattern = PatternIsFileName ||
|
||||||
(FsvolDeviceExtension->VolumeParams.PassQueryDirectoryPattern &&
|
(FsvolDeviceExtension->VolumeParams.PassQueryDirectoryPattern &&
|
||||||
FspFileDescDirectoryPatternMatchAll != FileDesc->DirectoryPattern.Buffer);
|
FspFileDescDirectoryPatternMatchAll != FileDesc->DirectoryPattern.Buffer);
|
||||||
if (PatternIsFileName &&
|
|
||||||
0 != FileDesc->DirectoryMarker.Buffer &&
|
|
||||||
0 == FspFileNameCompare(&FileDesc->DirectoryPattern, &FileDesc->DirectoryMarker,
|
|
||||||
!FileDesc->CaseSensitive, 0))
|
|
||||||
{
|
|
||||||
FspFileNodeRelease(FileNode, Full);
|
|
||||||
return !FileDesc->DirectoryHasSuchFile ?
|
|
||||||
STATUS_NO_SUCH_FILE : STATUS_NO_MORE_FILES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* probe and lock the user buffer */
|
/* probe and lock the user buffer */
|
||||||
Result = FspLockUserBuffer(Irp, Length, IoWriteAccess);
|
Result = FspLockUserBuffer(Irp, Length, IoWriteAccess);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user