func (al *ProcThreadAttributeListContainer) List() *ProcThreadAttributeList {
	return al.data
}
List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx.
package windows
import (
	errorspkg "errors"
	"unsafe"
	"golang.org/x/sys/internal/unsafeheader"
)
func EscapeArg(s string) string {
	if len(s) == 0 {
		return "\"\""
	}
	n := len(s)
	hasSpace := false
	for i := 0; i < len(s); i++ {
		switch s[i] {
		case '"', '\\':
			n++
		case ' ', '\t':
			hasSpace = true
		}
	}
	if hasSpace {
		n += 2
	}
	if n == len(s) {
		return s
	}
	qs := make([]byte, n)
	j := 0
	if hasSpace {
		qs[j] = '"'
		j++
	}
	slashes := 0
	for i := 0; i < len(s); i++ {
		switch s[i] {
		default:
			slashes = 0
			qs[j] = s[i]
		case '\\':
			slashes++
			qs[j] = s[i]
		case '"':
			for ; slashes > 0; slashes-- {
				qs[j] = '\\'
				j++
			}
			qs[j] = '\\'
			j++
			qs[j] = s[i]
		}
		j++
	}
	if hasSpace {
		for ; slashes > 0; slashes-- {
			qs[j] = '\\'
			j++
		}
		qs[j] = '"'
		j++
	}
	return string(qs[:j])
}
func ComposeCommandLine(args []string) string {
	var commandLine string
	for i := range args {
		if i > 0 {
			commandLine += " "
		}
		commandLine += EscapeArg(args[i])
	}
	return commandLine
}
func DecomposeCommandLine(commandLine string) ([]string, error) {
	if len(commandLine) == 0 {
		return []string{}, nil
	}
	var argc int32
	argv, err := CommandLineToArgv(StringToUTF16Ptr(commandLine), &argc)
	if err != nil {
		return nil, err
	}
	defer LocalFree(Handle(unsafe.Pointer(argv)))
	var args []string
	for _, v := range (*argv)[:argc] {
		args = append(args, UTF16ToString((*v)[:]))
	}
	return args, nil
}
func CloseOnExec(fd Handle) {
	SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0)
}
func FullPath(name string) (path string, err error) {
	p, err := UTF16PtrFromString(name)
	if err != nil {
		return "", err
	}
	n := uint32(100)
	for {
		buf := make([]uint16, n)
		n, err = GetFullPathName(p, uint32(len(buf)), &buf[0], nil)
		if err != nil {
			return "", err
		}
		if n <= uint32(len(buf)) {
			return UTF16ToString(buf[:n]), nil
		}
	}
}
func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListContainer, error) {
	var size uintptr
	err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size)
	if err != ERROR_INSUFFICIENT_BUFFER {
		if err == nil {
			return nil, errorspkg.New("unable to query buffer size from InitializeProcThreadAttributeList")
		}
		return nil, err
	}
	al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(&make([]byte, size)[0]))}
	err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size)
	if err != nil {
		return nil, err
	}
	return al, err
}
func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error {
	alloc, err := LocalAlloc(LMEM_FIXED, uint32(size))
	if err != nil {
		return err
	}
	var src, dst []byte
	hdr := (*unsafeheader.Slice)(unsafe.Pointer(&src))
	hdr.Data = value
	hdr.Cap = int(size)
	hdr.Len = int(size)
	hdr = (*unsafeheader.Slice)(unsafe.Pointer(&dst))
	hdr.Data = unsafe.Pointer(alloc)
	hdr.Cap = int(size)
	hdr.Len = int(size)
	copy(dst, src)
	al.heapAllocations = append(al.heapAllocations, alloc)
	return updateProcThreadAttribute(al.data, 0, attribute, unsafe.Pointer(alloc), size, nil, nil)
}
func (al *ProcThreadAttributeListContainer) Delete() {
	deleteProcThreadAttributeList(al.data)
	for i := range al.heapAllocations {
		LocalFree(Handle(al.heapAllocations[i]))
	}
	al.heapAllocations = nil
}