summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorplafosse <peter@vector35.com>2016-07-07 21:44:20 -0400
committerplafosse <peter@vector35.com>2016-07-07 21:44:40 -0400
commitc85d93f505f53f921dd2d7b2d774ff75979261f7 (patch)
tree5346720210ef5e319786302f51003215bb575d36 /python
parent05b8dae707da62437abf262fe8d1dd2b74a5f98f (diff)
Adding DemangleMS API and extending types for C++
Diffstat (limited to 'python')
-rw-r--r--python/__init__.py20
-rw-r--r--python/generator.cpp4
2 files changed, 22 insertions, 2 deletions
diff --git a/python/__init__.py b/python/__init__.py
index 0c983fe2..fbe6fa61 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -5646,6 +5646,26 @@ def get_time_since_last_update_check():
def updates_checked():
core.BNUpdatesChecked()
+def get_qualified_name(names):
+ out = ""
+ for i,a in enumerate(names):
+ if i == 0:
+ out += a
+ else:
+ out += "::" + a
+ return out
+
+def demangle_ms(arch, mangledName):
+ handle = ctypes.POINTER(core.BNType)()
+ outName = ctypes.POINTER(ctypes.c_char_p)()
+ outSize = ctypes.c_ulonglong()
+ names = []
+ if core.BNDemangleMS(arch.handle, mangledName, ctypes.byref(handle), ctypes.byref(outName), ctypes.byref(outSize)):
+ for i in xrange(outSize.value):
+ names.append(outName[i])
+ return (Type(handle), names)
+ return (None, mangledName)
+
bundled_plugin_path = core.BNGetBundledPluginDirectory()
user_plugin_path = core.BNGetUserPluginDirectory()
diff --git a/python/generator.cpp b/python/generator.cpp
index f9790619..08485315 100644
--- a/python/generator.cpp
+++ b/python/generator.cpp
@@ -98,10 +98,10 @@ void OutputType(FILE* out, Type* type, bool isReturnType = false, bool isCallbac
fprintf(out, "ctypes.c_double");
break;
case StructureTypeClass:
- fprintf(out, "%s", type->GetStructure()->GetName().c_str());
+ fprintf(out, "%s", type->GetQualifiedName(type->GetStructure()->GetName()).c_str());
break;
case EnumerationTypeClass:
- fprintf(out, "%s", type->GetEnumeration()->GetName().c_str());
+ fprintf(out, "%s", type->GetQualifiedName(type->GetEnumeration()->GetName()).c_str());
break;
case PointerTypeClass:
if (isCallback || (type->GetChildType()->GetClass() == VoidTypeClass))