From 1f250e87a36b41436e3b37fcb0f880bfecf1897b Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 31 Oct 2021 15:20:19 +0100 Subject: [PATCH] patterns: Added support for changing pointer endian --- plugins/libimhex/include/hex/pattern_language/ast_node.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp index e00f10a1e..0ef7dc7bc 100644 --- a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp @@ -692,6 +692,7 @@ namespace hex::pl { if (auto pointerPattern = dynamic_cast(pattern)) { u128 value = 0; evaluator->getProvider()->read(pattern->getOffset(), &value, pattern->getSize()); + value = hex::changeEndianess(value, pattern->getSize(), pattern->getEndian()); auto result = function.func(evaluator, { value }); @@ -1088,9 +1089,12 @@ namespace hex::pl { u128 pointerAddress = 0; evaluator->getProvider()->read(pattern->getOffset(), &pointerAddress, pattern->getSize()); + pointerAddress = hex::changeEndianess(pointerAddress, sizePattern->getSize(), sizePattern->getEndian()); + pointedAtPattern->setOffset(pointerAddress); pattern->setPointedAtPattern(pointedAtPattern); + pattern->setEndian(sizePattern->getEndian()); } evaluator->dataOffset() = offset;