From ff5850847ffe8c26602602c472af56ed8eb44212 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Sat, 1 Apr 2017 16:43:30 -0700 Subject: [PATCH] src: dotnet: WIP --- src/dotnet/Interop.cs | 47 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/src/dotnet/Interop.cs b/src/dotnet/Interop.cs index 7fa52050..a3c1b4aa 100644 --- a/src/dotnet/Interop.cs +++ b/src/dotnet/Interop.cs @@ -302,7 +302,7 @@ namespace Fsp.Interop out UInt32 PBytesTransferred); internal unsafe fixed ulong Reserved[40]; - /* cannot use IntPtr so use ulong */ + /* cannot use IntPtr with fixed; on 32-bit struct will be too long, but that's ok */ } [SuppressUnmanagedCodeSecurity] @@ -310,15 +310,56 @@ namespace Fsp.Interop { internal const String dllname = "winfsp.dll"; + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemPreflight( + [MarshalAs(UnmanagedType.LPWStr)] String DevicePath, + [MarshalAs(UnmanagedType.LPWStr)] String MountPoint); + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] internal static extern Int32 FspFileSystemCreate( [MarshalAs(UnmanagedType.LPWStr)] String DevicePath, ref VolumeParams VolumeParams, - IntPtr Interface, + ref FileSystemInterface Interface, out IntPtr PFileSystem); [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] internal static extern void FspFileSystemDelete(IntPtr FileSystem); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemSetMountPoint( + IntPtr FileSystem, + [MarshalAs(UnmanagedType.LPWStr)] String MountPoint); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemSetMountPointEx( + IntPtr FileSystem, + [MarshalAs(UnmanagedType.LPWStr)] String MountPoint, + IntPtr SecurityDescriptor); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemRemoveMountPoint( + IntPtr FileSystem); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemStartDispatcher( + IntPtr FileSystem, + UInt32 ThreadCount); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspFileSystemStopDispatcher( + IntPtr FileSystem); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspVersion( + out UInt32 PVersion); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern Int32 FspNtStatusFromWin32( + UInt32 Error); + + [DllImport(dllname, CallingConvention = CallingConvention.Cdecl)] + internal static extern UInt32 FspWin32FromNtStatus( + Int32 Status); } -} +}