This commit is contained in:
2025-01-21 14:59:11 -06:00
parent 1c65f51ef4
commit f57bbdbb50

View File

@ -102,7 +102,9 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/)
((mount_location.size() == 3U) && (mount_location[2U] == '\\'))) &&
(mount_location[1U] == ':');
auto ret = drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED;
auto ret{
drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED,
};
if ((drive_letter && not utils::file::directory(mount_location).exists())) {
auto unicode_mount_location = utils::string::from_utf8(mount_location);
host_.SetFileSystemName(unicode_mount_location.data());
@ -118,16 +120,17 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/)
<< mount_location << std::endl;
}
if (ret != STATUS_SUCCESS) {
if (not lock_.set_mount_state(false, "", -1)) {
utils::error::raise_error(function_name, ret,
"failed to set mount state");
}
event_system::instance().raise<drive_mount_failed>(mount_location,
std::to_string(ret));
if (ret == STATUS_SUCCESS) {
return ret;
}
if (not lock_.set_mount_state(false, "", -1)) {
utils::error::raise_error(function_name, ret, "failed to set mount state");
}
event_system::instance().raise<drive_mount_failed>(mount_location,
std::to_string(ret));
return ret;
}