internal static ProcessStartInfo GetInjectStartInfo(int processId, string optionalArgs = "") { // get Detourium injectclr location var installLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Detourium"); // get x86 or x64 inject path var injectFilename = Path.Combine(installLocation, ProcessHelpers.GetPlatform(processId), "inject.exe"); var spyFilename = Path.Combine(installLocation, "Detourium.dll"); // build args var args = string.Format("-m {0} -i \"{1}\" -l {2} -a \"{3}\" -n {4}", "EntryPoint", spyFilename, "Detourium.Runtime.DetouriumRuntime", optionalArgs, processId); // create and return the process info return(new ProcessStartInfo { CreateNoWindow = true, UseShellExecute = false, FileName = injectFilename, Arguments = args }); }