Skip to content

Commit 0fc7b0e

Browse files
committed
std types for defs.h, support for multi-dim array & related bug fix
1 parent b49a0e5 commit 0fc7b0e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

genprog_decomp_ida.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def get_data_declarations(self, lines):
652652
array_size=len(re.findall("\[\d*\]",dataName))
653653
print("Array Size:", array_size)
654654
defLine=""
655-
if array_size==2:
655+
if array_size>=2:
656656
print("// --- WARNING! Two-dimensional array objects are not yet supported")
657657
defLine += "%s *(p%s);\n" %(dataType, dataName)
658658
dataName = dataName.split("[")[0] # handle arrays
@@ -885,12 +885,11 @@ def generate_wrapper(self, target, funcs, stubMap, dataMap):
885885
dataDef = dataDef.split("=")[0].strip()
886886
dataType, dataName = self.getTypeAndLabel(dataDef)
887887
array_size=len(re.findall("\[\d*\]",dataName))
888-
if array_size==2:
888+
if array_size>=2:
889889
print("SORRY: two-dimensional array objects just aren't working right now")
890890
print(" ==> "+dataType+" "+dataName)
891891
wrapperStub += "// --- WARNING! Two-dimensional array objects are not yet supported"
892892
wrapperStub += "\tvoid* my%s,\n" % dataName
893-
wrapperStub += " // --- END OF WARNING!\n"
894893
elif array_size==1 and "*" not in dataType:
895894
dataNamex = dataName.split("[")[0] # handle arrays
896895
wrapperStub += "\tvoid* my%s,\n" % dataNamex
@@ -925,7 +924,7 @@ def generate_wrapper(self, target, funcs, stubMap, dataMap):
925924
dataDef = dataDef.split("=")[0].strip()
926925
dataType, dataName = self.getTypeAndLabel(dataDef)
927926
array_size=len(re.findall("\[\d*\]",dataName))
928-
if array_size==2:
927+
if array_size>=2:
929928
print("// --- WARNING! Two-dimensional array objects are not yet supported\n")
930929
wrapperStub += "\tp%s = (%s*) my%s;\n" % (dataName, dataType, dataName)
931930
print(" // --- END OF WARNING!\n")

refs/defs.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44
#define LODWORD(x) (*((unsigned int*)&(x)))
55
#define HIWORD(x) (*((unsigned short*)&(x)+1))
66
#define LOWORD(x) (*((unsigned short*)&(x)))
7-
#define COERCE_UNSIGNED_INT64(x) (*((unsigned long*)(&x)))
7+
#define COERCE_UNSIGNED_INT64(x) (*((unsigned long*)(&x)))
8+
#define HIBYTE(x) (*((unsigned char*)&(x)+1))
9+
10+
11+
// from IDADOC support: _OWORD is an unknown type; the only known info is its size: 16 bytes
12+
#define _OWORD (unsigned long long)
13+

0 commit comments

Comments
 (0)