1
0
Fork 0

DBG: added bswap expression function

This commit is contained in:
Mr. eXoDia 2016-07-29 17:25:42 +02:00
parent e918b773e7
commit 34dbdf35d5
3 changed files with 12 additions and 0 deletions

View File

@ -59,6 +59,8 @@ void ExpressionFunctions::Init()
RegisterEasy("peb\1PEB", peb);
RegisterEasy("teb\1TEB", teb);
RegisterEasy("bswap", bswap);
}
bool ExpressionFunctions::Register(const String & name, int argc, CBEXPRESSIONFUNCTION cbFunction, void* userdata)

View File

@ -57,4 +57,12 @@ namespace Exprfunc
{
return duint(GetTEBLocation(hActiveThread));
}
duint bswap(duint value)
{
duint result = 0;
for(size_t i = 0; i < sizeof(value); i++)
((unsigned char*)&result)[sizeof(value) - i - 1] = ((unsigned char*)&value)[i];
return result;
}
}

View File

@ -15,4 +15,6 @@ namespace Exprfunc
duint peb();
duint teb();
duint bswap(duint value);
}