public State(String exeName) { CType.decompiler = this; Instructions = new XenonInstructions(this); Instructions.SetupTables(); Pe = new XPeParser(exeName); }
public void LoadFromFile(String fn) { FileStream fs = new FileStream(fn, FileMode.Open, FileAccess.Read, FileShare.Read); BinaryReader br = new BinaryReader(fs); BinaryFormatter bin = new BinaryFormatter(); Pe = new XPeParser(br.ReadString()); int count = br.ReadInt32(); Functions = new List <Function>(); for (int i = 0; i < count; i++) { Function f = new Function(this, br.ReadString(), br.ReadUInt32()); f.Size = br.ReadUInt32(); f.ArgCount = br.ReadInt32(); if (f.ArgCount != -1) { f.Arguments = (List <Variable>)bin.Deserialize(fs); } f.Returns = (CType)bin.Deserialize(fs); Functions.Add(f); } count = br.ReadInt32(); IgnoredCalls = new List <Function>(); for (int i = 0; i < count; i++) { uint addr = br.ReadUInt32(); Function f = Functions.Find(delegate(Function fnc) { return(fnc.Address == addr); }); IgnoredCalls.Add(f); } count = br.ReadInt32(); CallIsRet = new List <Function>(); for (int i = 0; i < count; i++) { uint addr = br.ReadUInt32(); Function f = Functions.Find(delegate(Function fnc) { return(fnc.Address == addr); }); CallIsRet.Add(f); } Structures = (List <Structure>)bin.Deserialize(fs); fs.Close(); }
public void LoadFromFile(String fn) { FileStream fs = new FileStream(fn, FileMode.Open, FileAccess.Read, FileShare.Read); BinaryReader br = new BinaryReader(fs); BinaryFormatter bin = new BinaryFormatter(); Pe = new XPeParser(br.ReadString()); int count = br.ReadInt32(); Functions = new List<Function>(); for (int i = 0; i < count; i++) { Function f = new Function(this, br.ReadString(), br.ReadUInt32()); f.Size = br.ReadUInt32(); f.ArgCount = br.ReadInt32(); if (f.ArgCount != -1) f.Arguments = (List<Variable>) bin.Deserialize(fs); f.Returns = (CType)bin.Deserialize(fs); Functions.Add(f); } count = br.ReadInt32(); IgnoredCalls = new List<Function>(); for (int i = 0; i < count; i++) { uint addr = br.ReadUInt32(); Function f = Functions.Find(delegate(Function fnc) { return fnc.Address == addr; }); IgnoredCalls.Add(f); } count = br.ReadInt32(); CallIsRet = new List<Function>(); for (int i = 0; i < count; i++) { uint addr = br.ReadUInt32(); Function f = Functions.Find(delegate(Function fnc) { return fnc.Address == addr; }); CallIsRet.Add(f); } Structures = (List<Structure>)bin.Deserialize(fs); fs.Close(); }