diff --git a/repertory/librepertory/include/events/types/drive_mount_failed.hpp b/repertory/librepertory/include/events/types/drive_mount_failed.hpp index 416e3834..90a8f8dd 100644 --- a/repertory/librepertory/include/events/types/drive_mount_failed.hpp +++ b/repertory/librepertory/include/events/types/drive_mount_failed.hpp @@ -29,18 +29,18 @@ namespace repertory { struct drive_mount_failed final : public i_event { drive_mount_failed() = default; - drive_mount_failed(std::string_view function_name_, - std::string mount_location_, NTSTATUS status_) - : function_name(std::string(function_name_)), - mount_location(std::move(mount_location_)), - status(status_) {} + drive_mount_failed(NTSTATUS error_, std::string_view function_name_, + std::string mount_location_) + : error(error_), + function_name(std::string(function_name_)), + mount_location(std::move(mount_location_)) {} static constexpr const event_level level{event_level::error}; static constexpr const std::string_view name{"drive_mount_failed"}; + NTSTATUS error{}; std::string function_name; std::string mount_location; - NTSTATUS status{}; [[nodiscard]] auto get_event_level() const -> event_level override { return level; @@ -52,7 +52,7 @@ struct drive_mount_failed final : public i_event { [[nodiscard]] auto get_single_line() const -> std::string override { return fmt::format("{}|func|{}|location|{}|status|{}", name, function_name, - mount_location, status); + mount_location, error); } }; } // namespace repertory @@ -60,16 +60,16 @@ struct drive_mount_failed final : public i_event { NLOHMANN_JSON_NAMESPACE_BEGIN template <> struct adl_serializer { static void to_json(json &data, const repertory::drive_mount_failed &value) { + data["error"] = value.error; data["function_name"] = value.function_name; data["mount_location"] = value.mount_location; - data["status"] = value.status; } static void from_json(const json &data, repertory::drive_mount_failed &value) { + data.at("error").get_to(value.error); data.at("function_name").get_to(value.function_name); data.at("mount_location").get_to(value.mount_location); - data.at("status").get_to(value.status); } }; NLOHMANN_JSON_NAMESPACE_END diff --git a/repertory/librepertory/include/events/types/remote_server_event.hpp b/repertory/librepertory/include/events/types/remote_server_event.hpp index bb5c847c..52d456e6 100644 --- a/repertory/librepertory/include/events/types/remote_server_event.hpp +++ b/repertory/librepertory/include/events/types/remote_server_event.hpp @@ -68,7 +68,7 @@ template <> struct adl_serializer { static void from_json(const json &data, repertory::remote_server_event &value) { data.at("api_path").get_to(value.api_path); - data.at("error").get_to(value.error); + data.at("error").get_to(value.error); data.at("function_name").get_to(value.function_name); } }; diff --git a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp index dba4f2f7..6dc41b1e 100644 --- a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp @@ -77,8 +77,8 @@ auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS { } if (ret != STATUS_SUCCESS) { - event_system::instance().raise(function_name, - mount_location, ret); + event_system::instance().raise(ret, function_name, + mount_location); if (not lock_.set_mount_state(false, "", -1)) { utils::error::raise_error(function_name, "failed to set mount state"); } @@ -129,8 +129,8 @@ auto remote_winfsp_drive::Create(PWSTR file_name, UINT32 create_options, UINT32 granted_access, UINT32 attributes, PSECURITY_DESCRIPTOR /*descriptor*/, UINT64 allocation_size, PVOID * /*file_node*/, - PVOID *file_desc, - OpenFileInfo *ofi) -> NTSTATUS { + PVOID *file_desc, OpenFileInfo *ofi) + -> NTSTATUS { remote::file_info fi{}; std::string normalized_name; BOOLEAN exists = 0; @@ -164,9 +164,10 @@ auto remote_winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc, return ret; } -auto remote_winfsp_drive::GetSecurityByName( - PWSTR file_name, PUINT32 attributes, PSECURITY_DESCRIPTOR descriptor, - SIZE_T *descriptor_size) -> NTSTATUS { +auto remote_winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes, + PSECURITY_DESCRIPTOR descriptor, + SIZE_T *descriptor_size) + -> NTSTATUS { std::wstring string_descriptor; std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size; auto ret = remote_instance_->winfsp_get_security_by_name( @@ -262,7 +263,7 @@ auto remote_winfsp_drive::mount(const std::vector &drive_args) auto ret = winfsp_service(lock_, *this, parsed_drive_args, config_).Run(); event_system::instance().raise(function_name, "", - std::to_string(ret)); + std::to_string(ret)); event_system::instance().stop(); c.reset(); return static_cast(ret); @@ -286,8 +287,8 @@ auto remote_winfsp_drive::Mounted(PVOID host) -> NTSTATUS { auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options, UINT32 granted_access, PVOID * /*file_node*/, - PVOID *file_desc, - OpenFileInfo *ofi) -> NTSTATUS { + PVOID *file_desc, OpenFileInfo *ofi) + -> NTSTATUS { remote::file_info fi{}; std::string normalize_name; auto ret = @@ -307,8 +308,8 @@ auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options, auto remote_winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, - UINT64 allocation_size, - FileInfo *file_info) -> NTSTATUS { + UINT64 allocation_size, FileInfo *file_info) + -> NTSTATUS { remote::file_info info{}; auto ret = remote_instance_->winfsp_overwrite( file_desc, attributes, replace_attributes, allocation_size, &info); @@ -425,8 +426,8 @@ auto remote_winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc, UINT32 attributes, UINT64 creation_time, UINT64 last_access_time, UINT64 last_write_time, - UINT64 change_time, - FileInfo *file_info) -> NTSTATUS { + UINT64 change_time, FileInfo *file_info) + -> NTSTATUS { remote::file_info fi{}; auto ret = remote_instance_->winfsp_set_basic_info( file_desc, attributes, creation_time, last_access_time, last_write_time, @@ -478,8 +479,8 @@ VOID remote_winfsp_drive::Unmounted(PVOID host) { auto remote_winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc, PVOID buffer, UINT64 offset, ULONG length, BOOLEAN write_to_end, BOOLEAN constrained_io, - PULONG bytes_transferred, - FileInfo *file_info) -> NTSTATUS { + PULONG bytes_transferred, FileInfo *file_info) + -> NTSTATUS { remote::file_info fi{}; auto ret = remote_instance_->winfsp_write( file_desc, buffer, offset, length, write_to_end, constrained_io, diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index f24cc820..2a61be01 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -127,8 +127,8 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/) utils::error::raise_error(function_name, ret, "failed to set mount state"); } - event_system::instance().raise(function_name, - mount_location, ret); + event_system::instance().raise(ret, function_name, + mount_location); return ret; }