mirror of
https://github.com/monero-project/monero.git
synced 2026-07-28 14:47:15 -07:00
epee: allow shared Windows file reads
Opening a file with a zero sharing mode makes read-only access exclusive on Windows. Allow read and write sharing so callers can inspect files that are already open, such as active log files.
This commit is contained in:
@@ -107,7 +107,7 @@ namespace file_io_utils
|
||||
#ifdef _WIN32
|
||||
std::wstring wide_path;
|
||||
try { wide_path = string_tools::utf8_to_utf16(path_to_file); } catch (...) { return false; }
|
||||
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (file_handle == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
DWORD file_size = GetFileSize(file_handle, NULL);
|
||||
|
||||
Reference in New Issue
Block a user