25
25
" cpp-httplib doesn't support platforms where size_t is less than 64 bits."
26
26
#endif
27
27
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
+
28
35
/*
29
36
* Configuration
30
37
*/
@@ -3036,13 +3043,8 @@ inline bool mmap::open(const char *path) {
3036
3043
auto wpath = u8string_to_wstring (path);
3037
3044
if (wpath.empty ()) { return false ; }
3038
3045
3039
- #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
3040
3046
hFile_ = ::CreateFile2 (wpath.c_str (), GENERIC_READ, FILE_SHARE_READ,
3041
3047
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
3046
3048
3047
3049
if (hFile_ == INVALID_HANDLE_VALUE) { return false ; }
3048
3050
@@ -3058,12 +3060,8 @@ inline bool mmap::open(const char *path) {
3058
3060
}
3059
3061
size_ = static_cast <size_t >(size.QuadPart );
3060
3062
3061
- #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
3062
3063
hMapping_ =
3063
3064
::CreateFileMappingFromApp (hFile_, NULL , PAGE_READONLY, size_, NULL );
3064
- #else
3065
- hMapping_ = ::CreateFileMappingW (hFile_, NULL , PAGE_READONLY, 0 , 0 , NULL );
3066
- #endif
3067
3065
3068
3066
// Special treatment for an empty file...
3069
3067
if (hMapping_ == NULL && size_ == 0 ) {
@@ -3077,11 +3075,7 @@ inline bool mmap::open(const char *path) {
3077
3075
return false ;
3078
3076
}
3079
3077
3080
- #if _WIN32_WINNT >= _WIN32_WINNT_WIN8
3081
3078
addr_ = ::MapViewOfFileFromApp (hMapping_, FILE_MAP_READ, 0 , 0 );
3082
- #else
3083
- addr_ = ::MapViewOfFile (hMapping_, FILE_MAP_READ, 0 , 0 , 0 );
3084
- #endif
3085
3079
3086
3080
if (addr_ == nullptr ) {
3087
3081
close ();
0 commit comments