def cStruct_volatility(obj, db, recursive): obj.unfold(db) n = obj.identifier.replace("?_", "").replace(" ", "_") t = build(obj) S = [u"{0} = [ {1}, {{".format(n, sizeof(t))] for i, f in enumerate(obj): ft, fn, fc = f if not fn: continue r = c_type(ft) off = getattr(t, fn).offset S.append(u" '{0}': [{2}, {1}],".format(fn, ctype_to_volatility(r), off)) S.append("}]") R = [] if isinstance(recursive, set): for t in obj.subtypes.values() or []: if t is None: continue if not t.identifier in recursive: recursive.add(t.identifier) R.append(t.show(db, recursive, form="volatility")) if len(R) > 0: R.append("") return u"\n".join(R + S)
def build(self, db): self.unfold(db) from ccrawl.ext import ctypes_ return ctypes_.build(self, db)
def build(self, db): from ccrawl.ext import ctypes_ x = self.as_cStruct(db) x.unfold(db) return ctypes_.build(x, db)