Skip to content

Commit 2763a55

Browse files
committed
Add optional display name field for memory regions.
1 parent 6fe6761 commit 2763a55

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

binaryninjaapi.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8254,6 +8254,19 @@ namespace BinaryNinja {
82548254
return BNSetMemoryRegionFill(m_object, name.c_str(), fill);
82558255
}
82568256

8257+
std::string GetMemoryRegionDisplayName(const std::string& name)
8258+
{
8259+
char* displayName = BNGetMemoryRegionDisplayName(m_object, name.c_str());
8260+
std::string result = displayName;
8261+
BNFreeString(displayName);
8262+
return result;
8263+
}
8264+
8265+
bool SetMemoryRegionDisplayName(const std::string& name, const std::string& displayName)
8266+
{
8267+
return BNSetMemoryRegionDisplayName(m_object, name.c_str(), displayName.c_str());
8268+
}
8269+
82578270
bool IsMemoryRegionLocal(const std::string& name)
82588271
{
82598272
return BNIsMemoryRegionLocal(m_object, name.c_str());

binaryninjacore.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// Current ABI version for linking to the core. This is incremented any time
3838
// there are changes to the API that affect linking, including new functions,
3939
// new types, or modifications to existing functions or types.
40-
#define BN_CURRENT_CORE_ABI_VERSION 144
40+
#define BN_CURRENT_CORE_ABI_VERSION 145
4141

4242
// Minimum ABI version that is supported for loading of plugins. Plugins that
4343
// are linked to an ABI version less than this will not be able to load and
@@ -4399,6 +4399,8 @@ extern "C"
43994399
BINARYNINJACOREAPI bool BNSetMemoryRegionRebaseable(BNBinaryView* view, const char* name, bool rebaseable);
44004400
BINARYNINJACOREAPI uint8_t BNGetMemoryRegionFill(BNBinaryView* view, const char* name);
44014401
BINARYNINJACOREAPI bool BNSetMemoryRegionFill(BNBinaryView* view, const char* name, uint8_t fill);
4402+
BINARYNINJACOREAPI char* BNGetMemoryRegionDisplayName(BNBinaryView* view, const char* name);
4403+
BINARYNINJACOREAPI bool BNSetMemoryRegionDisplayName(BNBinaryView* view, const char* name, const char* displayName);
44024404
BINARYNINJACOREAPI bool BNIsMemoryRegionLocal(BNBinaryView* view, const char* name);
44034405
BINARYNINJACOREAPI void BNResetMemoryMap(BNBinaryView* view);
44044406

python/binaryview.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,6 +2685,12 @@ def get_memory_region_fill(self, name: str) -> int:
26852685
def set_memory_region_fill(self, name: str, fill: int) -> bool:
26862686
return core.BNSetMemoryRegionFill(self.handle, name, fill)
26872687

2688+
def get_memory_region_display_name(self, name: str) -> str:
2689+
return core.BNGetMemoryRegionDisplayName(self.handle, name)
2690+
2691+
def set_memory_region_display_name(self, name: str, display_name: str) -> bool:
2692+
return core.BNSetMemoryRegionDisplayName(self.handle, name, display_name)
2693+
26882694
def is_memory_region_local(self, name: str) -> bool:
26892695
return core.BNIsMemoryRegionLocal(self.handle, name)
26902696

0 commit comments

Comments
 (0)