Tag: createprocess

如何使用C#中的STARTUPINFOEX调用CreateProcess()并重新生成子项

我需要创建一个新进程,但是它是另一个进程的“子”而不是当前进程,例如重新父进程。 以下几乎让我有.NET:如何使用C#和.NET中的 STARTUPINFOEX调用CreateProcessAsUser() :如何PInvoke UpdateProcThreadAttribute和http://winprogger.com/launching-a-non-child-process/ using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; public class ProcessCreator { [DllImport(“kernel32.dll”)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool CreateProcess( string lpApplicationName, string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes, ref SECURITY_ATTRIBUTES lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, [In] ref STARTUPINFOEX lpStartupInfo, out PROCESS_INFORMATION lpProcessInformation); [DllImport(“kernel32.dll”, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] […]

createprocess中的Process.arguments?

以下在process.start情况下工作得很好。 private string Path() { RegistryKey Key = Registry.LocalMachine.OpenSubKey(“SOFTWARE\\Wizet\\”); RegistryKey Location = Key.OpenSubKey(“MapleStory”); return Location.GetValue(“ExecPath”).ToString(); } public bool Launch() { maplestory = new ProcessStartInfo(); maplestory.FileName = Path() + @”\MapleStory.exe”; maplestory.Arguments = “WebStart”; MapleStory = Process.Start(maplestory); } 如果我使用CreateProcess,我现在在哪里放置’.Arguments’,我还会在哪里放置CREATE_SUSPENDED? CreateProcess(AppName, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, null, ref si, out pi);