patterns: Added support for changing pointer endian

This commit is contained in:
WerWolv 2021-10-31 15:20:19 +01:00
parent cd89b55f5b
commit 1f250e87a3
1 changed files with 4 additions and 0 deletions

View File

@ -692,6 +692,7 @@ namespace hex::pl {
if (auto pointerPattern = dynamic_cast<PatternDataPointer*>(pattern)) { if (auto pointerPattern = dynamic_cast<PatternDataPointer*>(pattern)) {
u128 value = 0; u128 value = 0;
evaluator->getProvider()->read(pattern->getOffset(), &value, pattern->getSize()); evaluator->getProvider()->read(pattern->getOffset(), &value, pattern->getSize());
value = hex::changeEndianess(value, pattern->getSize(), pattern->getEndian());
auto result = function.func(evaluator, { value }); auto result = function.func(evaluator, { value });
@ -1088,9 +1089,12 @@ namespace hex::pl {
u128 pointerAddress = 0; u128 pointerAddress = 0;
evaluator->getProvider()->read(pattern->getOffset(), &pointerAddress, pattern->getSize()); evaluator->getProvider()->read(pattern->getOffset(), &pointerAddress, pattern->getSize());
pointerAddress = hex::changeEndianess(pointerAddress, sizePattern->getSize(), sizePattern->getEndian());
pointedAtPattern->setOffset(pointerAddress); pointedAtPattern->setOffset(pointerAddress);
pattern->setPointedAtPattern(pointedAtPattern); pattern->setPointedAtPattern(pointedAtPattern);
pattern->setEndian(sizePattern->getEndian());
} }
evaluator->dataOffset() = offset; evaluator->dataOffset() = offset;