mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
Added unprotectExecutableMemory for future use.
This commit is contained in:
parent
f620ffe899
commit
ac43cd4f9c
3 changed files with 14 additions and 0 deletions
|
@ -43,6 +43,7 @@ public:
|
|||
static void flushInstructionCache(void *p, size_t size);
|
||||
static void freeLargePagesMemory(void *p, size_t size);
|
||||
static void protectExecutableMemory(void *p, size_t size);
|
||||
static void unprotectExecutableMemory(void *p, size_t size);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -82,3 +82,9 @@ void xmrig::VirtualMemory::protectExecutableMemory(void *p, size_t size)
|
|||
{
|
||||
mprotect(p, size, PROT_READ | PROT_EXEC);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::VirtualMemory::unprotectExecutableMemory(void *p, size_t size)
|
||||
{
|
||||
mprotect(p, size, PROT_WRITE | PROT_EXEC);
|
||||
}
|
||||
|
|
|
@ -77,3 +77,10 @@ void xmrig::VirtualMemory::protectExecutableMemory(void *p, size_t size)
|
|||
DWORD oldProtect;
|
||||
VirtualProtect(p, size, PAGE_EXECUTE_READ, &oldProtect);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::VirtualMemory::unprotectExecutableMemory(void *p, size_t size)
|
||||
{
|
||||
DWORD oldProtect;
|
||||
VirtualProtect(p, size, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue