Import VirtualAlloc2 if available (Win10+)

Import MapViewOfFile3 as well.
Unused, this crap is tricky.
This commit is contained in:
Nekotekina 2020-11-10 01:40:30 +03:00
parent bd5253047b
commit dcbe8ef5f4

View File

@ -2,6 +2,7 @@
#include "util/logs.hpp"
#include "util/vm.hpp"
#ifdef _WIN32
#include "util/dyn_lib.hpp"
#include <Windows.h>
#else
#include <sys/mman.h>
@ -30,6 +31,11 @@ static int memfd_create_(const char *name, uint flags)
namespace utils
{
#ifdef _WIN32
DYNAMIC_IMPORT("KernelBase.dll", VirtualAlloc2, PVOID(HANDLE Process, PVOID Base, SIZE_T Size, ULONG AllocType, ULONG Prot, MEM_EXTENDED_PARAMETER*, ULONG));
DYNAMIC_IMPORT("KernelBase.dll", MapViewOfFile3, PVOID(HANDLE Handle, HANDLE Process, PVOID Base, ULONG64 Off, SIZE_T ViewSize, ULONG AllocType, ULONG Prot, MEM_EXTENDED_PARAMETER*, ULONG));
#endif
// Convert memory protection (internal)
static auto operator +(protection prot)
{