mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-08 04:52:10 -05:00
dotnet: reparse point WIP
This commit is contained in:
parent
060ebcca0d
commit
2bdd54536e
@ -291,7 +291,7 @@ namespace Fsp
|
|||||||
public virtual Int32 GetReparsePointByName(
|
public virtual Int32 GetReparsePointByName(
|
||||||
String FileName,
|
String FileName,
|
||||||
Boolean IsDirectory,
|
Boolean IsDirectory,
|
||||||
ref Byte[] ReparsePoint)
|
ref Byte[] ReparseData)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ namespace Fsp
|
|||||||
Object FileNode,
|
Object FileNode,
|
||||||
Object FileDesc,
|
Object FileDesc,
|
||||||
String FileName,
|
String FileName,
|
||||||
ref Byte[] ReparsePoint)
|
ref Byte[] ReparseData)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ namespace Fsp
|
|||||||
Object FileNode,
|
Object FileNode,
|
||||||
Object FileDesc,
|
Object FileDesc,
|
||||||
String FileName,
|
String FileName,
|
||||||
Byte[] ReparsePoint)
|
Byte[] ReparseData)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ namespace Fsp
|
|||||||
Object FileNode,
|
Object FileNode,
|
||||||
Object FileDesc,
|
Object FileDesc,
|
||||||
String FileName,
|
String FileName,
|
||||||
Byte[] ReparsePoint)
|
Byte[] ReparseData)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
@ -425,14 +425,13 @@ namespace Fsp
|
|||||||
public static UInt32 GetReparseTag(
|
public static UInt32 GetReparseTag(
|
||||||
Byte[] ReparseData)
|
Byte[] ReparseData)
|
||||||
{
|
{
|
||||||
return 0;
|
return Api.GetReparseTag(ReparseData);
|
||||||
}
|
}
|
||||||
public static Int32 CanReplaceReparsePoint(
|
public static Int32 CanReplaceReparsePoint(
|
||||||
Byte[] CurrentReparseData,
|
Byte[] CurrentReparseData,
|
||||||
Byte[] ReplaceReparseData)
|
Byte[] ReplaceReparseData)
|
||||||
{
|
{
|
||||||
// !!!: NOT IMPLEMENTED
|
return Api.FspFileSystemCanReplaceReparsePoint(CurrentReparseData, ReplaceReparseData);
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
private static Int32 GetReparsePointByName(
|
private static Int32 GetReparsePointByName(
|
||||||
IntPtr FileSystem,
|
IntPtr FileSystem,
|
||||||
@ -445,15 +444,15 @@ namespace Fsp
|
|||||||
FileSystemBase self = (FileSystemBase)GCHandle.FromIntPtr(Context).Target;
|
FileSystemBase self = (FileSystemBase)GCHandle.FromIntPtr(Context).Target;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Byte[] ReparsePointBytes;
|
Byte[] ReparseData;
|
||||||
Int32 Result;
|
Int32 Result;
|
||||||
ReparsePointBytes = null;
|
ReparseData = null;
|
||||||
Result = self.GetReparsePointByName(
|
Result = self.GetReparsePointByName(
|
||||||
FileName,
|
FileName,
|
||||||
IsDirectory,
|
IsDirectory,
|
||||||
ref ReparsePointBytes);
|
ref ReparseData);
|
||||||
if (0 <= Result)
|
if (0 <= Result)
|
||||||
Result = Api.CopyReparsePoint(ReparsePointBytes, Buffer, PSize);
|
Result = Api.CopyReparsePoint(ReparseData, Buffer, PSize);
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -792,18 +792,18 @@ namespace Fsp
|
|||||||
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
|
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Byte[] ReparsePointBytes;
|
Byte[] ReparseData;
|
||||||
Object FileNode, FileDesc;
|
Object FileNode, FileDesc;
|
||||||
Int32 Result;
|
Int32 Result;
|
||||||
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
|
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
|
||||||
ReparsePointBytes = null;
|
ReparseData = null;
|
||||||
Result = FileSystem.GetReparsePoint(
|
Result = FileSystem.GetReparsePoint(
|
||||||
FileNode,
|
FileNode,
|
||||||
FileDesc,
|
FileDesc,
|
||||||
FileName,
|
FileName,
|
||||||
ref ReparsePointBytes);
|
ref ReparseData);
|
||||||
if (0 <= Result)
|
if (0 <= Result)
|
||||||
Result = Api.CopyReparsePoint(ReparsePointBytes, Buffer, PSize);
|
Result = Api.CopyReparsePoint(ReparseData, Buffer, PSize);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -620,7 +620,7 @@ namespace Fsp.Interop
|
|||||||
internal static Proto.FspFileSystemAddDirInfo _FspFileSystemAddDirInfo;
|
internal static Proto.FspFileSystemAddDirInfo _FspFileSystemAddDirInfo;
|
||||||
internal static Proto.FspFileSystemFindReparsePoint FspFileSystemFindReparsePoint;
|
internal static Proto.FspFileSystemFindReparsePoint FspFileSystemFindReparsePoint;
|
||||||
internal static Proto.FspFileSystemResolveReparsePoints FspFileSystemResolveReparsePoints;
|
internal static Proto.FspFileSystemResolveReparsePoints FspFileSystemResolveReparsePoints;
|
||||||
internal static Proto.FspFileSystemCanReplaceReparsePoint FspFileSystemCanReplaceReparsePoint;
|
internal static Proto.FspFileSystemCanReplaceReparsePoint _FspFileSystemCanReplaceReparsePoint;
|
||||||
internal static Proto.FspFileSystemAddStreamInfo FspFileSystemAddStreamInfo;
|
internal static Proto.FspFileSystemAddStreamInfo FspFileSystemAddStreamInfo;
|
||||||
internal static Proto.FspFileSystemAcquireDirectoryBuffer FspFileSystemAcquireDirectoryBuffer;
|
internal static Proto.FspFileSystemAcquireDirectoryBuffer FspFileSystemAcquireDirectoryBuffer;
|
||||||
internal static Proto.FspFileSystemFillDirectoryBuffer FspFileSystemFillDirectoryBuffer;
|
internal static Proto.FspFileSystemFillDirectoryBuffer FspFileSystemFillDirectoryBuffer;
|
||||||
@ -771,18 +771,18 @@ namespace Fsp.Interop
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe static Int32 CopyReparsePoint(
|
internal unsafe static Int32 CopyReparsePoint(
|
||||||
Byte[] ReparsePointBytes,
|
Byte[] ReparseData,
|
||||||
IntPtr Buffer,
|
IntPtr Buffer,
|
||||||
IntPtr PSize)
|
IntPtr PSize)
|
||||||
{
|
{
|
||||||
if (IntPtr.Zero != Buffer)
|
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*/;
|
return unchecked((Int32)0xc0000023)/*STATUS_BUFFER_TOO_SMALL*/;
|
||||||
*(UIntPtr *)PSize = (UIntPtr)ReparsePointBytes.Length;
|
*(UIntPtr *)PSize = (UIntPtr)ReparseData.Length;
|
||||||
Marshal.Copy(ReparsePointBytes, 0, Buffer, ReparsePointBytes.Length);
|
Marshal.Copy(ReparseData, 0, Buffer, ReparseData.Length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*(UIntPtr *)PSize = UIntPtr.Zero;
|
*(UIntPtr *)PSize = UIntPtr.Zero;
|
||||||
@ -795,13 +795,28 @@ namespace Fsp.Interop
|
|||||||
{
|
{
|
||||||
if (IntPtr.Zero != Buffer)
|
if (IntPtr.Zero != Buffer)
|
||||||
{
|
{
|
||||||
Byte[] ReparsePointBytes = new Byte[(int)Size];
|
Byte[] ReparseData = new Byte[(int)Size];
|
||||||
Marshal.Copy(Buffer, ReparsePointBytes, 0, ReparsePointBytes.Length);
|
Marshal.Copy(Buffer, ReparseData, 0, ReparseData.Length);
|
||||||
return ReparsePointBytes;
|
return ReparseData;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return null;
|
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)
|
internal static Int32 SetDebugLogFile(String FileName)
|
||||||
{
|
{
|
||||||
@ -874,7 +889,7 @@ namespace Fsp.Interop
|
|||||||
_FspFileSystemAddDirInfo = GetEntryPoint<Proto.FspFileSystemAddDirInfo>(Module);
|
_FspFileSystemAddDirInfo = GetEntryPoint<Proto.FspFileSystemAddDirInfo>(Module);
|
||||||
FspFileSystemFindReparsePoint = GetEntryPoint<Proto.FspFileSystemFindReparsePoint>(Module);
|
FspFileSystemFindReparsePoint = GetEntryPoint<Proto.FspFileSystemFindReparsePoint>(Module);
|
||||||
FspFileSystemResolveReparsePoints = GetEntryPoint<Proto.FspFileSystemResolveReparsePoints>(Module);
|
FspFileSystemResolveReparsePoints = GetEntryPoint<Proto.FspFileSystemResolveReparsePoints>(Module);
|
||||||
FspFileSystemCanReplaceReparsePoint = GetEntryPoint<Proto.FspFileSystemCanReplaceReparsePoint>(Module);
|
_FspFileSystemCanReplaceReparsePoint = GetEntryPoint<Proto.FspFileSystemCanReplaceReparsePoint>(Module);
|
||||||
FspFileSystemAddStreamInfo = GetEntryPoint<Proto.FspFileSystemAddStreamInfo>(Module);
|
FspFileSystemAddStreamInfo = GetEntryPoint<Proto.FspFileSystemAddStreamInfo>(Module);
|
||||||
FspFileSystemAcquireDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemAcquireDirectoryBuffer>(Module);
|
FspFileSystemAcquireDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemAcquireDirectoryBuffer>(Module);
|
||||||
FspFileSystemFillDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemFillDirectoryBuffer>(Module);
|
FspFileSystemFillDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemFillDirectoryBuffer>(Module);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user