1、接口实现

This commit is contained in:
shell committed 2026-06-21 20:56:29 +08:00
1 parent cc2fdef069
commit 500c927883
7 files changed
+316 -75

No files matched your search

+50 -6
View File
@@ -4,13 +4,57 @@
#include "seafile/fs/seafile_file_system.hpp"
namespace seafile::fs
{
void SeafileFileSystem::auth(const std::string& username, const std::string& password)
{
if (const auto authToken = api.authToken(username, password); authToken.has_value())
{
namespace seafile::fs {
void SeafileFileSystem::auth(const std::string &username, const std::string &password) {
if (const auto authToken = api.authToken(username, password); authToken.has_value()) {
this->token = authToken.value().token;
}
}
void SeafileFileSystem::Close(PVOID FileContext0) {
}
NTSTATUS SeafileFileSystem::GetSecurityByName(PWSTR FileName, PUINT32 PFileAttributes,
PSECURITY_DESCRIPTOR SecurityDescriptor,
SIZE_T *PSecurityDescriptorSize) {
*PFileAttributes = FILE_ATTRIBUTE_NORMAL;
*PSecurityDescriptorSize = 0;
return STATUS_SUCCESS;
}
NTSTATUS SeafileFileSystem::GetVolumeInfo(FSP_FSCTL_VOLUME_INFO *VolumeInfo) {
const auto userInfo = api.accountInfo(this->token, this->token_type);
if (userInfo.has_value()) {
const auto &info = userInfo.value();
VolumeInfo->FreeSize = info.total - info.usage;
VolumeInfo->TotalSize = info.total;
wcscpy(VolumeInfo->VolumeLabel, L"Seafile");
VolumeInfo->VolumeLabelLength = static_cast<UINT16>((wcslen(VolumeInfo->VolumeLabel) * sizeof(WCHAR)));
return STATUS_SUCCESS;
}
return STATUS_END_OF_MEDIA;
}
NTSTATUS SeafileFileSystem::Open(PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess, PVOID *PFileContext,
FSP_FSCTL_FILE_INFO *FileInfo) {
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS SeafileFileSystem::Read(PVOID FileContext, PVOID Buffer, UINT64 Offset, ULONG Length, PULONG PBytesTransferred) {
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS SeafileFileSystem::ReadDirectory(PVOID FileContext0, PWSTR Pattern, PWSTR Marker, PVOID Buffer,
ULONG BufferLength, PULONG PBytesTransferred) {
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS SeafileFileSystem::SetVolumeLabel_(PWSTR VolumeLabel, FSP_FSCTL_VOLUME_INFO *VolumeInfo) {
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS SeafileFileSystem::GetFileInfo(HANDLE Handle, FSP_FSCTL_FILE_INFO *FileInfo) {
return STATUS_NOT_IMPLEMENTED;
}
}