fix-mingw.diff 866 B

1234567891011121314151617181920
  1. diff --git a/httplib.h b/httplib.h
  2. index 749fa61..f3b714b 100644
  3. --- a/httplib.h
  4. +++ b/httplib.h
  5. @@ -3057,8 +3057,13 @@ inline bool mmap::open(const char *path) {
  6. auto wpath = u8string_to_wstring(path);
  7. if (wpath.empty()) { return false; }
  8. - hFile_ = ::CreateFile2(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ,
  9. - OPEN_EXISTING, NULL);
  10. + #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) && (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
  11. + hFile_ = ::CreateFile2(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ,
  12. + OPEN_EXISTING, NULL);
  13. + #else
  14. + hFile_ = ::CreateFileW(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL,
  15. + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  16. + #endif
  17. if (hFile_ == INVALID_HANDLE_VALUE) { return false; }