public string GetPEVerifyPath(PEVerifyVersion version) { var potentialPath = GetPotentialPEVerifyPath(version); if (potentialPath != null && File.Exists(potentialPath)) { return(potentialPath); } return(null); }
public override string GetLookupDiagnostics(PEVerifyVersion version) { if (version != PEVerifyVersion.DotNet2) { return(".NET SDK 2.0: n/a"); } else { return(string.Format(".NET SDK 2.0: Registry: HKEY_LOCAL_MACHINE\\{0}\\{1}\\bin\\PEVerify.exe", SdkRegistryKey, SdkRegistryValue)); } }
public string GetVerifierPath(PEVerifyVersion version) { string verifierPath = _pathSource.GetPEVerifyPath(version); if (verifierPath == null) { var message = string.Format( "PEVerify for version '{0}' could not be found. Locations searched:\r\n{1}", version, _pathSource.GetLookupDiagnostics(version)); throw new PEVerifyException(message); } return(verifierPath); }
public override string GetLookupDiagnostics(PEVerifyVersion version) { if (version != PEVerifyVersion.DotNet2) { return("Windows SDK 6: n/a"); } else { return(string.Format( "Windows SDK 6: Registry: HKEY_LOCAL_MACHINE\\{0}\\[CurrentVersion]\\{1}\\bin\\PEVerify.exe", WindowsSdkRegistryKey, WindowsSdkRegistryInstallationFolderValue)); } }
public override string GetLookupDiagnostics(PEVerifyVersion version) { switch (version) { case PEVerifyVersion.DotNet4: return(string.Format( "Windows SDK 8.1A: Registry: HKEY_LOCAL_MACHINE\\{0}\\{1}\\PEVerify.exe", WindowsSdkRegistryKey40, WindowsSdkRegistryInstallationFolderValue)); default: return("Windows SDK 8.1A: n/a"); } }
protected override string GetPotentialPEVerifyPath(PEVerifyVersion version) { if (version != PEVerifyVersion.DotNet2) { return(null); } return(Maybe .ForValue(RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) .Select(key => key.OpenSubKey(SdkRegistryKey, false)) .Select(key => key.GetValue(SdkRegistryValue) as string) .Select(path => Path.Combine(path, "bin")) .Select(path => Path.Combine(path, "PEVerify.exe")) .ValueOrDefault()); }
public void VerifyPEFile(string modulePath, PEVerifyVersion version) { ArgumentUtility.CheckNotNullOrEmpty("modulePath", modulePath); var process = StartPEVerifyProcess(modulePath, version); string output = process.StandardOutput.ReadToEnd(); process.WaitForExit(); if (process.ExitCode != 0) { throw new PEVerifyException(process.ExitCode, output); } }
private Process StartPEVerifyProcess(string modulePath, PEVerifyVersion version) { string verifierPath = GetVerifierPath(version); var process = new Process(); process.StartInfo.CreateNoWindow = true; process.StartInfo.FileName = verifierPath; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; process.StartInfo.Arguments = string.Format("/verbose \"{0}\"", modulePath); process.Start(); return(process); }
protected override string GetPotentialPEVerifyPath(PEVerifyVersion version) { switch (version) { case PEVerifyVersion.DotNet4: return(Maybe .ForValue(RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) .Select(key => key.OpenSubKey(WindowsSdkRegistryKey40, false)) .Select(key => key.GetValue(WindowsSdkRegistryInstallationFolderValue) as string) .Select(path => Path.Combine(path, "PEVerify.exe")) .ValueOrDefault()); default: return(null); } }
public void VerifyPEFile(Assembly assembly, PEVerifyVersion version) { ArgumentUtility.CheckNotNull("assembly", assembly); VerifyPEFile(assembly.ManifestModule.FullyQualifiedName, version); }
public string GetLookupDiagnostics(PEVerifyVersion version) { return(string.Join(Environment.NewLine, _sources.Select(source => source.GetLookupDiagnostics(version)))); }
public string GetPEVerifyPath(PEVerifyVersion version) { return(_sources.Select(source => source.GetPEVerifyPath(version)).FirstOrDefault(path => path != null)); }
protected abstract string GetPotentialPEVerifyPath(PEVerifyVersion version);
public abstract string GetLookupDiagnostics(PEVerifyVersion version);
public string GetLookupDiagnostics(PEVerifyVersion version) { return("Path: " + _path); }
public string GetPEVerifyPath(PEVerifyVersion version) { return(_path); }