patterns: Add std::mem::read_string
This commit is contained in:
parent
471ba80b4d
commit
85b8698e35
@ -164,6 +164,17 @@ namespace hex::plugin::builtin {
|
||||
return hex::signExtend(size * 8, value);
|
||||
});
|
||||
|
||||
/* read_string(address, size) */
|
||||
ContentRegistry::PatternLanguageFunctions::add(nsStdMem, "read_string", 2, [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
|
||||
auto address = Token::literalToUnsigned(params[0]);
|
||||
auto size = Token::literalToUnsigned(params[1]);
|
||||
|
||||
std::string result(size, '\x00');
|
||||
ctx->getProvider()->read(address, result.data(), size);
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ContentRegistry::PatternLanguageFunctions::Namespace nsStdStr = { "std", "str" };
|
||||
|
Loading…
Reference in New Issue
Block a user