mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
src: dotnet: WIP
This commit is contained in:
parent
36d50facd7
commit
30dae34700
@ -286,7 +286,7 @@ namespace Fsp
|
||||
UInt32 FileAttributes,
|
||||
IntPtr SecurityDescriptor,
|
||||
UInt64 AllocationSize,
|
||||
out FullContext FullContext,
|
||||
ref FullContext FullContext,
|
||||
out FileInfo FileInfo)
|
||||
{
|
||||
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
||||
@ -304,7 +304,7 @@ namespace Fsp
|
||||
out FileNode,
|
||||
out FileDesc,
|
||||
out FileInfo);
|
||||
Api.SetFullContext(out FullContext, FileNode, FileDesc);
|
||||
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
||||
return Result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -319,7 +319,7 @@ namespace Fsp
|
||||
String FileName,
|
||||
UInt32 CreateOptions,
|
||||
UInt32 GrantedAccess,
|
||||
out FullContext FullContext,
|
||||
ref FullContext FullContext,
|
||||
out FileInfo FileInfo)
|
||||
{
|
||||
FullContext = default(FullContext);
|
||||
|
@ -202,7 +202,7 @@ namespace Fsp.Interop
|
||||
UInt32 FileAttributes,
|
||||
IntPtr SecurityDescriptor,
|
||||
UInt64 AllocationSize,
|
||||
out FullContext FullContext,
|
||||
ref FullContext FullContext,
|
||||
out FileInfo FileInfo);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate Int32 Open(
|
||||
@ -210,7 +210,7 @@ namespace Fsp.Interop
|
||||
[MarshalAs(UnmanagedType.LPWStr)] String FileName,
|
||||
UInt32 CreateOptions,
|
||||
UInt32 GrantedAccess,
|
||||
out FullContext FullContext,
|
||||
ref FullContext FullContext,
|
||||
out FileInfo FileInfo);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate Int32 Overwrite(
|
||||
@ -469,13 +469,42 @@ namespace Fsp.Interop
|
||||
internal static void GetFullContext(ref FullContext FullContext,
|
||||
out Object FileNode, out Object FileDesc)
|
||||
{
|
||||
FileNode = default(Object);
|
||||
FileDesc = default(Object);
|
||||
FileNode = 0 != FullContext.UserContext ?
|
||||
((GCHandle)(IntPtr)FullContext.UserContext).Target : null;
|
||||
FileDesc = 0 != FullContext.UserContext2 ?
|
||||
((GCHandle)(IntPtr)FullContext.UserContext2).Target : null;
|
||||
}
|
||||
internal static void SetFullContext(out FullContext FullContext,
|
||||
internal static void SetFullContext(ref FullContext FullContext,
|
||||
Object FileNode, Object FileDesc)
|
||||
{
|
||||
FullContext = default(FullContext);
|
||||
if (null != FileNode)
|
||||
{
|
||||
Debug.Assert(0 == FullContext.UserContext);
|
||||
GCHandle Handle = GCHandle.Alloc(FileNode, GCHandleType.Normal);
|
||||
FullContext.UserContext = (UInt64)(IntPtr)Handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 != FullContext.UserContext)
|
||||
{
|
||||
((GCHandle)(IntPtr)FullContext.UserContext).Free();
|
||||
FullContext.UserContext = 0;
|
||||
}
|
||||
}
|
||||
if (null != FileDesc)
|
||||
{
|
||||
Debug.Assert(0 == FullContext.UserContext2);
|
||||
GCHandle Handle = GCHandle.Alloc(FileDesc, GCHandleType.Normal);
|
||||
FullContext.UserContext2 = (UInt64)(IntPtr)Handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 != FullContext.UserContext2)
|
||||
{
|
||||
((GCHandle)(IntPtr)FullContext.UserContext2).Free();
|
||||
FullContext.UserContext2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user