2 * mono-dl-windows-uwp.c: UWP dl support for Mono.
4 * Copyright 2016 Microsoft
5 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
10 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
12 #include <mono/utils/mono-mmap-windows.h>
15 mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle)
20 int prot = mono_mmap_win_prot_from_flags (flags);
22 mflags = FILE_MAP_READ;
23 if (flags & MONO_MMAP_WRITE)
24 mflags = FILE_MAP_COPY;
26 file = (HANDLE) _get_osfhandle (fd);
27 mapping = CreateFileMappingFromApp (file, NULL, prot, length, NULL);
32 ptr = MapViewOfFileFromApp (mapping, mflags, offset, length);
35 CloseHandle (mapping);
39 *ret_handle = (void*)mapping;
44 mono_file_unmap (void *addr, void *handle)
46 UnmapViewOfFile (addr);
47 CloseHandle ((HANDLE)handle);
51 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
54 // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
55 void __mono_win32_mono_mmap_windows_uwp_quiet_lnk4221(void) {}
57 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */