dotnet: reparse point WIP

This commit is contained in:
Bill Zissimopoulos 2017-05-05 20:29:47 -07:00
parent 060ebcca0d
commit 2bdd54536e
3 changed files with 39 additions and 25 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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<Proto.FspFileSystemAddDirInfo>(Module);
FspFileSystemFindReparsePoint = GetEntryPoint<Proto.FspFileSystemFindReparsePoint>(Module);
FspFileSystemResolveReparsePoints = GetEntryPoint<Proto.FspFileSystemResolveReparsePoints>(Module);
FspFileSystemCanReplaceReparsePoint = GetEntryPoint<Proto.FspFileSystemCanReplaceReparsePoint>(Module);
_FspFileSystemCanReplaceReparsePoint = GetEntryPoint<Proto.FspFileSystemCanReplaceReparsePoint>(Module);
FspFileSystemAddStreamInfo = GetEntryPoint<Proto.FspFileSystemAddStreamInfo>(Module);
FspFileSystemAcquireDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemAcquireDirectoryBuffer>(Module);
FspFileSystemFillDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemFillDirectoryBuffer>(Module);