Closed
Description
I needed to pass STARTUPINFOEX structure to Windows StartProcess API. It is impossible to do without copying quite a bit of Go main lib code.
I propose we add new PROC_THREAD_ATTRIBUTE_LIST type to syscall package with this public API:
type PROC_THREAD_ATTRIBUTE_LIST [1]byte
func NewProcThreadAttributeList(maxattrcount uint32) (*PROC_THREAD_ATTRIBUTE_LIST, error)
func (al *PROC_THREAD_ATTRIBUTE_LIST) Release()
func UpdateProcThreadAttribute(attrlist *PROC_THREAD_ATTRIBUTE_LIST, flags uint32, attr uintptr, value uintptr, size uintptr, prevvalue uintptr, returnedsize *uintptr) (err error)
then we can pass new PROC_THREAD_ATTRIBUTE_LIST variable via new syscall.SysProcAttr.ProcThreadAttributeList field
type SysProcAttr struct {
...
ProcThreadAttributeList *PROC_THREAD_ATTRIBUTE_LIST // if set, CreateProcess will be passed STARTUPINFOEX instead of STARTUPINFO with lpAttributeList set to ProcThreadAttributeList
}
This will allow me to build my program by using standard os/exec package.
I expect this new addition might be useful for other projects (for example #21085 and probably many others). But I don't intend add more code except this proposal.
You can see my proposed change at
https://go-review.googlesource.com/c/go/+/288272
Thank you for considering.
Alex