Ejemplo n.º 1
0
 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);
Ejemplo n.º 2
0
 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);
Ejemplo n.º 3
0
        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;
        }