-/*
- * file-mmap-windows.c: MemoryMappedFile internal calls for Windows
+/**
+ * \file
+ * MemoryMappedFile internal calls for Windows
*
* Copyright 2016 Microsoft
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
-
-#ifdef HOST_WIN32
+#include <glib.h>
+#include <mono/utils/mono-compiler.h>
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) && defined(HOST_WIN32)
#include <glib.h>
HANDLE result = NULL;
if (handle == INVALID_HANDLE_VALUE) {
- if (*capacity <= 0) {
+ if (*capacity <= 0 && mode != FILE_MODE_OPEN) {
*error = CAPACITY_MUST_BE_POSITIVE;
return NULL;
}
result = open_handle (hFile, mapName, mode, capacity, access, options, error);
done:
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle (hFile);
if (!result && delete_on_error)
DeleteFileW (w_path);
if (w_path)
return result;
}
+#else
+
+MONO_EMPTY_SOURCE_FILE (file_mmap_windows);
+
#endif