|
|
@ -488,7 +488,7 @@ int Process::memDealloc(void *ptr, const int length)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// can only free the whole region at once
|
|
|
|
// can only free the whole region at once
|
|
|
|
// vfree returns 0 on error
|
|
|
|
// vfree returns 0 on error
|
|
|
|
return !VirtualFree(ptr, 0, MEM_RELEASE)
|
|
|
|
return !VirtualFree(ptr, 0, MEM_RELEASE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Process::memProtect(void *ptr, const int length, const int prot)
|
|
|
|
int Process::memProtect(void *ptr, const int length, const int prot)
|
|
|
@ -501,11 +501,11 @@ int Process::memProtect(void *ptr, const int length, const int prot)
|
|
|
|
prot_native = PAGE_NOACCESS;
|
|
|
|
prot_native = PAGE_NOACCESS;
|
|
|
|
else if (prot == Process::MemProt::READ)
|
|
|
|
else if (prot == Process::MemProt::READ)
|
|
|
|
prot_native = PAGE_READONLY;
|
|
|
|
prot_native = PAGE_READONLY;
|
|
|
|
else if (prot == Process::MemProt::READ | Process::MemProt::WRITE)
|
|
|
|
else if (prot == (Process::MemProt::READ | Process::MemProt::WRITE))
|
|
|
|
prot_native = PAGE_READWRITE;
|
|
|
|
prot_native = PAGE_READWRITE;
|
|
|
|
else if (prot == Process::MemProt::READ | Process::MemProt::WRITE | Process::MemProt::EXECUTE)
|
|
|
|
else if (prot == (Process::MemProt::READ | Process::MemProt::WRITE | Process::MemProt::EXEC))
|
|
|
|
prot_native = PAGE_EXECUTE_READWRITE;
|
|
|
|
prot_native = PAGE_EXECUTE_READWRITE;
|
|
|
|
else if (prot == Process::MemProt::READ | Process::MemProt::EXECUTE)
|
|
|
|
else if (prot == (Process::MemProt::READ | Process::MemProt::EXEC))
|
|
|
|
prot_native = PAGE_EXECUTE_READ;
|
|
|
|
prot_native = PAGE_EXECUTE_READ;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|