From 3e7e1a317eac76f0b79752ccfcb6e11c5de85064 Mon Sep 17 00:00:00 2001 From: PioLing <964472638@qq.com> Date: Wed, 10 Jul 2024 10:43:14 +0800 Subject: [PATCH] Fix the bug in Win32 that fails to retrieve sizes larger than 4GB. (#3707 #3702) --- src/Http/HttpBody.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Http/HttpBody.cpp b/src/Http/HttpBody.cpp index a406a076..a6aeb695 100644 --- a/src/Http/HttpBody.cpp +++ b/src/Http/HttpBody.cpp @@ -141,7 +141,9 @@ static std::shared_ptr 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);