From 74c2494bbdf1fd0adc86afed1d9b2f8800c992e4 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Mon, 3 Apr 2017 15:15:13 -0700 Subject: [PATCH] src: dotnet: WIP --- src/dotnet/FileSystem.cs | 48 +++++++++++++++++++++++++++++++++++----- src/dotnet/Interop.cs | 30 ++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/src/dotnet/FileSystem.cs b/src/dotnet/FileSystem.cs index ede1f270..33ecbb1c 100644 --- a/src/dotnet/FileSystem.cs +++ b/src/dotnet/FileSystem.cs @@ -367,10 +367,25 @@ namespace Fsp Boolean ResolveLastPathComponent, out IoStatusBlock PIoStatus, IntPtr Buffer, - out UIntPtr PSize) + ref UIntPtr PSize) + { + return Api.FspFileSystemResolveReparsePoints( + _FileSystem, + GetReparsePointByName, + IntPtr.Zero, + FileName, + ReparsePointIndex, + ResolveLastPathComponent, + out PIoStatus, + Buffer, + ref PSize); + } + protected virtual Int32 GetReparsePointByName( + String FileName, + Boolean IsDirectory, + IntPtr Buffer, + ref UIntPtr PSize) { - PIoStatus = default(IoStatusBlock); - PSize = default(UIntPtr); return STATUS_INVALID_DEVICE_REQUEST; } protected virtual Int32 GetReparsePoint( @@ -897,7 +912,7 @@ namespace Fsp Boolean ResolveLastPathComponent, out IoStatusBlock PIoStatus, IntPtr Buffer, - out UIntPtr PSize) + ref UIntPtr PSize) { FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem); try @@ -908,12 +923,33 @@ namespace Fsp ResolveLastPathComponent, out PIoStatus, Buffer, - out PSize); + ref PSize); } catch (Exception ex) { PIoStatus = default(IoStatusBlock); - PSize = default(UIntPtr); + return self.ExceptionHandler(ex); + } + } + private static Int32 GetReparsePointByName( + IntPtr FileSystem, + IntPtr Context, + String FileName, + Boolean IsDirectory, + IntPtr Buffer, + ref UIntPtr PSize) + { + FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem); + try + { + return self.GetReparsePointByName( + FileName, + IsDirectory, + Buffer, + ref PSize); + } + catch (Exception ex) + { return self.ExceptionHandler(ex); } } diff --git a/src/dotnet/Interop.cs b/src/dotnet/Interop.cs index 94c7ca1c..abfafffb 100644 --- a/src/dotnet/Interop.cs +++ b/src/dotnet/Interop.cs @@ -317,7 +317,7 @@ namespace Fsp.Interop Boolean ResolveLastPathComponent, out IoStatusBlock PIoStatus, IntPtr Buffer, - out UIntPtr PSize); + ref UIntPtr PSize); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate Int32 GetReparsePoint( IntPtr FileSystem, @@ -416,6 +416,24 @@ namespace Fsp.Interop internal static extern Int32 FspFileSystemStopDispatcher( IntPtr FileSystem); [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemFindReparsePoint( + IntPtr FileSystem, + GetReparsePointByName GetReparsePointByName, + IntPtr Context, + [MarshalAs(UnmanagedType.LPWStr)] String FileName, + out UInt32 PReparsePointIndex); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemResolveReparsePoints( + IntPtr FileSystem, + GetReparsePointByName GetReparsePointByName, + IntPtr Context, + [MarshalAs(UnmanagedType.LPWStr)] String FileName, + UInt32 ReparsePointIndex, + Boolean ResolveLastPathComponent, + out IoStatusBlock PIoStatus, + IntPtr Buffer, + ref UIntPtr PSize); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] internal static extern Int32 FspVersion( out UInt32 PVersion); [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] @@ -424,6 +442,16 @@ namespace Fsp.Interop [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] internal static extern UInt32 FspWin32FromNtStatus( Int32 Status); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Int32 GetReparsePointByName( + IntPtr FileSystem, + IntPtr Context, + [MarshalAs(UnmanagedType.LPWStr)] String FileName, + Boolean IsDirectory, + IntPtr Buffer, + ref UIntPtr PSize); + internal static unsafe Int32 FspFileSystemSetMountPointEx( IntPtr FileSystem, String MountPoint,