diff --git a/src/dotnet/FileSystemBase.cs b/src/dotnet/FileSystemBase.cs index 903f02e1..5325d55c 100644 --- a/src/dotnet/FileSystemBase.cs +++ b/src/dotnet/FileSystemBase.cs @@ -291,7 +291,7 @@ namespace Fsp public virtual Int32 GetReparsePointByName( String FileName, Boolean IsDirectory, - ref Byte[] ReparsePoint) + ref Byte[] ReparseData) { return STATUS_INVALID_DEVICE_REQUEST; } @@ -299,7 +299,7 @@ namespace Fsp Object FileNode, Object FileDesc, String FileName, - ref Byte[] ReparsePoint) + ref Byte[] ReparseData) { return STATUS_INVALID_DEVICE_REQUEST; } @@ -307,7 +307,7 @@ namespace Fsp Object FileNode, Object FileDesc, String FileName, - Byte[] ReparsePoint) + Byte[] ReparseData) { return STATUS_INVALID_DEVICE_REQUEST; } @@ -315,7 +315,7 @@ namespace Fsp Object FileNode, Object FileDesc, String FileName, - Byte[] ReparsePoint) + Byte[] ReparseData) { return STATUS_INVALID_DEVICE_REQUEST; } @@ -425,14 +425,13 @@ namespace Fsp public static UInt32 GetReparseTag( Byte[] ReparseData) { - return 0; + return Api.GetReparseTag(ReparseData); } public static Int32 CanReplaceReparsePoint( Byte[] CurrentReparseData, Byte[] ReplaceReparseData) { - // !!!: NOT IMPLEMENTED - return STATUS_SUCCESS; + return Api.FspFileSystemCanReplaceReparsePoint(CurrentReparseData, ReplaceReparseData); } private static Int32 GetReparsePointByName( IntPtr FileSystem, @@ -445,15 +444,15 @@ namespace Fsp FileSystemBase self = (FileSystemBase)GCHandle.FromIntPtr(Context).Target; try { - Byte[] ReparsePointBytes; + Byte[] ReparseData; Int32 Result; - ReparsePointBytes = null; + ReparseData = null; Result = self.GetReparsePointByName( FileName, IsDirectory, - ref ReparsePointBytes); + ref ReparseData); if (0 <= Result) - Result = Api.CopyReparsePoint(ReparsePointBytes, Buffer, PSize); + Result = Api.CopyReparsePoint(ReparseData, Buffer, PSize); return Result; } diff --git a/src/dotnet/FileSystemHost.cs b/src/dotnet/FileSystemHost.cs index 02a5e0bd..60c15762 100644 --- a/src/dotnet/FileSystemHost.cs +++ b/src/dotnet/FileSystemHost.cs @@ -792,18 +792,18 @@ namespace Fsp FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr); try { - Byte[] ReparsePointBytes; + Byte[] ReparseData; Object FileNode, FileDesc; Int32 Result; Api.GetFullContext(ref FullContext, out FileNode, out FileDesc); - ReparsePointBytes = null; + ReparseData = null; Result = FileSystem.GetReparsePoint( FileNode, FileDesc, FileName, - ref ReparsePointBytes); + ref ReparseData); if (0 <= Result) - Result = Api.CopyReparsePoint(ReparsePointBytes, Buffer, PSize); + Result = Api.CopyReparsePoint(ReparseData, Buffer, PSize); return Result; } catch (Exception ex) diff --git a/src/dotnet/Interop.cs b/src/dotnet/Interop.cs index 6ebee057..149b33ee 100644 --- a/src/dotnet/Interop.cs +++ b/src/dotnet/Interop.cs @@ -620,7 +620,7 @@ namespace Fsp.Interop internal static Proto.FspFileSystemAddDirInfo _FspFileSystemAddDirInfo; internal static Proto.FspFileSystemFindReparsePoint FspFileSystemFindReparsePoint; internal static Proto.FspFileSystemResolveReparsePoints FspFileSystemResolveReparsePoints; - internal static Proto.FspFileSystemCanReplaceReparsePoint FspFileSystemCanReplaceReparsePoint; + internal static Proto.FspFileSystemCanReplaceReparsePoint _FspFileSystemCanReplaceReparsePoint; internal static Proto.FspFileSystemAddStreamInfo FspFileSystemAddStreamInfo; internal static Proto.FspFileSystemAcquireDirectoryBuffer FspFileSystemAcquireDirectoryBuffer; internal static Proto.FspFileSystemFillDirectoryBuffer FspFileSystemFillDirectoryBuffer; @@ -771,18 +771,18 @@ namespace Fsp.Interop } internal unsafe static Int32 CopyReparsePoint( - Byte[] ReparsePointBytes, + Byte[] ReparseData, IntPtr Buffer, IntPtr PSize) { if (IntPtr.Zero != Buffer) { - if (null != ReparsePointBytes) + if (null != ReparseData) { - if (ReparsePointBytes.Length > (int)*(UIntPtr *)PSize) + if (ReparseData.Length > (int)*(UIntPtr *)PSize) return unchecked((Int32)0xc0000023)/*STATUS_BUFFER_TOO_SMALL*/; - *(UIntPtr *)PSize = (UIntPtr)ReparsePointBytes.Length; - Marshal.Copy(ReparsePointBytes, 0, Buffer, ReparsePointBytes.Length); + *(UIntPtr *)PSize = (UIntPtr)ReparseData.Length; + Marshal.Copy(ReparseData, 0, Buffer, ReparseData.Length); } else *(UIntPtr *)PSize = UIntPtr.Zero; @@ -795,13 +795,28 @@ namespace Fsp.Interop { if (IntPtr.Zero != Buffer) { - Byte[] ReparsePointBytes = new Byte[(int)Size]; - Marshal.Copy(Buffer, ReparsePointBytes, 0, ReparsePointBytes.Length); - return ReparsePointBytes; + Byte[] ReparseData = new Byte[(int)Size]; + Marshal.Copy(Buffer, ReparseData, 0, ReparseData.Length); + return ReparseData; } else return null; } + internal unsafe static UInt32 GetReparseTag( + Byte[] ReparseData) + { + return 0; + } + internal unsafe static Int32 FspFileSystemCanReplaceReparsePoint( + Byte[] CurrentReparseData, + Byte[] ReplaceReparseData) + { + fixed (Byte *C = CurrentReparseData) + fixed (Byte *R = ReplaceReparseData) + return _FspFileSystemCanReplaceReparsePoint( + (IntPtr)C, (UIntPtr)CurrentReparseData.Length, + (IntPtr)R, (UIntPtr)ReplaceReparseData.Length); + } internal static Int32 SetDebugLogFile(String FileName) { @@ -874,7 +889,7 @@ namespace Fsp.Interop _FspFileSystemAddDirInfo = GetEntryPoint(Module); FspFileSystemFindReparsePoint = GetEntryPoint(Module); FspFileSystemResolveReparsePoints = GetEntryPoint(Module); - FspFileSystemCanReplaceReparsePoint = GetEntryPoint(Module); + _FspFileSystemCanReplaceReparsePoint = GetEntryPoint(Module); FspFileSystemAddStreamInfo = GetEntryPoint(Module); FspFileSystemAcquireDirectoryBuffer = GetEntryPoint(Module); FspFileSystemFillDirectoryBuffer = GetEntryPoint(Module);