diff --git a/src/dotnet/FileSystemBase.cs b/src/dotnet/FileSystemBase.cs
index 9ffc9564..84ea3dab 100644
--- a/src/dotnet/FileSystemBase.cs
+++ b/src/dotnet/FileSystemBase.cs
@@ -935,6 +935,37 @@ namespace Fsp
StreamAllocationSize = default(UInt64);
return false;
}
+ ///
+ /// Gets directory information for a single file or directory within a parent directory.
+ ///
+ ///
+ /// The file node of the parent directory.
+ ///
+ ///
+ /// The file descriptor of the parent directory.
+ ///
+ ///
+ /// The name of the file or directory to get information for. This name is relative
+ /// to the parent directory and is a single path component.
+ ///
+ ///
+ /// Receives the normalized name from the directory entry.
+ ///
+ ///
+ /// Receives the file information.
+ ///
+ /// STATUS_SUCCESS or error code.
+ public virtual Int32 GetDirInfoByName(
+ Object FileNode,
+ Object FileDesc,
+ String FileName,
+ out String NormalizedName,
+ out FileInfo FileInfo)
+ {
+ NormalizedName = default(String);
+ FileInfo = default(FileInfo);
+ return STATUS_INVALID_DEVICE_REQUEST;
+ }
/* helpers */
///
diff --git a/src/dotnet/FileSystemHost.cs b/src/dotnet/FileSystemHost.cs
index e97023ec..8fb74ec6 100644
--- a/src/dotnet/FileSystemHost.cs
+++ b/src/dotnet/FileSystemHost.cs
@@ -189,6 +189,11 @@ namespace Fsp
get { return 0 != (_VolumeParams.Flags & VolumeParams.PassQueryDirectoryPattern); }
set { _VolumeParams.Flags |= (value ? VolumeParams.PassQueryDirectoryPattern : 0); }
}
+ public Boolean PassQueryDirectoryFileName
+ {
+ get { return 0 != (_VolumeParams.Flags & VolumeParams.PassQueryDirectoryFileName); }
+ set { _VolumeParams.Flags |= (value ? VolumeParams.PassQueryDirectoryFileName : 0); }
+ }
///
/// Gets or sets the prefix for a network file system.
///
@@ -987,6 +992,34 @@ namespace Fsp
return ExceptionHandler(FileSystem, ex);
}
}
+ private static Int32 GetDirInfoByName(
+ IntPtr FileSystemPtr,
+ ref FullContext FullContext,
+ String FileName,
+ out DirInfo DirInfo)
+ {
+ FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
+ try
+ {
+ Object FileNode, FileDesc;
+ String NormalizedName;
+ Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
+ DirInfo = default(DirInfo);
+ Int32 Result = FileSystem.GetDirInfoByName(
+ FileNode,
+ FileDesc,
+ FileName,
+ out NormalizedName,
+ out DirInfo.FileInfo);
+ DirInfo.SetFileNameBuf(NormalizedName);
+ return Result;
+ }
+ catch (Exception ex)
+ {
+ DirInfo = default(DirInfo);
+ return ExceptionHandler(FileSystem, ex);
+ }
+ }
static FileSystemHost()
{
@@ -1014,6 +1047,7 @@ namespace Fsp
_FileSystemInterface.SetReparsePoint = SetReparsePoint;
_FileSystemInterface.DeleteReparsePoint = DeleteReparsePoint;
_FileSystemInterface.GetStreamInfo = GetStreamInfo;
+ _FileSystemInterface.GetDirInfoByName = GetDirInfoByName;
_FileSystemInterfacePtr = Marshal.AllocHGlobal(FileSystemInterface.Size);
Marshal.StructureToPtr(_FileSystemInterface, _FileSystemInterfacePtr, false);
diff --git a/src/dotnet/Interop.cs b/src/dotnet/Interop.cs
index 43eb6ded..43838240 100644
--- a/src/dotnet/Interop.cs
+++ b/src/dotnet/Interop.cs
@@ -42,6 +42,7 @@ namespace Fsp.Interop
internal const UInt32 PostCleanupWhenModifiedOnly = 0x00000400;
internal const UInt32 PassQueryDirectoryPattern = 0x00000800;
internal const UInt32 AlwaysUseDoubleBuffering = 0x00001000;
+ internal const UInt32 PassQueryDirectoryFileName = 0x00002000;
internal const UInt32 UmFileContextIsUserContext2 = 0x00010000;
internal const UInt32 UmFileContextIsFullContext = 0x00020000;
internal const int PrefixSize = 192;
@@ -450,6 +451,12 @@ namespace Fsp.Interop
IntPtr Buffer,
UInt32 Length,
out UInt32 PBytesTransferred);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate Int32 GetDirInfoByName(
+ IntPtr FileSystem,
+ ref FullContext FullContext,
+ [MarshalAs(UnmanagedType.LPWStr)] String FileName,
+ out DirInfo DirInfo);
}
internal static int Size = IntPtr.Size * 64;
@@ -478,7 +485,8 @@ namespace Fsp.Interop
internal Proto.SetReparsePoint SetReparsePoint;
internal Proto.DeleteReparsePoint DeleteReparsePoint;
internal Proto.GetStreamInfo GetStreamInfo;
- /* NTSTATUS (*Reserved[40])(); */
+ internal Proto.GetDirInfoByName GetDirInfoByName;
+ /* NTSTATUS (*Reserved[39])(); */
}
[SuppressUnmanagedCodeSecurity]