public void OnStartAddon() { if (SelectedItem == null) { if (!TrySelectFirstPossibleItem()) { return; } } string parameters = ParametersBuilder.BuildStartParameter(SelectedItem, _allAddons); // Change date for single selected item. SelectedItem.ChangeLastUseDateToNow(); // Change date for all selected items. foreach (var item in _allAddons) { if (item != SelectedItem && item.Selected) { item.ChangeLastUseDateToNow(); } } ProcessStart.StartProcess(parameters); _history.UpdateHistoryFromList(Addons); }
private void OnElapsedTime(object source, ElapsedEventArgs e) { Util.WriteToFile("OnElapsedTime called...."); //calling sms function //System.Diagnostics.Debugger.Launch(); ProcessStart.SendSms(); }
public FormProcess(string process, string arguments) { ProcessCallback = new ProcessStart(processStart); AbortCallback = new ProcessAbort(processAbort); ProcessString = process ?? GitCommands.Settings.GitCommand; ProcessArguments = arguments; Remote = ""; }
/// <summary> /// 运行时加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { //分辨率是否一致 if (exit) { Application.Exit(); } //判断是否需要升级 if (impurity.compareEditon(impurity.nowEdition(), impurity.getEdition())) { this.NewVersionLLB.Visible = true; } if (LoginInfo) { this.LoginName.Text = NickName; this.HeadPic.Enabled = false; this.HeadPic.Visible = false; this.LoginName.Enabled = true; this.LoginName.Visible = true; } //开启公告 if (Status) { new Thread(showNotice).Start(); } re.Name = "RecordingAuto";//设置录制线程名称 this.numlamp.Image = imageList1.Images[0]; this.capslamp.Image = imageList1.Images[1]; this.scolllamp.Image = imageList1.Images[2]; InputLanguage a = InputLanguage.FromCulture(new System.Globalization.CultureInfo("en-US")); //初始化参数 initPic(); initBtn(); iniBtnMusic(); iniLbYin_Top(); iniLbYin_Bottom(); //加载主题 loadTheme(); //显示捐献排行 donate.id = id; donate.TopMost = false; donate.TopLevel = false; donate.FormBorderStyle = FormBorderStyle.None; donate.Size = pn_donace.Size; donate.Dock = DockStyle.Fill; pn_donace.Controls.Add(donate); donate.Show(); //关闭等待动画进程 ProcessStart.processStop(process); if (!themeLoad) { MessageBox.Show("主题加载失败,已经重新设置主题!!!", "主题加载失败!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public FormProcess(string process, string arguments) { ProcessCallback = new ProcessStart(processStart); AbortCallback = new ProcessAbort(processAbort); ProcessString = process ?? Settings.GitCommand; ProcessArguments = arguments; Remote = ""; ProcessInput = null; }
//Low level process start/stop event handlers void processStartEvent_EventArrived(object sender, EventArrivedEventArgs e) { //Get processID and pass to High level subscribers ProcessStart?.Invoke(this, new ProcessEventArgs { ProcessID = Convert.ToInt32(e.NewEvent.Properties["ProcessID"].Value), ProcessName = e.NewEvent.Properties["ProcessName"].Value.ToString() }); }
public FormProcess(string process, string arguments, bool useDialogSettings = true) : base(useDialogSettings) { ProcessCallback = new ProcessStart(processStart); AbortCallback = new ProcessAbort(processAbort); ProcessString = process ?? Settings.GitCommand; ProcessArguments = arguments; Remote = ""; ProcessInput = null; }
protected CoreFile(ThreadManager manager, ProcessStart start) : base(manager, start) { info = Inferior.GetTargetMemoryInfo (manager.AddressDomain); bfd = (Bfd) NativeLanguage.OperatingSystem.LoadExecutable ( info, start.TargetApplication, true); core_file = start.CoreFile; core_bfd = bfd.OpenCoreFile (core_file); #if FIXME string crash_program = core_bfd.CrashProgram; string[] crash_program_args = crash_program.Split (' '); if (crash_program_args [0] != application) throw new TargetException ( TargetError.CannotStartTarget, "Core file (generated from {0}) doesn't match executable {1}.", crash_program, application); bool ok; try { DateTime core_date = Directory.GetLastWriteTime (core_file); DateTime app_date = Directory.GetLastWriteTime (application); ok = app_date < core_date; } catch { ok = false; } if (!ok) throw new TargetException ( TargetError.CannotStartTarget, "Executable {0} is more recent than core file {1}.", application, core_file); #endif read_note_section (); main_thread = (CoreFileThread) threads [0]; TargetMemoryAccess target_access = ((CoreFileThread) threads [0]).TargetAccess; // bfd.UpdateSharedLibraryInfo (null, target_access); TargetAddress mdb_debug_info = bfd.GetSectionAddress (".mdb_debug_info"); if (!mdb_debug_info.IsNull) { mdb_debug_info = main_thread.ReadAddress (mdb_debug_info); debugger_info = MonoDebuggerInfo.Create (target_access, mdb_debug_info); read_thread_table (); CreateMonoLanguage (debugger_info); mono_language.InitializeCoreFile (target_access); mono_language.Update (target_access); } }
public FormProcess(string process, string arguments, GitModule module, string input, bool useDialogSettings) : base(useDialogSettings) { ProcessCallback = new ProcessStart(processStart); AbortCallback = new ProcessAbort(processAbort); ProcessString = process ?? Settings.GitCommand; WorkingDir = module == null ? Settings.WorkingDir : module.WorkingDir; ProcessArguments = arguments; Remote = ""; ProcessInput = input; }
public Process Attach(DebuggerSession session, int pid, out CommandResult result) { check_alive(); if (main_process != null) { throw new TargetException(TargetError.AlreadyHaveTarget); } ProcessStart start = new ProcessStart(session, pid); main_process = thread_manager.StartApplication(start, out result); return(main_process); }
private void BtnStart_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(PathToExe)) { Stopwatch sw = new Stopwatch(); sw.Start(); (bool, PROCESS_INFORMATION)data = ProcessStart.StartProcess(PathToExe, ProcessCreationFlags.ZERO_FLAG); if (data.Item1) { Process Genshin = Process.GetProcesses().ToList().Find((p) => p.ProcessName == "GenshinImpact"); if (Genshin != null) { try { Thread.Sleep(1000); string path = Path.Combine(Directory.GetCurrentDirectory(), "Resources", "HelloWorldDLL.dll"); if (!File.Exists(path)) { throw new ApplicationException($"Code: {path} does not exists"); } IntPtr threadAddress = DLLInjection.Inject(Genshin, path); ProcessExtensions.NativeMethods.CloseHandle(threadAddress); sw.Stop(); lblTime.Text = $"{sw.Elapsed.Seconds}:{sw.Elapsed.Milliseconds}"; if (threadAddress != IntPtr.Zero) { ProcessExtensions.Resume(Genshin, threadAddress); } else { throw new ApplicationException($"Code: {Marshal.GetLastWin32Error()}"); } } catch (ApplicationException ex) { MessageBox.Show("ERROR:\n" + ex.Message); } finally { ProcessExtensions.NativeMethods.CloseHandle(data.Item2.hProcess); } } else { MessageBox.Show("ERROR: FAILED TO GET GENSHIN PROCESS"); } } } }
public Process OpenCoreFile(DebuggerSession session, string core_file, out Thread[] threads) { check_alive(); if (main_process != null) { throw new TargetException(TargetError.AlreadyHaveTarget); } ProcessStart start = new ProcessStart(session, core_file); main_process = thread_manager.OpenCoreFile(start, out threads); process_hash.Add(main_process, main_process); return(main_process); }
protected Inferior(ThreadManager thread_manager, Process process, ProcessStart start, BreakpointManager bpm, DebuggerErrorHandler error_handler, AddressDomain address_domain) { this.thread_manager = thread_manager; this.process = process; this.start = start; this.native = start.IsNative; this.error_handler = error_handler; this.breakpoint_manager = bpm; this.address_domain = address_domain; server_handle = mono_debugger_server_create_inferior (breakpoint_manager.Manager); if (server_handle == IntPtr.Zero) throw new InternalError ("mono_debugger_server_initialize() failed."); }
internal Process(ThreadManager manager, ProcessStart start) : this(manager, start.Session) { this.start = start; is_attached = start.PID != 0; breakpoint_manager = new BreakpointManager(); exception_handlers = new Dictionary <int, ExceptionCatchPoint> (); symtab_manager = new SymbolTableManager(session); os = Inferior.CreateOperatingSystemBackend(this); native_language = new NativeLanguage(this, os, target_info); session.OnProcessCreated(this); }
internal Process(ThreadManager manager, ProcessStart start) : this(manager, start.Session) { this.start = start; is_attached = start.PID != 0; breakpoint_manager = new BreakpointManager (); exception_handlers = new Dictionary<int,ExceptionCatchPoint> (); symtab_manager = new SymbolTableManager (session); os = Inferior.CreateOperatingSystemBackend (this); native_language = new NativeLanguage (this, os, target_info); session.OnProcessCreated (this); }
private async void Start_Click(object sender, RoutedEventArgs e) { ProcessStart StartObj = new ProcessStart(); MessageID += 1; StartObj.MessageID = MessageID.ToString(); StartObj.ProductID = ProductId.Text; StartObj.TimestampUTC = DateTime.UtcNow; var result = await RestAPIClient.RestClientPOST("/iotserver/start", StartObj); if (result.Success == true) { MessageList.Items.Add(result.ResultContent); } else { MessageList.Items.Add(result.ErrorMessage); } }
private void BtnStart_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(PathToExe)) { Stopwatch sw = new Stopwatch(); sw.Start(); (bool, PROCESS_INFORMATION)data = ProcessStart.StartProcess(PathToExe, ProcessCreationFlags.ZERO_FLAG); if (data.Item1) { Process genshin = Process.GetProcesses().ToList().Find((p) => p.ProcessName == "GenshinImpact"); if (genshin != null) { try { //string path = Path.Combine(Directory.GetCurrentDirectory(), "Resources", "HelloWorldDLL.dll"); //if(!File.Exists(path)) throw new ApplicationException($"Code: {path} does not exists"); IntPtr procHandle = DLLInjection.OpenProcess(genshin); if (IntPtr.Zero == procHandle) { throw new ApplicationException($"Code: procHandle has value 0x{procHandle}"); } ProcHandle = procHandle; Genshin = genshin; ProcessExtensions.Resume(Genshin); } catch (ApplicationException ex) { MessageBox.Show("ERROR:\n" + ex.Message); } finally { ProcessExtensions.NativeMethods.CloseHandle(data.Item2.hProcess); } } else { MessageBox.Show("ERROR: FAILED TO GET GENSHIN PROCESS"); } } } }
/// <summary> /// 加载主题 /// </summary> private void loadTheme() { XmlDocument xml = new XmlDocument(); try { xml.Load("CustomTheme\\ThemeXML.xml"); implementTheme(xml.SelectSingleNode("CACode").LastChild); themeLoad = true; } catch { themeLoad = false; try { xml.Load("CustomTheme\\ThemeXML.xml"); implementTheme(xml.SelectSingleNode("CACode").FirstChild); } catch { MessageBox.Show("文件受损!!!!!"); //关闭等待动画进程 ProcessStart.processStop(process); Application.Exit(); } } }
private Process(Process parent, int pid) : this(parent.manager, parent.session) { this.start = new ProcessStart(parent.ProcessStart, pid); this.is_forked = true; this.initialized = true; this.parent = parent; breakpoint_manager = new BreakpointManager(parent.breakpoint_manager); exception_handlers = new Dictionary <int, ExceptionCatchPoint> (); foreach (KeyValuePair <int, ExceptionCatchPoint> catchpoint in parent.exception_handlers) { exception_handlers.Add(catchpoint.Key, catchpoint.Value); } symtab_manager = parent.symtab_manager; native_language = parent.native_language; os = parent.os; }
/// <summary> /// 友情链接 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFriendshipLinks_Click(object sender, EventArgs e) { ProcessStart.processStart("http://www.adminznh.ren/download.html"); }
public FormStatus(ProcessStart process, ProcessAbort abort) : this(new EditboxBasedConsoleOutputControl(), true) { ProcessCallback = process; AbortCallback = abort; }
public static CoreFile OpenCoreFile(ThreadManager manager, ProcessStart start) { return new CoreFile (manager, start); }
public static void Main(string[] args) { // process start object ProcessStart ps = null; try { // if no parameters or help was provided if (args.Length == 0 || Array.Exists <string>(args, delegate(string s) { return(s.ToLowerInvariant() == CommandSwitches.HELP); })) { ShowUsageInfo(); Environment.Exit(args.Length == 1 ? ExitCodes.OK : ExitCodes.NO_PARAMETERS); } // get prepared startup parameters ProgramStartupParameters param = new ProgramStartupParameters(args); // ensure correct logging targets as given per arguments // do this before all other stuff, so we can ensure that these loggings are // activated if errors occur. LogFactory.InitConfiguration(param); // without knowledge of the current user, we exit here WindowsIdentity currentUser = WindowsIdentity.GetCurrent(); if (currentUser == null) { log.Fatal("Could not retrieve current user information."); Program.Exit(ExitCodes.ERROR_RETRIEVING_CURRENT_USER); } log.Info("RunAsUser started execution by [{0}] on {1} with arguments [{2}]", currentUser.Name, DateTime.Now.ToString("G"), string.Join(" ", args)); // if terminal server detected // TODO: check if impersonation influences this behavior if (RunningOnTerminalServer) { log.Fatal("This tool cannot be run under Terminal Server environment!"); Program.Exit(ExitCodes.TERMINAL_SERVER_DETECTED); } // create and initialize processstart object // check if user credential informations are given per username and password if (param.CredentialMode == ProcessCredentialMode.Username) { log.Info("Username and Password have been provided for creating primary access token. Username:[{0}]", string.IsNullOrEmpty(param.Userdomain) ? param.Username : string.Format("{0}\\{1}", param.Userdomain, param.Username)); ps = new ProcessStart(param.Username, param.UserPassword, param.Userdomain); } else if (param.CredentialMode == ProcessCredentialMode.LoggedOnUser) { string usedProcessName = param.AccessTokenProcessName.Trim(); if (usedProcessName[usedProcessName.Length - 4] == '.') { usedProcessName = usedProcessName.Substring(0, usedProcessName.Length - 4); } log.Info("Process will be started using primary access token of first process found called [{0}].", usedProcessName); // find all processes Process[] accessTokenProcesses = Process.GetProcessesByName(usedProcessName); // if nothing found..error if (accessTokenProcesses.Length == 0) { log.Fatal("No process called [{0}] could be found resulting that no primary access token can be used.", param.AccessTokenProcessName); if (param.IgnoreNoUser) { log.Info("Conigured to exit OK although no user could be retrieved to execute process."); Program.Exit(ExitCodes.OK); } else { Program.Exit(ExitCodes.OPEN_ACCESS_TOKEN_ACCESS_DENIED); } } // With logged on user is meant, a user that has been logged on using winlogon.exe. // Per default a process called "explorer" // is used to retrieve the primary access token for the user that is to be used. // Therefor the process that is running this code must have priviledges granted to PROCESS_QUERY_INFORMATION // TODO: The current processes' privileges must be enusred to have SE_DEBUG_NAME and SE_TCB_NAME enabled. // To do so following steps must be done: // OpenProcessToken(Process.GetCurrentProcess().Handle, TOKEN_ADJUST_PRIVILEGES) // LookupPrivilegeValue("SeDebugPrivilege") // AdjustTokenPrivilege() EnsureCurrentProcessDebugPrivilegeEnabled(); IntPtr tokenHandle = IntPtr.Zero; Process p = null; if (!string.IsNullOrEmpty(param.AccessTokenAccountName)) { foreach (Process t in accessTokenProcesses) { bool result = NativeWrapper.OpenProcessToken( t.Handle, NativeWrapper.TOKEN_QUERY | NativeWrapper.TOKEN_DUPLICATE | NativeWrapper.TOKEN_ASSIGN_PRIMARY, out tokenHandle); if (!result) { log.Fatal("Error opening process token for process [PID:{0} Name:{1}]. Win32 error: {2}", p.Id, p.ProcessName, new Win32Exception(Marshal.GetLastWin32Error()).Message); if (param.IgnoreNoUser) { log.Info("Configured to exit OK although no user could be retrieved to execute process."); Program.Exit(ExitCodes.OK); } else { Program.Exit(ExitCodes.OPEN_ACCESS_TOKEN_ACCESS_DENIED); } } else { WindowsIdentity id = new WindowsIdentity(tokenHandle); if (string.Equals(id.Name, param.AccessTokenAccountName, StringComparison.InvariantCultureIgnoreCase)) { p = t; break; } } } if (p == null) { log.Fatal("No process called [{0}] could be found under account name [{1}].", param.AccessTokenProcessName, param.AccessTokenAccountName); Program.Exit(ExitCodes.NO_ACCESS_TOKEN_PROCESS_RUNNING); } } else { p = accessTokenProcesses[0]; bool result = NativeWrapper.OpenProcessToken( p.Handle, NativeWrapper.TOKEN_QUERY | NativeWrapper.TOKEN_DUPLICATE | NativeWrapper.TOKEN_ASSIGN_PRIMARY, out tokenHandle); if (!result) { log.Fatal("Error opening process token for process [PID:{0} Name:{1}]. Win32 error: {2}", p.Id, p.ProcessName, new Win32Exception(Marshal.GetLastWin32Error()).Message); if (param.IgnoreNoUser) { log.Info("Configured to exit OK although no user could be retrieved to execute process."); Program.Exit(ExitCodes.OK); } else { Program.Exit(ExitCodes.OPEN_ACCESS_TOKEN_ACCESS_DENIED); } } } ps = new ProcessStart(tokenHandle, true); } ps.CreateNoWindow = true; ps.ProcessTimeout = param.ProcessTimeout; ps.ProcessTimeoutAction = param.ProcessTimeoutAction; ps.Interactive = !param.NoInteractiveLogon; ps.LoadUserProfile = param.LoadUserProfile; ps.WorkingDirectory = param.WorkingDirectory; // start int processStartResult = ps.Start(param.Commandline); Program.Exit(processStartResult); } catch (Exception ex) { log.Fatal("Error while execution. Message: {0}", ex.Message); Program.Exit(ExitCodes.ERROR_WHILE_EXECUTION); } finally { if (ps != null) { ps.Dispose(); } } }
private Process(Process parent, int pid) : this(parent.manager, parent.session) { this.start = new ProcessStart (parent.ProcessStart, pid); this.is_forked = true; this.initialized = true; this.parent = parent; breakpoint_manager = new BreakpointManager (parent.breakpoint_manager); exception_handlers = new Dictionary<int,ExceptionCatchPoint> (); foreach (KeyValuePair<int,ExceptionCatchPoint> catchpoint in parent.exception_handlers) exception_handlers.Add (catchpoint.Key, catchpoint.Value); symtab_manager = parent.symtab_manager; native_language = parent.native_language; os = parent.os; }
public FormStatus(ProcessStart process, ProcessAbort abort) : this() { ProcessCallback = process; AbortCallback = abort; }
public static Inferior CreateInferior(ThreadManager thread_manager, Process process, ProcessStart start) { return new Inferior ( thread_manager, process, start, process.BreakpointManager, null, thread_manager.AddressDomain); }
protected virtual void OnProcessStart(ProcessStartArgs e) => ProcessStart?.Invoke(this, e);
public Process StartApplication(ProcessStart start, out CommandResult result) { Command command = new Command (CommandType.CreateProcess, start); if (!engine_event.WaitOne (WaitTimeout, false)) throw new TargetException (TargetError.NotStopped); event_queue.Lock (); engine_event.Reset (); current_command = command; event_queue.Signal (); event_queue.Unlock (); engine_event.WaitOne (); if (command.Result is Exception) throw (Exception) command.Result; else { var pair = (KeyValuePair<CommandResult,Process>) command.Result; result = pair.Key; return pair.Value; } }
public Process OpenCoreFile(ProcessStart start, out Thread[] threads) { CoreFile core = CoreFile.OpenCoreFile (this, start); threads = core.GetThreads (); return core; }
public SingleSteppingEngine(ThreadManager manager, Process process, ProcessStart start) : this(manager, process) { inferior = Inferior.CreateInferior (manager, process, start); if (start.PID != 0) { this.pid = start.PID; inferior.Attach (pid); } else { pid = inferior.Run (); } manager.AddEngine (this); }
public Process OpenCoreFile(DebuggerSession session, string core_file, out Thread[] threads) { check_alive (); if (main_process != null) throw new TargetException (TargetError.AlreadyHaveTarget); ProcessStart start = new ProcessStart (session, core_file); main_process = thread_manager.OpenCoreFile (start, out threads); process_hash.Add (main_process, main_process); return main_process; }
public Process Run(DebuggerSession session, out CommandResult result) { check_alive (); if (main_process != null) throw new TargetException (TargetError.AlreadyHaveTarget); ProcessStart start = new ProcessStart (session); main_process = thread_manager.StartApplication (start, out result); return main_process; }