コード例 #1
0
ファイル: Program.cs プロジェクト: henke37/debugHelp
        private static unsafe void StartProcess(string[] args, NativeJob job)
        {
            using (var atts = new ProcThreadAttributeList(1))
                using (var shellProc = GetShellProcess()) {
                    IntPtr shellHandle = shellProc.Handle.DangerousGetHandle();

                    atts.AddAttribute <IntPtr>(ProcThreadAttribute.ParentProcess, &shellHandle);

                    using (NativeProcess natProcess = NativeProcess.CreateProcess(args[0], null, CreateProcessFlags.None, StartupInfoFlags.None, atts, null, out _)) {
                        job.AttachProcess(natProcess);
                    }
                }
        }