This commit is contained in:
Scott E. Graves 2024-10-28 14:18:24 -05:00
parent ed8ec257cc
commit 7eb12d09f9

View File

@ -1043,7 +1043,7 @@ auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
auto handle =
static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(file_desc));
if (handle == 0U || not fm_->get_open_file(handle, true, file)) {
if (handle == 0U || not fm_->get_open_file(handle, false, file)) {
return handle_error(api_error::invalid_handle);
}
@ -1211,12 +1211,13 @@ auto winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc, PVOID buffer,
}
if (constrained_io != 0U) {
if (offset >= file->get_file_size()) {
auto file_size = file->get_file_size();
if (offset >= file_size) {
return handle_error(api_error::success);
}
if (offset + length > file->get_file_size()) {
length = static_cast<ULONG>(file->get_file_size() - offset);
if (offset + length >) {
length = static_cast<ULONG>(file_size - offset);
}
}