Add mount and umount functions for winfsp implementation.

This commit is contained in:
2020-09-02 16:53:21 +01:00
parent b1dd940d00
commit 1f869f34ad
2 changed files with 46 additions and 3 deletions

View File

@@ -1,10 +1,13 @@
using System;
using Fsp;
using Fsp.Interop;
namespace RomRepoMgr.Core.Filesystem
{
public class Winfsp : FileSystemBase
{
FileSystemHost _host;
public static bool IsAvailable
{
get
@@ -24,5 +27,27 @@ namespace RomRepoMgr.Core.Filesystem
}
}
}
internal bool Mount(string mountPoint)
{
_host = new FileSystemHost(this);
int ret = _host.Mount(mountPoint);
if(ret == STATUS_SUCCESS)
return true;
_host = null;
return false;
}
internal void Umount() => _host?.Unmount();
public override int SetVolumeLabel(string VolumeLabel, out VolumeInfo VolumeInfo)
{
VolumeInfo = default;
return STATUS_MEDIA_WRITE_PROTECTED;
}
}
}