File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,12 @@ using ssize_t = __int64;
215
215
#define NOMINMAX
216
216
#endif // NOMINMAX
217
217
218
+ #ifndef HAVE_CREATEFILE2
219
+ #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602 && !defined(__MINGW32__)
220
+ #define HAVE_CREATEFILE2 1
221
+ #endif
222
+ #endif
223
+
218
224
#include < io.h>
219
225
#include < winsock2.h>
220
226
#include < ws2tcpip.h>
@@ -3078,9 +3084,13 @@ inline bool mmap::open(const char *path) {
3078
3084
auto wpath = u8string_to_wstring (path);
3079
3085
if (wpath.empty ()) { return false ; }
3080
3086
3087
+ #if defined(HAVE_CREATEFILE2)
3081
3088
hFile_ = ::CreateFile2 (wpath.c_str (), GENERIC_READ, FILE_SHARE_READ,
3082
3089
OPEN_EXISTING, NULL );
3083
-
3090
+ #else
3091
+ hFile_ = ::CreateFileW (wpath.c_str (), GENERIC_READ, FILE_SHARE_READ,
3092
+ OPEN_EXISTING, NULL );
3093
+ #endif
3084
3094
if (hFile_ == INVALID_HANDLE_VALUE) { return false ; }
3085
3095
3086
3096
LARGE_INTEGER size{};
You can’t perform that action at this time.
0 commit comments