internal static extern bool CreateProcess(string applicationPath, string commandLineArgs, ref SecurityAttributes processSecurityAttributes, ref SecurityAttributes threadSecurityAttributes, bool inheritHandle, ProcessCreationFlags creationFlags, IntPtr environment, string currentDirectory, ref StartupInfo startupInfo, out ProcessInformation processInformation);
ProcessInformation StartClientProcess(string clientPath, out ClientLoadResult result) { result = ClientLoadResult.Success; // Create Process ProcessInformation processInformation; var startupInfo = new StartupInfo { Size = Marshal.SizeOf(typeof(StartupInfo)) }; var processSecurity = new SecurityAttributes(); var threadSecurity = new SecurityAttributes(); processSecurity.Size = Marshal.SizeOf(processSecurity); threadSecurity.Size = Marshal.SizeOf(threadSecurity); bool wasCreated = NativeMethods.CreateProcess(clientPath, null, ref processSecurity, ref threadSecurity, false, ProcessCreationFlags.Suspended, IntPtr.Zero, null, ref startupInfo, out processInformation); // Check Process if (!wasCreated || processInformation.ProcessId == 0) result = ClientLoadResult.CreateProcessFailed; return processInformation; }