Skip to content

Commit

Permalink
Merge pull request #176 from FrKaram/Issue174
Browse files Browse the repository at this point in the history
dotnet: add FlushAndPurgeOnCleanup and FspVersion
  • Loading branch information
billziss-gh committed Jul 5, 2018
2 parents d491031 + ee4145e commit 6ffddf3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions Contributors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ CONTRIBUTOR LIST
|John Oberschelp |john at oberschelp.net
|Sam Kelly (DuroSoft Technologies LLC, https://durosoft.com) |sam at durosoft.com
|Tobias Urlaub |saibotu at outlook.de
|Francois Karam (KS2, http://www.ks2.fr) |francois.karam at ks2.fr
|===
13 changes: 13 additions & 0 deletions src/dotnet/FileSystemHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ public Boolean PassQueryDirectoryFileName
get { return 0 != (_VolumeParams.Flags & VolumeParams.PassQueryDirectoryFileName); }
set { _VolumeParams.Flags |= (value ? VolumeParams.PassQueryDirectoryFileName : 0); }
}
public Boolean FlushAndPurgeOnCleanup
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.FlushAndPurgeOnCleanup); }
set { _VolumeParams.Flags |= (value ? VolumeParams.FlushAndPurgeOnCleanup : 0); }
}
/// <summary>
/// Gets or sets the prefix for a network file system.
/// </summary>
Expand Down Expand Up @@ -347,6 +352,14 @@ public static Int32 SetDebugLogFile(String FileName)
{
return Api.SetDebugLogFile(FileName);
}
/// <summary>
/// Return the installed version of WinFsp.
/// </summary>
/// <returns></returns>
public static Version Version()
{
return Api.GetFspVersion();
}

/* FSP_FILE_SYSTEM_INTERFACE */
private static Byte[] ByteBufferNotNull = new Byte[0];
Expand Down
8 changes: 8 additions & 0 deletions src/dotnet/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ internal struct VolumeParams
internal const UInt32 PassQueryDirectoryPattern = 0x00000800;
internal const UInt32 AlwaysUseDoubleBuffering = 0x00001000;
internal const UInt32 PassQueryDirectoryFileName = 0x00002000;
internal const UInt32 FlushAndPurgeOnCleanup = 0x00004000;
internal const UInt32 UmFileContextIsUserContext2 = 0x00010000;
internal const UInt32 UmFileContextIsFullContext = 0x00020000;
internal const int PrefixSize = 192;
Expand Down Expand Up @@ -979,6 +980,13 @@ internal static Int32 SetDebugLogFile(String FileName)
return 0/*STATUS_SUCCESS*/;
}

internal static Version GetFspVersion()
{
UInt32 Version = 0;
FspVersion(out Version);
return new System.Version((Int32)Version >> 16, (Int32)Version & 0xFFFF);
}

/* initialization */
private static IntPtr LoadDll()
{
Expand Down

0 comments on commit 6ffddf3

Please sign in to comment.