1
0
Fork 0

DBG: added various memory related expression functions

This commit is contained in:
mrexodia 2016-09-12 15:59:32 +02:00
parent 94a56fa12b
commit d163fc4610
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 30 additions and 0 deletions

View File

@ -66,6 +66,10 @@ void ExpressionFunctions::Init()
RegisterEasy("ternary\1tern", ternary);
RegisterEasy("mem.valid", memvalid);
RegisterEasy("mem.base", membase);
RegisterEasy("mem.size", memsize);
RegisterEasy("mem.iscode", memiscode);
RegisterEasy("mem.decodepointer", memdecodepointer);
RegisterEasy("dis.len", dislen);
RegisterEasy("dis.iscond", disiscond);

View File

@ -85,6 +85,28 @@ namespace Exprfunc
return MemIsValidReadPtr(addr, true);
}
duint membase(duint addr)
{
return MemFindBaseAddr(addr, nullptr);
}
duint memsize(duint addr)
{
duint size;
return MemFindBaseAddr(addr, &size) ? size : 0;
}
duint memiscode(duint addr)
{
return MemIsCodePage(addr, false);
}
duint memdecodepointer(duint ptr)
{
auto decoded = ptr;
return MemDecodePointer(&decoded, true) ? decoded : ptr;
}
duint dislen(duint addr)
{
BASIC_INSTRUCTION_INFO info;

View File

@ -21,6 +21,10 @@ namespace Exprfunc
duint ternary(duint condition, duint value1, duint value2);
duint memvalid(duint addr);
duint membase(duint addr);
duint memsize(duint addr);
duint memiscode(duint addr);
duint memdecodepointer(duint ptr);
duint dislen(duint addr);
duint disiscond(duint addr);