diff --git a/.cspell/words.txt b/.cspell/words.txt index e3694394..3d14e231 100644 --- a/.cspell/words.txt +++ b/.cspell/words.txt @@ -31,6 +31,7 @@ cxxstd d_largefile64_source d_largefile_source d_ndebug +dacl_security_information dbackward_shared dbghelp dboost_root @@ -136,6 +137,8 @@ libuuid libuuid_include_dirs libvlc linkflags +lptr +lpwstr markdownlint mbig msvc diff --git a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp index 9f7b0723..fa48b6a4 100644 --- a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp +++ b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp @@ -133,8 +133,8 @@ auto remote_server::fuse_chflags(const char *path, std::uint32_t /*flags*/) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -144,8 +144,8 @@ auto remote_server::fuse_chmod(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -156,8 +156,8 @@ auto remote_server::fuse_chown(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -171,12 +171,12 @@ auto remote_server::fuse_destroy() -> packet::error_type { /*packet::error_type remote_server::fuse_fallocate(const char *path, const std::int32_t &mode, const remote::file_offset &offset, const remote::file_offset -&length, const remote::file_handle &handle) { const auto file_path = +&length, const remote::file_handle &handle) { auto file_path = construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res == 0) { res = _chsize_s(static_cast(handle), offset + length); } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; }*/ @@ -189,7 +189,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, r_stat = {}; - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{ has_compat_open_info(handle, EBADF), @@ -203,7 +203,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, } } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -214,8 +214,8 @@ auto remote_server::fuse_fsetattr_x(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -226,7 +226,7 @@ auto remote_server::fuse_fsync(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{ has_compat_open_info(handle, EBADF), @@ -245,7 +245,7 @@ auto remote_server::fuse_fsync(const char *path, } } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -256,7 +256,7 @@ auto remote_server::fuse_ftruncate(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{ has_compat_open_info(handle, EBADF), @@ -278,7 +278,7 @@ auto remote_server::fuse_ftruncate(const char *path, } } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -289,7 +289,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st, r_st = {}; - const auto file_path = construct_path(path); + auto file_path = construct_path(path); directory = utils::file::directory(file_path).exists(); @@ -301,20 +301,20 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st, populate_stat(path, directory, r_st, st1); } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } /*packet::error_type remote_server::fuse_getxattr(const char *path, const char -*name, char *value, const remote::file_size &size) { const auto file_path = -construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED; +*name, char *value, const remote::file_size &size) { auto file_path = +construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } packet::error_type remote_server::fuse_getxattr_osx(const char *path, const char *name, char *value, const remote::file_size &size, std::uint32_t position) { -const auto file_path = construct_path(path); const auto ret = +auto file_path = construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; }*/ @@ -325,8 +325,8 @@ auto remote_server::fuse_getxtimes(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -339,8 +339,8 @@ auto remote_server::fuse_init() -> packet::error_type { } /*packet::error_type remote_server::fuse_listxattr(const char *path, char -*buffer, const remote::file_size &size) { const auto file_path = -construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED; +*buffer, const remote::file_size &size) { auto file_path = +construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; }*/ @@ -350,11 +350,11 @@ auto remote_server::fuse_mkdir(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{ _mkdir(file_path.c_str()), }; - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -363,8 +363,8 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto unicode_file_path = utils::string::from_utf8(file_path); + auto file_path = construct_path(path); + auto unicode_file_path = utils::string::from_utf8(file_path); auto res{-1}; errno = ENOENT; @@ -379,7 +379,7 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle) errno = 0; } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -392,13 +392,13 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode, auto ret = -1; - const auto file_path = construct_path(path); - const auto directory_op = ((flags & remote::open_flags::directory) == - remote::open_flags::directory); + auto file_path = construct_path(path); + auto directory_op = ((flags & remote::open_flags::directory) == + remote::open_flags::directory); std::int32_t perms = 0; - const auto open_flags = + auto open_flags = utils::unix_open_flags_to_flags_and_perms(mode, flags, perms); - const auto create_op = (open_flags & _O_CREAT); + auto create_op = (open_flags & _O_CREAT); if ((create_op != 0) && directory_op) { ret = -EINVAL; @@ -427,7 +427,7 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{-1}; if ((flags & remote::open_flags::directory) == @@ -435,7 +435,7 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags, errno = EACCES; } else { std::int32_t perms = 0; - const auto open_flags = + auto open_flags = utils::unix_open_flags_to_flags_and_perms(0, flags, perms) & (~_O_CREAT); int file = -1; @@ -448,7 +448,7 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags, } } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -460,7 +460,7 @@ auto remote_server::fuse_read(const char *path, char *buffer, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto &data = *reinterpret_cast(buffer); auto res{0}; if (read_size > std::numeric_limits::max()) { @@ -481,7 +481,7 @@ auto remote_server::fuse_read(const char *path, char *buffer, } } - const auto ret = ((res < 0) ? -errno : static_cast(data.size())); + auto ret = ((res < 0) ? -errno : static_cast(data.size())); if (ret < 0) { RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); } @@ -492,13 +492,13 @@ auto remote_server::fuse_rename(const char *from, const char *to) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto from_path = utils::path::combine(mount_location_, {from}); - const auto to_path = utils::path::combine(mount_location_, {to}); + auto from_path = utils::path::combine(mount_location_, {from}); + auto to_path = utils::path::combine(mount_location_, {to}); auto res{ rename(from_path.c_str(), to_path.c_str()), }; - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, from + std::string("|") + to, ret); return ret; @@ -511,7 +511,7 @@ auto remote_server::fuse_write(const char *path, const char *buffer, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); std::size_t bytes_written{}; auto res{0}; if (write_size > std::numeric_limits::max()) { @@ -533,7 +533,7 @@ auto remote_server::fuse_write(const char *path, const char *buffer, } } - const auto ret = ((res < 0) ? -errno : static_cast(bytes_written)); + auto ret = ((res < 0) ? -errno : static_cast(bytes_written)); if (ret < 0) { RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); } @@ -555,7 +555,7 @@ auto remote_server::fuse_readdir(const char *path, std::string &item_path) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{0}; if (offset > std::numeric_limits::max()) { errno = ERANGE; @@ -570,7 +570,7 @@ auto remote_server::fuse_readdir(const char *path, } } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -580,14 +580,14 @@ auto remote_server::fuse_release(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); remove_compat_open_info(handle); auto res{ _close(static_cast(handle)), }; - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -597,14 +597,14 @@ auto remote_server::fuse_releasedir(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0); return 0; } /*packet::error_type remote_server::fuse_removexattr(const char *path, const -char *name) { const auto file_path = construct_path(path); const auto ret = +char *name) { auto file_path = construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; }*/ @@ -612,11 +612,11 @@ file_path, ret); return ret; auto remote_server::fuse_rmdir(const char *path) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{ _rmdir(file_path.c_str()), }; - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -626,8 +626,8 @@ auto remote_server::fuse_setattr_x(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -637,8 +637,8 @@ auto remote_server::fuse_setbkuptime(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -648,8 +648,8 @@ auto remote_server::fuse_setchgtime(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -659,8 +659,8 @@ auto remote_server::fuse_setcrtime(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto ret = STATUS_NOT_IMPLEMENTED; + auto file_path = construct_path(path); + auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -674,15 +674,15 @@ auto remote_server::fuse_setvolname(const char *volname) -> packet::error_type { /*packet::error_type remote_server::fuse_setxattr(const char *path, const char *name, const char *value, const remote::file_size &size, const std::int32_t -&flags) { const auto file_path = construct_path(path); const auto ret = +&flags) { auto file_path = construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } packet::error_type remote_server::fuse_setxattr_osx(const char *path, const char *name, const char *value, const remote::file_size &size, const std::int32_t -&flags, const std::uint32_t &position) { const auto file_path = -construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED; +&flags, const std::uint32_t &position) { auto file_path = +construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; }*/ @@ -691,11 +691,11 @@ auto remote_server::fuse_statfs(const char *path, std::uint64_t frsize, remote::statfs &r_stat) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); - const auto total_bytes = drive_.get_total_drive_space(); - const auto total_used = drive_.get_used_drive_space(); - const auto used_blocks = utils::divide_with_ceiling( + auto total_bytes = drive_.get_total_drive_space(); + auto total_used = drive_.get_used_drive_space(); + auto used_blocks = utils::divide_with_ceiling( total_used, static_cast(frsize)); r_stat.f_files = 4294967295; r_stat.f_blocks = utils::divide_with_ceiling( @@ -714,11 +714,11 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); - const auto total_bytes = drive_.get_total_drive_space(); - const auto total_used = drive_.get_used_drive_space(); - const auto used_blocks = + auto total_bytes = drive_.get_total_drive_space(); + auto total_used = drive_.get_used_drive_space(); + auto used_blocks = utils::divide_with_ceiling(total_used, static_cast(bsize)); r_stat.f_blocks = utils::divide_with_ceiling( total_bytes, static_cast(bsize)); @@ -740,12 +740,12 @@ auto remote_server::fuse_truncate(const char *path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto unicode_file_path = utils::string::from_utf8(file_path); + auto file_path = construct_path(path); + auto unicode_file_path = utils::string::from_utf8(file_path); auto res{-1}; errno = ENOENT; - const auto flags_and_attributes = + auto flags_and_attributes = FILE_FLAG_BACKUP_SEMANTICS | (::PathIsDirectoryW(unicode_file_path.c_str()) != 0 ? FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_POSIX_SEMANTICS @@ -766,7 +766,7 @@ auto remote_server::fuse_truncate(const char *path, ::CloseHandle(os_handle); } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -774,11 +774,11 @@ auto remote_server::fuse_truncate(const char *path, auto remote_server::fuse_unlink(const char *path) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{ _unlink(file_path.c_str()), }; - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -788,13 +788,13 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); - const auto unicode_file_path = utils::string::from_utf8(file_path); + auto file_path = construct_path(path); + auto unicode_file_path = utils::string::from_utf8(file_path); auto res{-1}; errno = ENOENT; - const auto flags_and_attributes = + auto flags_and_attributes = FILE_FLAG_BACKUP_SEMANTICS | (::PathIsDirectoryW(unicode_file_path.c_str()) != 0 ? FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_POSIX_SEMANTICS @@ -838,7 +838,7 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, ::CloseHandle(os_handle); } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -849,7 +849,7 @@ auto remote_server::json_create_directory_snapshot(const std::string &path, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); auto res{-1}; errno = ENOENT; @@ -868,7 +868,7 @@ auto remote_server::json_create_directory_snapshot(const std::string &path, errno = 0; } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -878,7 +878,7 @@ auto remote_server::json_read_directory_snapshot( std::uint32_t page, json &json_data) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); int res{-EBADF}; auto iter = directory_cache_.get_directory(handle); @@ -898,7 +898,7 @@ auto remote_server::json_read_directory_snapshot( iter->get_count(), REPERTORY_DIRECTORY_PAGE_SIZE); } - const auto ret = ((res < 0) ? -errno : 0); + auto ret = ((res < 0) ? -errno : 0); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret; } @@ -908,7 +908,7 @@ auto remote_server::json_release_directory_snapshot( -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = construct_path(path); + auto file_path = construct_path(path); RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0); return 0; @@ -940,10 +940,10 @@ auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = get_open_file_path(file_desc); + auto file_path = get_open_file_path(file_desc); was_closed = FALSE; auto *handle = reinterpret_cast(file_desc); - const auto ret = has_open_info(handle, STATUS_INVALID_HANDLE); + auto ret = has_open_info(handle, STATUS_INVALID_HANDLE); if (ret == STATUS_SUCCESS) { if ((flags & FileSystemBase::CleanupDelete) != 0U) { ::CloseHandle(handle); @@ -958,7 +958,7 @@ auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/, auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = get_open_file_path(file_desc); + auto file_path = get_open_file_path(file_desc); auto *handle = reinterpret_cast(file_desc); if (has_open_info(handle, STATUS_INVALID_HANDLE) == STATUS_SUCCESS) { @@ -978,7 +978,7 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = utils::string::from_utf8(utils::path::combine( + auto file_path = utils::string::from_utf8(utils::path::combine( mount_location_, {utils::string::to_utf8(file_name)})); exists = static_cast( utils::file::file( @@ -1009,7 +1009,7 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, open_info{0, "", nullptr, utils::string::to_utf8(file_path)}); } - const auto ret = + auto ret = (handle == INVALID_HANDLE_VALUE) ? FspNtStatusFromWin32(::GetLastError()) : populate_file_info(construct_api_path(get_open_file_path(handle)), @@ -1062,7 +1062,7 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = utils::string::from_utf8(utils::path::combine( + auto file_path = utils::string::from_utf8(utils::path::combine( mount_location_, {utils::string::to_utf8(file_name)})); auto ret = STATUS_BUFFER_OVERFLOW; @@ -1076,13 +1076,14 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name, descriptor_size); if ((ret == STATUS_SUCCESS) && (descriptor_size != nullptr)) { ULONG str_size{}; - const auto security_info = + auto security_info = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION; LPWSTR str{}; if (::ConvertSecurityDescriptorToStringSecurityDescriptorW( - descriptor, SDDL_REVISION_1, security_info, &str, &str_size) != - 0) { + descriptor, SDDL_REVISION_1, + static_cast(security_info), &str, + &str_size) != 0) { string_descriptor = std::wstring(str, wcslen(str)); ::LocalFree(str); } else { @@ -1124,7 +1125,7 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto file_path = utils::string::from_utf8(utils::path::combine( + auto file_path = utils::string::from_utf8(utils::path::combine( mount_location_, {utils::string::to_utf8(file_name)})); auto create_flags = FILE_FLAG_BACKUP_SEMANTICS; @@ -1143,7 +1144,7 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options, open_info{0, "", nullptr, utils::string::to_utf8(file_path)}); } - const auto ret = + auto ret = (handle == INVALID_HANDLE_VALUE) ? FspNtStatusFromWin32(::GetLastError()) : populate_file_info(construct_api_path(get_open_file_path(handle)), @@ -1238,7 +1239,7 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, open_info ofi{}; if (get_open_info(file_desc, ofi)) { - const auto api_path = + auto api_path = utils::path::create_api_path(ofi.path.substr(mount_location_.size())); directory_iterator iter(drive_.get_directory_items(api_path)); auto offset = marker == nullptr @@ -1264,16 +1265,15 @@ auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); - const auto from_path = utils::string::from_utf8(utils::path::combine( + auto from_path = utils::string::from_utf8(utils::path::combine( mount_location_, {utils::string::to_utf8(file_name)})); - const auto to_path = utils::string::from_utf8(utils::path::combine( + auto to_path = utils::string::from_utf8(utils::path::combine( mount_location_, {utils::string::to_utf8(new_file_name)})); - const auto ret = - ::MoveFileExW(from_path.c_str(), to_path.c_str(), - replace_if_exists == 0U ? 0 : MOVEFILE_REPLACE_EXISTING) != - 0 - ? STATUS_SUCCESS - : FspNtStatusFromWin32(::GetLastError()); + auto ret = ::MoveFileExW( + from_path.c_str(), to_path.c_str(), + replace_if_exists == 0U ? 0 : MOVEFILE_REPLACE_EXISTING) != 0 + ? STATUS_SUCCESS + : FspNtStatusFromWin32(::GetLastError()); RAISE_REMOTE_WINFSP_SERVER_EVENT( function_name, utils::string::to_utf8(from_path + L"|" + to_path), ret); diff --git a/repertory/repertory_test/src/winfsp_drive_delete_test.cpp b/repertory/repertory_test/src/winfsp_drive_delete_test.cpp index f353b353..9c4c17f4 100644 --- a/repertory/repertory_test/src/winfsp_drive_delete_test.cpp +++ b/repertory/repertory_test/src/winfsp_drive_delete_test.cpp @@ -194,6 +194,7 @@ TYPED_TEST(winfsp_test, delete_can_delete_after_mapping) { EXPECT_TRUE(::DeleteFileA(file_path.c_str())); EXPECT_TRUE(::DeleteFileA(file_path2.c_str())); + std::this_thread::sleep_for(2s); EXPECT_TRUE(::RemoveDirectoryA(dir_path.c_str())); EXPECT_FALSE(::RemoveDirectoryA(dir_path.c_str()));