mirror of
https://github.com/danog/ir.git
synced 2024-11-30 04:39:43 +01:00
Fix executable memory mapping for Windows
This commit is contained in:
parent
eb771b1fef
commit
9ded5ace4b
4
ir.c
4
ir.c
@ -1227,12 +1227,12 @@ void *ir_mem_mmap(size_t size)
|
|||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
DWORD size_hi = size >> 32, size_lo = size & 0xffffffff;
|
DWORD size_hi = size >> 32, size_lo = size & 0xffffffff;
|
||||||
#else
|
#else
|
||||||
DWORD size_hi = size, size_lo = 0;
|
DWORD size_hi = 0, size_lo = size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HANDLE h = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_EXECUTE_READWRITE, size_hi, size_lo, NULL);
|
HANDLE h = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_EXECUTE_READWRITE, size_hi, size_lo, NULL);
|
||||||
|
|
||||||
ret = MapViewOfFile(h, FILE_MAP_COPY | FILE_MAP_EXECUTE, size_hi, size_lo, size);
|
ret = MapViewOfFile(h, FILE_MAP_READ | FILE_MAP_WRITE | FILE_MAP_EXECUTE, 0, 0, size);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user