Refactor scripting API to use new accessors
This commit is contained in:
parent
c6da82bf7b
commit
105aaa2ab7
|
@ -29,15 +29,15 @@ SCRIPT_EXPORT bool Script::Memory::RemoteFree(duint addr)
|
||||||
|
|
||||||
SCRIPT_EXPORT unsigned int Script::Memory::GetProtect(duint addr, bool reserved, bool cache)
|
SCRIPT_EXPORT unsigned int Script::Memory::GetProtect(duint addr, bool reserved, bool cache)
|
||||||
{
|
{
|
||||||
if(!cache)
|
unsigned int prot = 0;
|
||||||
MemUpdateMap();
|
if(!MemGetProtect(addr, reserved, cache, &prot))
|
||||||
SHARED_ACQUIRE(LockMemoryPages);
|
|
||||||
auto found = memoryPages.find({ addr, addr });
|
|
||||||
if(found == memoryPages.end())
|
|
||||||
return 0;
|
return 0;
|
||||||
if(!reserved && found->second.mbi.State == MEM_RESERVE) //check if the current page is reserved.
|
return prot;
|
||||||
return 0;
|
}
|
||||||
return found->second.mbi.Protect;
|
|
||||||
|
SCRIPT_EXPORT bool Script::Memory::SetProtect(duint addr, unsigned int protect)
|
||||||
|
{
|
||||||
|
return MemSetProtect(addr, protect);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCRIPT_EXPORT duint Script::Memory::GetBase(duint addr, bool reserved, bool cache)
|
SCRIPT_EXPORT duint Script::Memory::GetBase(duint addr, bool reserved, bool cache)
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Script
|
||||||
SCRIPT_EXPORT duint RemoteAlloc(duint addr, duint size);
|
SCRIPT_EXPORT duint RemoteAlloc(duint addr, duint size);
|
||||||
SCRIPT_EXPORT bool RemoteFree(duint addr);
|
SCRIPT_EXPORT bool RemoteFree(duint addr);
|
||||||
SCRIPT_EXPORT unsigned int GetProtect(duint addr, bool reserved = false, bool cache = true);
|
SCRIPT_EXPORT unsigned int GetProtect(duint addr, bool reserved = false, bool cache = true);
|
||||||
|
SCRIPT_EXPORT bool SetProtect(duint addr, unsigned int protect);
|
||||||
SCRIPT_EXPORT duint GetBase(duint addr, bool reserved = false, bool cache = true);
|
SCRIPT_EXPORT duint GetBase(duint addr, bool reserved = false, bool cache = true);
|
||||||
SCRIPT_EXPORT duint GetSize(duint addr, bool reserved = false, bool cache = true);
|
SCRIPT_EXPORT duint GetSize(duint addr, bool reserved = false, bool cache = true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue