// Token: 0x06000007 RID: 7 RVA: 0x0000288C File Offset: 0x00000A8C
        public static WindowsApi.PROCESS_INFORMATION CreateProcess(ProcessStartInfo startInfo, string desktopName = null, int?millisecondsToWait = 100)
        {
            WindowsApi.STARTUPINFO startupinfo = default(WindowsApi.STARTUPINFO);
            startupinfo.cb        = Marshal.SizeOf(startupinfo);
            startupinfo.lpDesktop = desktopName;
            WindowsApi.PROCESS_INFORMATION process_INFORMATION = default(WindowsApi.PROCESS_INFORMATION);
            string lpCommandLine = startInfo.FileName + " " + startInfo.Arguments;

            WindowsApi.PROCESS_INFORMATION result;
            if (WindowsApi.CreateProcess(null, lpCommandLine, IntPtr.Zero, IntPtr.Zero, true, 32, IntPtr.Zero, startInfo.WorkingDirectory, ref startupinfo, ref process_INFORMATION))
            {
                if (millisecondsToWait != null)
                {
                    WindowsApi.WaitForInputIdle(process_INFORMATION.hProcess, (uint)millisecondsToWait.Value);
                }
                WindowsApi.CloseHandle(process_INFORMATION.hThread);
                result = process_INFORMATION;
            }
            else
            {
                result = default(WindowsApi.PROCESS_INFORMATION);
            }
            return(result);
        }
Esempio n. 2
0
 public static extern bool CreateProcess(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool bInheritHandles, int dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, ref WindowsApi.STARTUPINFO lpStartupInfo, ref WindowsApi.PROCESS_INFORMATION lpProcessInformation);