2525 " cpp-httplib doesn't support platforms where size_t is less than 64 bits."
2626#endif
2727
28+ #ifdef _WIN32
29+ #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0602
30+ #error \
31+ " cpp-httplib doesn't support Windows 8 or lower. Please use Windows 10 or later."
32+ #endif
33+ #endif
34+
2835/*
2936 * Configuration
3037 */
@@ -3036,13 +3043,8 @@ inline bool mmap::open(const char *path) {
30363043 auto wpath = u8string_to_wstring (path);
30373044 if (wpath.empty ()) { return false ; }
30383045
3039- #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
30403046 hFile_ = ::CreateFile2 (wpath.c_str (), GENERIC_READ, FILE_SHARE_READ,
30413047 OPEN_EXISTING, NULL );
3042- #else
3043- hFile_ = ::CreateFileW (wpath.c_str (), GENERIC_READ, FILE_SHARE_READ, NULL ,
3044- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
3045- #endif
30463048
30473049 if (hFile_ == INVALID_HANDLE_VALUE) { return false ; }
30483050
@@ -3058,12 +3060,8 @@ inline bool mmap::open(const char *path) {
30583060 }
30593061 size_ = static_cast <size_t >(size.QuadPart );
30603062
3061- #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
30623063 hMapping_ =
30633064 ::CreateFileMappingFromApp (hFile_, NULL , PAGE_READONLY, size_, NULL );
3064- #else
3065- hMapping_ = ::CreateFileMappingW (hFile_, NULL , PAGE_READONLY, 0 , 0 , NULL );
3066- #endif
30673065
30683066 // Special treatment for an empty file...
30693067 if (hMapping_ == NULL && size_ == 0 ) {
@@ -3077,11 +3075,7 @@ inline bool mmap::open(const char *path) {
30773075 return false ;
30783076 }
30793077
3080- #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
30813078 addr_ = ::MapViewOfFileFromApp (hMapping_, FILE_MAP_READ, 0 , 0 );
3082- #else
3083- addr_ = ::MapViewOfFile (hMapping_, FILE_MAP_READ, 0 , 0 , 0 );
3084- #endif
30853079
30863080 if (addr_ == nullptr ) {
30873081 close ();
0 commit comments