Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
syscall: introduce SysProcAttr.ParentProcess on Windows
This allows users to specify which process should be used as the parent process when creating a new process. Note that this doesn't just trivially pass the handle onward to PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, because inherited handles must be valid in the parent process, so if we're changing the destination process, then we must also change the origin of the parent handles. And, the StartProcess function must clean up these handles successfully when exiting, regardless of where the duplication happened. So, we take care in this commit to use DuplicateHandle for both duplicating and for closing the inherited handles. The test was taken originally from CL 288272 and adjusted for use here. Fixes #44011. Change-Id: Ib3b132028dcab1aded3dc0e65126c8abebfa35eb Reviewed-on: https://go-review.googlesource.com/c/go/+/288300 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Trust: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
- Loading branch information
Showing
2 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters