mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-07 20:42:09 -05:00
dotnet: GetDirInfoByName
This commit is contained in:
parent
6430b386da
commit
487d2449fe
@ -935,6 +935,37 @@ namespace Fsp
|
|||||||
StreamAllocationSize = default(UInt64);
|
StreamAllocationSize = default(UInt64);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets directory information for a single file or directory within a parent directory.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="FileNode">
|
||||||
|
/// The file node of the parent directory.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="FileDesc">
|
||||||
|
/// The file descriptor of the parent directory.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="FileName">
|
||||||
|
/// 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.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="NormalizedName">
|
||||||
|
/// Receives the normalized name from the directory entry.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="FileInfo">
|
||||||
|
/// Receives the file information.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>STATUS_SUCCESS or error code.</returns>
|
||||||
|
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 */
|
/* helpers */
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -189,6 +189,11 @@ namespace Fsp
|
|||||||
get { return 0 != (_VolumeParams.Flags & VolumeParams.PassQueryDirectoryPattern); }
|
get { return 0 != (_VolumeParams.Flags & VolumeParams.PassQueryDirectoryPattern); }
|
||||||
set { _VolumeParams.Flags |= (value ? VolumeParams.PassQueryDirectoryPattern : 0); }
|
set { _VolumeParams.Flags |= (value ? VolumeParams.PassQueryDirectoryPattern : 0); }
|
||||||
}
|
}
|
||||||
|
public Boolean PassQueryDirectoryFileName
|
||||||
|
{
|
||||||
|
get { return 0 != (_VolumeParams.Flags & VolumeParams.PassQueryDirectoryFileName); }
|
||||||
|
set { _VolumeParams.Flags |= (value ? VolumeParams.PassQueryDirectoryFileName : 0); }
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the prefix for a network file system.
|
/// Gets or sets the prefix for a network file system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -987,6 +992,34 @@ namespace Fsp
|
|||||||
return ExceptionHandler(FileSystem, ex);
|
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()
|
static FileSystemHost()
|
||||||
{
|
{
|
||||||
@ -1014,6 +1047,7 @@ namespace Fsp
|
|||||||
_FileSystemInterface.SetReparsePoint = SetReparsePoint;
|
_FileSystemInterface.SetReparsePoint = SetReparsePoint;
|
||||||
_FileSystemInterface.DeleteReparsePoint = DeleteReparsePoint;
|
_FileSystemInterface.DeleteReparsePoint = DeleteReparsePoint;
|
||||||
_FileSystemInterface.GetStreamInfo = GetStreamInfo;
|
_FileSystemInterface.GetStreamInfo = GetStreamInfo;
|
||||||
|
_FileSystemInterface.GetDirInfoByName = GetDirInfoByName;
|
||||||
|
|
||||||
_FileSystemInterfacePtr = Marshal.AllocHGlobal(FileSystemInterface.Size);
|
_FileSystemInterfacePtr = Marshal.AllocHGlobal(FileSystemInterface.Size);
|
||||||
Marshal.StructureToPtr(_FileSystemInterface, _FileSystemInterfacePtr, false);
|
Marshal.StructureToPtr(_FileSystemInterface, _FileSystemInterfacePtr, false);
|
||||||
|
@ -42,6 +42,7 @@ namespace Fsp.Interop
|
|||||||
internal const UInt32 PostCleanupWhenModifiedOnly = 0x00000400;
|
internal const UInt32 PostCleanupWhenModifiedOnly = 0x00000400;
|
||||||
internal const UInt32 PassQueryDirectoryPattern = 0x00000800;
|
internal const UInt32 PassQueryDirectoryPattern = 0x00000800;
|
||||||
internal const UInt32 AlwaysUseDoubleBuffering = 0x00001000;
|
internal const UInt32 AlwaysUseDoubleBuffering = 0x00001000;
|
||||||
|
internal const UInt32 PassQueryDirectoryFileName = 0x00002000;
|
||||||
internal const UInt32 UmFileContextIsUserContext2 = 0x00010000;
|
internal const UInt32 UmFileContextIsUserContext2 = 0x00010000;
|
||||||
internal const UInt32 UmFileContextIsFullContext = 0x00020000;
|
internal const UInt32 UmFileContextIsFullContext = 0x00020000;
|
||||||
internal const int PrefixSize = 192;
|
internal const int PrefixSize = 192;
|
||||||
@ -450,6 +451,12 @@ namespace Fsp.Interop
|
|||||||
IntPtr Buffer,
|
IntPtr Buffer,
|
||||||
UInt32 Length,
|
UInt32 Length,
|
||||||
out UInt32 PBytesTransferred);
|
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;
|
internal static int Size = IntPtr.Size * 64;
|
||||||
@ -478,7 +485,8 @@ namespace Fsp.Interop
|
|||||||
internal Proto.SetReparsePoint SetReparsePoint;
|
internal Proto.SetReparsePoint SetReparsePoint;
|
||||||
internal Proto.DeleteReparsePoint DeleteReparsePoint;
|
internal Proto.DeleteReparsePoint DeleteReparsePoint;
|
||||||
internal Proto.GetStreamInfo GetStreamInfo;
|
internal Proto.GetStreamInfo GetStreamInfo;
|
||||||
/* NTSTATUS (*Reserved[40])(); */
|
internal Proto.GetDirInfoByName GetDirInfoByName;
|
||||||
|
/* NTSTATUS (*Reserved[39])(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user