1、接口实现
This commit is contained in:
1 parent
cc2fdef069
commit
500c927883
7 files changed
+316
-75
No files matched your search
+5
-42
@@ -1,52 +1,15 @@
|
||||
#include "seafile/seafile_api.hpp"
|
||||
#include <winfsp/winfsp.h>
|
||||
|
||||
#include "seafile/fs/seafile_file_system.hpp"
|
||||
#include "seafile/fs/winfsp_adapter.hpp"
|
||||
|
||||
using namespace seafile::fs;
|
||||
|
||||
static std::shared_ptr<SeafileFileSystem> file_system = nullptr;
|
||||
|
||||
static NTSTATUS GetVolumeInfo(
|
||||
FSP_FILE_SYSTEM* FileSystem,
|
||||
FSP_FSCTL_VOLUME_INFO* VolumeInfo)
|
||||
{
|
||||
const auto fs = static_cast<SeafileFileSystem*>(FileSystem->UserContext);
|
||||
|
||||
return fs->GetVolumeInfo(VolumeInfo);
|
||||
}
|
||||
|
||||
static FSP_FILE_SYSTEM_INTERFACE seafile_interface = {
|
||||
.GetVolumeInfo = GetVolumeInfo
|
||||
};
|
||||
|
||||
static
|
||||
NTSTATUS SvcStart(FSP_SERVICE* Service, ULONG argc, PWSTR* argv) // (2)
|
||||
{
|
||||
if (file_system)
|
||||
{
|
||||
return file_system->SvcStart(Service, argc, argv);
|
||||
}
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static
|
||||
NTSTATUS SvcStop(FSP_SERVICE* Service) // (3)
|
||||
{
|
||||
if (file_system)
|
||||
{
|
||||
return file_system->SvcStop(Service);
|
||||
}
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int wmain(int argc, wchar_t** argv)
|
||||
{
|
||||
int wmain(int argc, wchar_t **argv) {
|
||||
if (!NT_SUCCESS(FspLoad(nullptr)))
|
||||
return ERROR_DELAY_LOAD_FAILED;
|
||||
|
||||
file_system = std::make_shared<SeafileFileSystem>(std::wstring("X:"));
|
||||
FspDebugLogSetHandle(GetStdHandle(STD_ERROR_HANDLE));
|
||||
|
||||
file_system->auth("asypost@yeah.net","Shell0805@china");
|
||||
|
||||
return FspServiceRun(const_cast<PWSTR>(L"SeaDisk"), SvcStart, SvcStop, nullptr);
|
||||
return FspServiceRun(const_cast<PWSTR>(L"SeaDisk"), WinFSPAdapter::SvcStart, WinFSPAdapter::SvcStop, nullptr);
|
||||
}
|
||||
Reference in new issue
Block a user