diff options
| author | KyleMiles <krm504@nyu.edu> | 2022-01-27 22:43:28 -0500 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2022-01-28 00:24:06 -0500 |
| commit | 6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch) | |
| tree | dace4156d03148bcaf02df138ab4e0d93e61bc6f /relocationhandler.cpp | |
| parent | 519c9db22367f2659d1a54599fab47e6313be06e (diff) | |
Format All Files
Diffstat (limited to 'relocationhandler.cpp')
| -rw-r--r-- | relocationhandler.cpp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/relocationhandler.cpp b/relocationhandler.cpp index e2746168..04af3afe 100644 --- a/relocationhandler.cpp +++ b/relocationhandler.cpp @@ -51,8 +51,8 @@ void RelocationHandler::FreeCallback(void* ctxt) } -bool RelocationHandler::GetRelocationInfoCallback(void* ctxt, BNBinaryView* view, BNArchitecture* arch, - BNRelocationInfo* result, size_t resultCount) +bool RelocationHandler::GetRelocationInfoCallback( + void* ctxt, BNBinaryView* view, BNArchitecture* arch, BNRelocationInfo* result, size_t resultCount) { RelocationHandler* handler = (RelocationHandler*)ctxt; Ref<BinaryView> viewObj = new BinaryView(BNNewViewReference(view)); @@ -67,8 +67,8 @@ bool RelocationHandler::GetRelocationInfoCallback(void* ctxt, BNBinaryView* view } -bool RelocationHandler::ApplyRelocationCallback(void* ctxt, BNBinaryView* view, BNArchitecture* arch, BNRelocation* reloc, - uint8_t* dest, size_t len) +bool RelocationHandler::ApplyRelocationCallback( + void* ctxt, BNBinaryView* view, BNArchitecture* arch, BNRelocation* reloc, uint8_t* dest, size_t len) { RelocationHandler* handler = (RelocationHandler*)ctxt; Ref<Architecture> archObj = new CoreArchitecture(arch); @@ -78,8 +78,8 @@ bool RelocationHandler::ApplyRelocationCallback(void* ctxt, BNBinaryView* view, } -size_t RelocationHandler::GetOperandForExternalRelocationCallback(void* ctxt, const uint8_t* data, uint64_t addr, - size_t length, BNLowLevelILFunction* il, BNRelocation* reloc) +size_t RelocationHandler::GetOperandForExternalRelocationCallback( + void* ctxt, const uint8_t* data, uint64_t addr, size_t length, BNLowLevelILFunction* il, BNRelocation* reloc) { RelocationHandler* handler = (RelocationHandler*)ctxt; Ref<LowLevelILFunction> func(new LowLevelILFunction(BNNewLowLevelILFunctionReference(il))); @@ -88,7 +88,8 @@ size_t RelocationHandler::GetOperandForExternalRelocationCallback(void* ctxt, co } -bool RelocationHandler::GetRelocationInfo(Ref<BinaryView> view, Ref<Architecture> arch, std::vector<BNRelocationInfo>& result) +bool RelocationHandler::GetRelocationInfo( + Ref<BinaryView> view, Ref<Architecture> arch, std::vector<BNRelocationInfo>& result) { (void)view; (void)arch; @@ -97,16 +98,16 @@ bool RelocationHandler::GetRelocationInfo(Ref<BinaryView> view, Ref<Architecture } -bool RelocationHandler::ApplyRelocation(Ref<BinaryView> view, Ref<Architecture> arch, Ref<Relocation> reloc, uint8_t* dest, - size_t len) +bool RelocationHandler::ApplyRelocation( + Ref<BinaryView> view, Ref<Architecture> arch, Ref<Relocation> reloc, uint8_t* dest, size_t len) { - return BNRelocationHandlerDefaultApplyRelocation(m_object, view->GetObject(), arch->GetObject(), - BNNewRelocationReference(reloc->GetObject()), dest, len); + return BNRelocationHandlerDefaultApplyRelocation( + m_object, view->GetObject(), arch->GetObject(), BNNewRelocationReference(reloc->GetObject()), dest, len); } -size_t RelocationHandler::GetOperandForExternalRelocation(const uint8_t* data, uint64_t addr, size_t length, - Ref<LowLevelILFunction> il, Ref<Relocation> relocation) +size_t RelocationHandler::GetOperandForExternalRelocation( + const uint8_t* data, uint64_t addr, size_t length, Ref<LowLevelILFunction> il, Ref<Relocation> relocation) { (void)data; (void)addr; @@ -117,34 +118,34 @@ size_t RelocationHandler::GetOperandForExternalRelocation(const uint8_t* data, u } -CoreRelocationHandler::CoreRelocationHandler(BNRelocationHandler* handler) : RelocationHandler(handler) -{ -} +CoreRelocationHandler::CoreRelocationHandler(BNRelocationHandler* handler) : RelocationHandler(handler) {} -bool CoreRelocationHandler::ApplyRelocation(Ref<BinaryView> view, Ref<Architecture> arch, Ref<Relocation> reloc, uint8_t* dest, - size_t len) +bool CoreRelocationHandler::ApplyRelocation( + Ref<BinaryView> view, Ref<Architecture> arch, Ref<Relocation> reloc, uint8_t* dest, size_t len) { - return BNRelocationHandlerApplyRelocation(m_object, view->GetObject(), arch->GetObject(), BNNewRelocationReference(reloc->GetObject()), dest, len); + return BNRelocationHandlerApplyRelocation( + m_object, view->GetObject(), arch->GetObject(), BNNewRelocationReference(reloc->GetObject()), dest, len); } -bool CoreRelocationHandler::GetRelocationInfo(Ref<BinaryView> view, Ref<Architecture> arch, std::vector<BNRelocationInfo>& result) +bool CoreRelocationHandler::GetRelocationInfo( + Ref<BinaryView> view, Ref<Architecture> arch, std::vector<BNRelocationInfo>& result) { BNRelocationInfo* results = new BNRelocationInfo[result.size()]; for (size_t i = 0; i < result.size(); i++) results[i] = result[i]; - bool status = BNRelocationHandlerGetRelocationInfo(m_object, view->GetObject(), arch->GetObject(), results, - result.size()); + bool status = + BNRelocationHandlerGetRelocationInfo(m_object, view->GetObject(), arch->GetObject(), results, result.size()); for (size_t i = 0; i < result.size(); i++) result[i] = results[i]; return status; } -size_t CoreRelocationHandler::GetOperandForExternalRelocation(const uint8_t* data, uint64_t addr, size_t length, - Ref<LowLevelILFunction> il, Ref<Relocation> relocation) +size_t CoreRelocationHandler::GetOperandForExternalRelocation( + const uint8_t* data, uint64_t addr, size_t length, Ref<LowLevelILFunction> il, Ref<Relocation> relocation) { - return BNRelocationHandlerGetOperandForExternalRelocation(m_object, data, addr, length, il->GetObject(), - BNNewRelocationReference(relocation->GetObject())); + return BNRelocationHandlerGetOperandForExternalRelocation( + m_object, data, addr, length, il->GetObject(), BNNewRelocationReference(relocation->GetObject())); } |
