Fix the bug in Win32 that fails to retrieve sizes larger than 4GB. (#3707 #3702)

This commit is contained in:
PioLing 2024-07-10 10:43:14 +08:00 committed by GitHub
parent f24802d0e4
commit 3e7e1a317e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,7 +141,9 @@ static std::shared_ptr<char> getSharedMmap(const string &file_path, int64_t &fil
return nullptr;
}
file_size = ::GetFileSize(hfile, NULL);
LARGE_INTEGER FileSize;
GetFileSizeEx(hfile, &FileSize); //GetFileSize函数的拓展可用于获取大于4G的文件大小
file_size = FileSize.QuadPart;
auto hmapping = ::CreateFileMapping(hfile, NULL, PAGE_READONLY, 0, 0, NULL);