mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
dotnet: FileSystemBase.GetStreamEntry
This commit is contained in:
parent
0f9ef3bd51
commit
23eac24c84
@ -326,8 +326,33 @@ namespace Fsp
|
|||||||
UInt32 Length,
|
UInt32 Length,
|
||||||
out UInt32 BytesTransferred)
|
out UInt32 BytesTransferred)
|
||||||
{
|
{
|
||||||
|
Object Context = null;
|
||||||
|
String StreamName;
|
||||||
|
UInt64 StreamSize, StreamAllocationSize;
|
||||||
|
StreamInfo StreamInfo = default(StreamInfo);
|
||||||
BytesTransferred = default(UInt32);
|
BytesTransferred = default(UInt32);
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
while (GetStreamEntry(FileNode, FileDesc,
|
||||||
|
ref Context, out StreamName, out StreamSize, out StreamAllocationSize))
|
||||||
|
{
|
||||||
|
StreamInfo.SetStreamNameBuf(StreamName);
|
||||||
|
if (!Api.FspFileSystemAddStreamInfo(ref StreamInfo, Buffer, Length,
|
||||||
|
out BytesTransferred))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
public virtual Boolean GetStreamEntry(
|
||||||
|
Object FileNode,
|
||||||
|
Object FileDesc,
|
||||||
|
ref Object Context,
|
||||||
|
out String StreamName,
|
||||||
|
out UInt64 StreamSize,
|
||||||
|
out UInt64 StreamAllocationSize)
|
||||||
|
{
|
||||||
|
StreamName = default(String);
|
||||||
|
StreamSize = default(UInt64);
|
||||||
|
StreamAllocationSize = default(UInt64);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helpers */
|
/* helpers */
|
||||||
|
@ -164,7 +164,8 @@ namespace Fsp.Interop
|
|||||||
internal struct DirInfo
|
internal struct DirInfo
|
||||||
{
|
{
|
||||||
internal const int FileNameBufSize = 255;
|
internal const int FileNameBufSize = 255;
|
||||||
internal static int FileNameBufOffset = (int)Marshal.OffsetOf(typeof(DirInfo), "FileNameBuf");
|
internal static int FileNameBufOffset =
|
||||||
|
(int)Marshal.OffsetOf(typeof(DirInfo), "FileNameBuf");
|
||||||
|
|
||||||
internal UInt16 Size;
|
internal UInt16 Size;
|
||||||
internal FileInfo FileInfo;
|
internal FileInfo FileInfo;
|
||||||
@ -172,7 +173,7 @@ namespace Fsp.Interop
|
|||||||
//internal unsafe fixed UInt16 FileNameBuf[];
|
//internal unsafe fixed UInt16 FileNameBuf[];
|
||||||
internal unsafe fixed UInt16 FileNameBuf[FileNameBufSize];
|
internal unsafe fixed UInt16 FileNameBuf[FileNameBufSize];
|
||||||
|
|
||||||
public unsafe void SetFileNameBuf(String Value)
|
internal unsafe void SetFileNameBuf(String Value)
|
||||||
{
|
{
|
||||||
fixed (UInt16 *P = FileNameBuf)
|
fixed (UInt16 *P = FileNameBuf)
|
||||||
{
|
{
|
||||||
@ -189,10 +190,28 @@ namespace Fsp.Interop
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal struct StreamInfo
|
internal struct StreamInfo
|
||||||
{
|
{
|
||||||
|
internal const int StreamNameBufSize = 255;
|
||||||
|
internal static int StreamNameBufOffset =
|
||||||
|
(int)Marshal.OffsetOf(typeof(StreamInfo), "StreamNameBuf");
|
||||||
|
|
||||||
internal UInt16 Size;
|
internal UInt16 Size;
|
||||||
internal UInt64 StreamSize;
|
internal UInt64 StreamSize;
|
||||||
internal UInt64 StreamAllocationSize;
|
internal UInt64 StreamAllocationSize;
|
||||||
//internal unsafe fixed UInt16 StreamNameBuf[];
|
//internal unsafe fixed UInt16 StreamNameBuf[];
|
||||||
|
internal unsafe fixed UInt16 StreamNameBuf[StreamNameBufSize];
|
||||||
|
|
||||||
|
internal unsafe void SetStreamNameBuf(String Value)
|
||||||
|
{
|
||||||
|
fixed (UInt16 *P = StreamNameBuf)
|
||||||
|
{
|
||||||
|
int Size = null != Value ? Value.Length : 0;
|
||||||
|
if (Size > StreamNameBufSize)
|
||||||
|
Size = StreamNameBufSize;
|
||||||
|
for (int I = 0; Size > I; I++)
|
||||||
|
P[I] = Value[I];
|
||||||
|
this.Size = (UInt16)(StreamNameBufOffset + Size * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
@ -621,7 +640,7 @@ namespace Fsp.Interop
|
|||||||
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;
|
||||||
internal static Proto.FspFileSystemReleaseDirectoryBuffer FspFileSystemReleaseDirectoryBuffer;
|
internal static Proto.FspFileSystemReleaseDirectoryBuffer FspFileSystemReleaseDirectoryBuffer;
|
||||||
@ -663,6 +682,15 @@ namespace Fsp.Interop
|
|||||||
fixed (DirInfo *P = &DirInfo)
|
fixed (DirInfo *P = &DirInfo)
|
||||||
return _FspFileSystemAddDirInfo((IntPtr)P, Buffer, Length, out PBytesTransferred);
|
return _FspFileSystemAddDirInfo((IntPtr)P, Buffer, Length, out PBytesTransferred);
|
||||||
}
|
}
|
||||||
|
internal static unsafe Boolean FspFileSystemAddStreamInfo(
|
||||||
|
ref StreamInfo StreamInfo,
|
||||||
|
IntPtr Buffer,
|
||||||
|
UInt32 Length,
|
||||||
|
out UInt32 PBytesTransferred)
|
||||||
|
{
|
||||||
|
fixed (StreamInfo *P = &StreamInfo)
|
||||||
|
return _FspFileSystemAddStreamInfo((IntPtr)P, Buffer, Length, out PBytesTransferred);
|
||||||
|
}
|
||||||
|
|
||||||
internal unsafe static Object GetUserContext(
|
internal unsafe static Object GetUserContext(
|
||||||
IntPtr NativePtr)
|
IntPtr NativePtr)
|
||||||
@ -890,7 +918,7 @@ namespace Fsp.Interop
|
|||||||
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);
|
||||||
FspFileSystemReleaseDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemReleaseDirectoryBuffer>(Module);
|
FspFileSystemReleaseDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemReleaseDirectoryBuffer>(Module);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user