mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 19:10:23 -10:00
This implements the icalls in file-mmap-windows.c used by MemoryMappedFile. The implementation has been inspired by the CoreFX MemoryMappedFile implementation. This patch also fixes a few incompatibilities between .NET and Mono: * The default MemoryMappedFileOptions has been changed from DelayAllocatePages to None. * mono_pagesize() on Windows now return SYSTEM_INFO.dwPageSize, the same as .NET and CoreFX. * Added mono_valloc_granule() which returns SYSTEM_INFO.dwAllocationGranularity and changed mono-codeman.c to use it when trying to allocate adjacent virtual memory. * MemoryMappedFileTest has been updated to succeed on .NET. * A test has been added to test correct DelayAllocatePages behavior (only supported on Mono on Windows, the flag is ignored on other platforms). * The posix MemoryMappedFile code has been changed to throw UnauthorizedAccessException rather than IOException when trying to create a view outside of the bounds of a MemoryMappedFile. * Creating a named mapping larger than 4GB on 32-bit systems now throws ArgumentOutOfRangeException.