src: dotnet: WIP

This commit is contained in:
Bill Zissimopoulos 2017-04-07 12:35:20 -07:00
parent 33f5b8c05b
commit f117a89697
2 changed files with 17 additions and 17 deletions

View File

@ -129,7 +129,7 @@ namespace Fsp
MountPoint); MountPoint);
} }
Int32 Mount(String MountPoint, Int32 Mount(String MountPoint,
byte[] SecurityDescriptor = null, Byte[] SecurityDescriptor = null,
Boolean Synchronized = false, Boolean Synchronized = false,
UInt32 DebugLog = 0) UInt32 DebugLog = 0)
{ {
@ -195,7 +195,7 @@ namespace Fsp
protected virtual Int32 GetSecurityByName( protected virtual Int32 GetSecurityByName(
String FileName, String FileName,
out UInt32 FileAttributes/* or ReparsePointIndex */, out UInt32 FileAttributes/* or ReparsePointIndex */,
ref byte[] SecurityDescriptor) ref Byte[] SecurityDescriptor)
{ {
FileAttributes = default(UInt32); FileAttributes = default(UInt32);
return STATUS_INVALID_DEVICE_REQUEST; return STATUS_INVALID_DEVICE_REQUEST;
@ -336,7 +336,7 @@ namespace Fsp
protected virtual Int32 GetSecurity( protected virtual Int32 GetSecurity(
Object FileNode, Object FileNode,
Object FileDesc, Object FileDesc,
ref byte[] SecurityDescriptor) ref Byte[] SecurityDescriptor)
{ {
return STATUS_INVALID_DEVICE_REQUEST; return STATUS_INVALID_DEVICE_REQUEST;
} }
@ -344,7 +344,7 @@ namespace Fsp
Object FileNode, Object FileNode,
Object FileDesc, Object FileDesc,
UInt32 SecurityInformation, UInt32 SecurityInformation,
byte[] SecurityDescriptor) Byte[] SecurityDescriptor)
{ {
return STATUS_INVALID_DEVICE_REQUEST; return STATUS_INVALID_DEVICE_REQUEST;
} }
@ -427,7 +427,7 @@ namespace Fsp
} }
/* FSP_FILE_SYSTEM_INTERFACE */ /* FSP_FILE_SYSTEM_INTERFACE */
private static byte[] SecurityDescriptorNotNull = new byte[0]; private static Byte[] SecurityDescriptorNotNull = new Byte[0];
private static Int32 GetVolumeInfo( private static Int32 GetVolumeInfo(
IntPtr FileSystem, IntPtr FileSystem,
out VolumeInfo VolumeInfo) out VolumeInfo VolumeInfo)
@ -473,7 +473,7 @@ namespace Fsp
try try
{ {
UInt32 FileAttributes; UInt32 FileAttributes;
byte[] SecurityDescriptorBytes = null; Byte[] SecurityDescriptorBytes = null;
Int32 Result; Int32 Result;
if (IntPtr.Zero != PSecurityDescriptorSize) if (IntPtr.Zero != PSecurityDescriptorSize)
SecurityDescriptorBytes = SecurityDescriptorNotNull; SecurityDescriptorBytes = SecurityDescriptorNotNull;
@ -836,7 +836,7 @@ namespace Fsp
try try
{ {
Object FileNode, FileDesc; Object FileNode, FileDesc;
byte[] SecurityDescriptorBytes = null; Byte[] SecurityDescriptorBytes = null;
Int32 Result; Int32 Result;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc); Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
if (IntPtr.Zero != PSecurityDescriptorSize) if (IntPtr.Zero != PSecurityDescriptorSize)

View File

@ -542,11 +542,11 @@ namespace Fsp.Interop
internal static unsafe Int32 FspFileSystemSetMountPointEx( internal static unsafe Int32 FspFileSystemSetMountPointEx(
IntPtr FileSystem, IntPtr FileSystem,
String MountPoint, String MountPoint,
byte[] SecurityDescriptor) Byte[] SecurityDescriptor)
{ {
if (null != SecurityDescriptor) if (null != SecurityDescriptor)
{ {
fixed (byte *P = SecurityDescriptor) fixed (Byte *P = SecurityDescriptor)
return _FspFileSystemSetMountPointEx(FileSystem, MountPoint, (IntPtr)P); return _FspFileSystemSetMountPointEx(FileSystem, MountPoint, (IntPtr)P);
} }
else else
@ -556,7 +556,7 @@ namespace Fsp.Interop
internal unsafe static Object GetUserContext( internal unsafe static Object GetUserContext(
IntPtr NativePtr) IntPtr NativePtr)
{ {
IntPtr UserContext = *(IntPtr *)((byte *)NativePtr + sizeof(IntPtr)); IntPtr UserContext = *(IntPtr *)((Byte *)NativePtr + sizeof(IntPtr));
return IntPtr.Zero != UserContext ? GCHandle.FromIntPtr(UserContext).Target : null; return IntPtr.Zero != UserContext ? GCHandle.FromIntPtr(UserContext).Target : null;
} }
internal unsafe static void SetUserContext( internal unsafe static void SetUserContext(
@ -565,17 +565,17 @@ namespace Fsp.Interop
{ {
if (null != Obj) if (null != Obj)
{ {
Debug.Assert(IntPtr.Zero == *(IntPtr *)((byte *)NativePtr + sizeof(IntPtr))); Debug.Assert(IntPtr.Zero == *(IntPtr *)((Byte *)NativePtr + sizeof(IntPtr)));
GCHandle Handle = GCHandle.Alloc(Obj, GCHandleType.Weak); GCHandle Handle = GCHandle.Alloc(Obj, GCHandleType.Weak);
*(IntPtr *)((byte *)NativePtr + sizeof(IntPtr)) = (IntPtr)Handle; *(IntPtr *)((Byte *)NativePtr + sizeof(IntPtr)) = (IntPtr)Handle;
} }
else else
{ {
IntPtr UserContext = *(IntPtr *)((byte *)NativePtr + sizeof(IntPtr)); IntPtr UserContext = *(IntPtr *)((Byte *)NativePtr + sizeof(IntPtr));
if (IntPtr.Zero != UserContext) if (IntPtr.Zero != UserContext)
{ {
GCHandle.FromIntPtr(UserContext).Free(); GCHandle.FromIntPtr(UserContext).Free();
*(IntPtr *)((byte *)NativePtr + sizeof(IntPtr)) = IntPtr.Zero; *(IntPtr *)((Byte *)NativePtr + sizeof(IntPtr)) = IntPtr.Zero;
} }
} }
} }
@ -622,7 +622,7 @@ namespace Fsp.Interop
} }
internal unsafe static Int32 CopySecurityDescriptor( internal unsafe static Int32 CopySecurityDescriptor(
byte[] SecurityDescriptorBytes, Byte[] SecurityDescriptorBytes,
IntPtr SecurityDescriptor, IntPtr SecurityDescriptor,
IntPtr PSecurityDescriptorSize) IntPtr PSecurityDescriptorSize)
{ {
@ -645,12 +645,12 @@ namespace Fsp.Interop
} }
return 0/*STATUS_SUCCESS*/; return 0/*STATUS_SUCCESS*/;
} }
internal static byte[] MakeSecurityDescriptor( internal static Byte[] MakeSecurityDescriptor(
IntPtr SecurityDescriptor) IntPtr SecurityDescriptor)
{ {
if (IntPtr.Zero != SecurityDescriptor) if (IntPtr.Zero != SecurityDescriptor)
{ {
byte[] SecurityDescriptorBytes = new byte[GetSecurityDescriptorLength(SecurityDescriptor)]; Byte[] SecurityDescriptorBytes = new Byte[GetSecurityDescriptorLength(SecurityDescriptor)];
Marshal.Copy(SecurityDescriptor, Marshal.Copy(SecurityDescriptor,
SecurityDescriptorBytes, 0, SecurityDescriptorBytes.Length); SecurityDescriptorBytes, 0, SecurityDescriptorBytes.Length);
return SecurityDescriptorBytes; return SecurityDescriptorBytes;