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.
9 #include "mono/utils/mono-compiler.h"
11 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
13 #include <mono/utils/mono-mmap-windows-internals.h>
16 mono_file_map (size_t length
, int flags
, int fd
, guint64 offset
, void **ret_handle
)
21 int prot
= mono_mmap_win_prot_from_flags (flags
);
23 mflags
= FILE_MAP_READ
;
24 if (flags
& MONO_MMAP_WRITE
)
25 mflags
= FILE_MAP_COPY
;
27 file
= (HANDLE
) _get_osfhandle (fd
);
28 mapping
= CreateFileMappingFromApp (file
, NULL
, prot
, length
, NULL
);
33 ptr
= MapViewOfFileFromApp (mapping
, mflags
, offset
, length
);
36 CloseHandle (mapping
);
40 *ret_handle
= (void*)mapping
;
45 mono_file_unmap (void *addr
, void *handle
)
47 UnmapViewOfFile (addr
);
48 CloseHandle ((HANDLE
)handle
);
52 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
54 MONO_EMPTY_SOURCE_FILE (mono_mmap_windows_uwp
);
55 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */