private void DecompileRawImage(DecompilerDriver dec, Dictionary <string, object> pArgs) { var arch = config.GetArchitecture((string)pArgs["--arch"]); if (arch == null) { throw new ApplicationException(string.Format("Unknown architecture {0}", pArgs["--arch"])); } object sEnv; Platform platform; if (pArgs.TryGetValue("--env", out sEnv)) { var opEnv = config.GetEnvironment((string)sEnv); if (opEnv == null) { throw new ApplicationException(string.Format("Unknown operating environment {0}", sEnv)); } platform = opEnv.Load(services, arch); } else { platform = new DefaultPlatform(services, arch); } Address addrBase; Address addrEntry; if (!arch.TryParseAddress((string)pArgs["--base"], out addrBase)) { throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); } if (pArgs.ContainsKey("--entry")) { if (!arch.TryParseAddress((string)pArgs["--base"], out addrEntry)) { throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); } } else { addrEntry = addrBase; } var state = CreateInitialState(arch, pArgs); dec.LoadRawImage((string)pArgs["filename"], arch, platform, addrBase); dec.Project.Programs[0].EntryPoints.Add(new EntryPoint(addrEntry, state)); dec.ScanPrograms(); dec.AnalyzeDataFlow(); dec.ReconstructTypes(); dec.StructureProgram(); dec.WriteDecompilerProducts(); }
private void DecompileRawImage(DecompilerDriver dec, Dictionary <string, object> pArgs) { var arch = config.GetArchitecture((string)pArgs["--arch"]); if (arch == null) { throw new ApplicationException(string.Format("Unknown architecture {0}", pArgs["--arch"])); } object sEnv; pArgs.TryGetValue("--env", out sEnv); Address addrBase; Address addrEntry; if (!arch.TryParseAddress((string)pArgs["--base"], out addrBase)) { throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); } if (pArgs.ContainsKey("--entry")) { if (!arch.TryParseAddress((string)pArgs["--base"], out addrEntry)) { throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); } } else { addrEntry = addrBase; } var state = CreateInitialState(arch, pArgs); dec.LoadRawImage((string)pArgs["filename"], (string)pArgs["--arch"], (string)sEnv, addrBase); dec.Project.Programs[0].EntryPoints.Add( addrEntry, new ImageSymbol(addrEntry) { ProcessorState = state }); object oHeur; if (pArgs.TryGetValue("heuristics", out oHeur)) { dec.Project.Programs[0].User.Heuristics = ((string[])oHeur).ToSortedSet(); } dec.ScanPrograms(); dec.AnalyzeDataFlow(); dec.ReconstructTypes(); dec.StructureProgram(); dec.WriteDecompilerProducts(); }
private void DecompileRawImage(DecompilerDriver dec, Dictionary<string, object> pArgs) { var arch = config.GetArchitecture((string)pArgs["--arch"]); if (arch == null) throw new ApplicationException(string.Format("Unknown architecture {0}", pArgs["--arch"])); object sEnv; pArgs.TryGetValue("--env", out sEnv); Address addrBase; Address addrEntry; if (!arch.TryParseAddress((string)pArgs["--base"], out addrBase)) throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); if (pArgs.ContainsKey("--entry")) { if (!arch.TryParseAddress((string)pArgs["--base"], out addrEntry)) throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); } else addrEntry = addrBase; var state = CreateInitialState(arch, pArgs); dec.LoadRawImage((string)pArgs["filename"], (string)pArgs["--arch"], (string) sEnv, addrBase); dec.Project.Programs[0].EntryPoints.Add( addrEntry, new ImageSymbol(addrEntry) { ProcessorState = state }); object oHeur; if (pArgs.TryGetValue("heuristics", out oHeur)) { dec.Project.Programs[0].User.Heuristics = ((string[])oHeur).ToSortedSet(); } dec.ScanPrograms(); dec.AnalyzeDataFlow(); dec.ReconstructTypes(); dec.StructureProgram(); dec.WriteDecompilerProducts(); }
private void DecompileRawImage(DecompilerDriver dec, Dictionary<string, object> pArgs) { var arch = config.GetArchitecture((string)pArgs["--arch"]); if (arch == null) throw new ApplicationException(string.Format("Unknown architecture {0}", pArgs["--arch"])); object sEnv; Platform platform; if (pArgs.TryGetValue("--env", out sEnv)) { var opEnv = config.GetEnvironment((string)sEnv); if (opEnv == null) throw new ApplicationException(string.Format("Unknown operating environment {0}", sEnv)); platform = opEnv.Load(services, arch); } else { platform = new DefaultPlatform(services, arch); } Address addrBase; Address addrEntry; if (!arch.TryParseAddress((string)pArgs["--base"], out addrBase)) throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); if (pArgs.ContainsKey("--entry")) { if (!arch.TryParseAddress((string)pArgs["--base"], out addrEntry)) throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", pArgs["--base"])); } else addrEntry = addrBase; var state = CreateInitialState(arch, pArgs); dec.LoadRawImage((string)pArgs["filename"], arch, platform, addrBase); dec.Project.Programs[0].EntryPoints.Add(new EntryPoint(addrEntry, state)); dec.ScanPrograms(); dec.AnalyzeDataFlow(); dec.ReconstructTypes(); dec.StructureProgram(); dec.WriteDecompilerProducts(); }