From 8b127f0cc5e418d28f4eab63ce05cc88a11c6d8a Mon Sep 17 00:00:00 2001 From: LIU Xiao Date: Sat, 29 Jun 2024 19:30:55 +0800 Subject: [PATCH] server: Windows 7 compatibility --- examples/server/httplib.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/server/httplib.h b/examples/server/httplib.h index f360bd93e..2e5fc1eba 100644 --- a/examples/server/httplib.h +++ b/examples/server/httplib.h @@ -2693,8 +2693,8 @@ inline bool mmap::open(const char *path) { wpath += path[i]; } - hFile_ = ::CreateFile2(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ, - OPEN_EXISTING, NULL); + hFile_ = ::CreateFileW(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); if (hFile_ == INVALID_HANDLE_VALUE) { return false; } @@ -2703,14 +2703,14 @@ inline bool mmap::open(const char *path) { size_ = static_cast(size.QuadPart); hMapping_ = - ::CreateFileMappingFromApp(hFile_, NULL, PAGE_READONLY, size_, NULL); + ::CreateFileMappingW(hFile_, NULL, PAGE_READONLY, size.HighPart, size.LowPart, NULL); if (hMapping_ == NULL) { close(); return false; } - addr_ = ::MapViewOfFileFromApp(hMapping_, FILE_MAP_READ, 0, 0); + addr_ = ::MapViewOfFile(hMapping_, FILE_MAP_READ, 0, 0, 0); #else fd_ = ::open(path, O_RDONLY); if (fd_ == -1) { return false; }