mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	vendor: update buildkit to master@d5c1d785b042
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
		
							
								
								
									
										91
									
								
								vendor/golang.org/x/sys/windows/exec_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										91
									
								
								vendor/golang.org/x/sys/windows/exec_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -22,7 +22,7 @@ import ( | ||||
| //     but only if there is space or tab inside s. | ||||
| func EscapeArg(s string) string { | ||||
| 	if len(s) == 0 { | ||||
| 		return "\"\"" | ||||
| 		return `""` | ||||
| 	} | ||||
| 	n := len(s) | ||||
| 	hasSpace := false | ||||
| @@ -35,7 +35,7 @@ func EscapeArg(s string) string { | ||||
| 		} | ||||
| 	} | ||||
| 	if hasSpace { | ||||
| 		n += 2 | ||||
| 		n += 2 // Reserve space for quotes. | ||||
| 	} | ||||
| 	if n == len(s) { | ||||
| 		return s | ||||
| @@ -82,20 +82,68 @@ func EscapeArg(s string) string { | ||||
| // in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument, | ||||
| // or any program that uses CommandLineToArgv. | ||||
| func ComposeCommandLine(args []string) string { | ||||
| 	var commandLine string | ||||
| 	for i := range args { | ||||
| 		if i > 0 { | ||||
| 			commandLine += " " | ||||
| 		} | ||||
| 		commandLine += EscapeArg(args[i]) | ||||
| 	if len(args) == 0 { | ||||
| 		return "" | ||||
| 	} | ||||
| 	return commandLine | ||||
|  | ||||
| 	// Per https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw: | ||||
| 	// “This function accepts command lines that contain a program name; the | ||||
| 	// program name can be enclosed in quotation marks or not.” | ||||
| 	// | ||||
| 	// Unfortunately, it provides no means of escaping interior quotation marks | ||||
| 	// within that program name, and we have no way to report them here. | ||||
| 	prog := args[0] | ||||
| 	mustQuote := len(prog) == 0 | ||||
| 	for i := 0; i < len(prog); i++ { | ||||
| 		c := prog[i] | ||||
| 		if c <= ' ' || (c == '"' && i == 0) { | ||||
| 			// Force quotes for not only the ASCII space and tab as described in the | ||||
| 			// MSDN article, but also ASCII control characters. | ||||
| 			// The documentation for CommandLineToArgvW doesn't say what happens when | ||||
| 			// the first argument is not a valid program name, but it empirically | ||||
| 			// seems to drop unquoted control characters. | ||||
| 			mustQuote = true | ||||
| 			break | ||||
| 		} | ||||
| 	} | ||||
| 	var commandLine []byte | ||||
| 	if mustQuote { | ||||
| 		commandLine = make([]byte, 0, len(prog)+2) | ||||
| 		commandLine = append(commandLine, '"') | ||||
| 		for i := 0; i < len(prog); i++ { | ||||
| 			c := prog[i] | ||||
| 			if c == '"' { | ||||
| 				// This quote would interfere with our surrounding quotes. | ||||
| 				// We have no way to report an error, so just strip out | ||||
| 				// the offending character instead. | ||||
| 				continue | ||||
| 			} | ||||
| 			commandLine = append(commandLine, c) | ||||
| 		} | ||||
| 		commandLine = append(commandLine, '"') | ||||
| 	} else { | ||||
| 		if len(args) == 1 { | ||||
| 			// args[0] is a valid command line representing itself. | ||||
| 			// No need to allocate a new slice or string for it. | ||||
| 			return prog | ||||
| 		} | ||||
| 		commandLine = []byte(prog) | ||||
| 	} | ||||
|  | ||||
| 	for _, arg := range args[1:] { | ||||
| 		commandLine = append(commandLine, ' ') | ||||
| 		// TODO(bcmills): since we're already appending to a slice, it would be nice | ||||
| 		// to avoid the intermediate allocations of EscapeArg. | ||||
| 		// Perhaps we can factor out an appendEscapedArg function. | ||||
| 		commandLine = append(commandLine, EscapeArg(arg)...) | ||||
| 	} | ||||
| 	return string(commandLine) | ||||
| } | ||||
|  | ||||
| // DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv, | ||||
| // as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that | ||||
| // command lines are passed around. | ||||
| // DecomposeCommandLine returns error if commandLine contains NUL. | ||||
| // DecomposeCommandLine returns an error if commandLine contains NUL. | ||||
| func DecomposeCommandLine(commandLine string) ([]string, error) { | ||||
| 	if len(commandLine) == 0 { | ||||
| 		return []string{}, nil | ||||
| @@ -105,18 +153,35 @@ func DecomposeCommandLine(commandLine string) ([]string, error) { | ||||
| 		return nil, errorspkg.New("string with NUL passed to DecomposeCommandLine") | ||||
| 	} | ||||
| 	var argc int32 | ||||
| 	argv, err := CommandLineToArgv(&utf16CommandLine[0], &argc) | ||||
| 	argv, err := commandLineToArgv(&utf16CommandLine[0], &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)[:])) | ||||
| 	for _, p := range unsafe.Slice(argv, argc) { | ||||
| 		args = append(args, UTF16PtrToString(p)) | ||||
| 	} | ||||
| 	return args, nil | ||||
| } | ||||
|  | ||||
| // CommandLineToArgv parses a Unicode command line string and sets | ||||
| // argc to the number of parsed arguments. | ||||
| // | ||||
| // The returned memory should be freed using a single call to LocalFree. | ||||
| // | ||||
| // Note that although the return type of CommandLineToArgv indicates 8192 | ||||
| // entries of up to 8192 characters each, the actual count of parsed arguments | ||||
| // may exceed 8192, and the documentation for CommandLineToArgvW does not mention | ||||
| // any bound on the lengths of the individual argument strings. | ||||
| // (See https://go.dev/issue/63236.) | ||||
| func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { | ||||
| 	argp, err := commandLineToArgv(cmd, argc) | ||||
| 	argv = (*[8192]*[8192]uint16)(unsafe.Pointer(argp)) | ||||
| 	return argv, err | ||||
| } | ||||
|  | ||||
| func CloseOnExec(fd Handle) { | ||||
| 	SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) | ||||
| } | ||||
|   | ||||
							
								
								
									
										21
									
								
								vendor/golang.org/x/sys/windows/security_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/golang.org/x/sys/windows/security_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -7,8 +7,6 @@ package windows | ||||
| import ( | ||||
| 	"syscall" | ||||
| 	"unsafe" | ||||
|  | ||||
| 	"golang.org/x/sys/internal/unsafeheader" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| @@ -1341,21 +1339,14 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() | ||||
| 		sdLen = min | ||||
| 	} | ||||
|  | ||||
| 	var src []byte | ||||
| 	h := (*unsafeheader.Slice)(unsafe.Pointer(&src)) | ||||
| 	h.Data = unsafe.Pointer(selfRelativeSD) | ||||
| 	h.Len = sdLen | ||||
| 	h.Cap = sdLen | ||||
|  | ||||
| 	src := unsafe.Slice((*byte)(unsafe.Pointer(selfRelativeSD)), sdLen) | ||||
| 	// SECURITY_DESCRIPTOR has pointers in it, which means checkptr expects for it to | ||||
| 	// be aligned properly. When we're copying a Windows-allocated struct to a | ||||
| 	// Go-allocated one, make sure that the Go allocation is aligned to the | ||||
| 	// pointer size. | ||||
| 	const psize = int(unsafe.Sizeof(uintptr(0))) | ||||
|  | ||||
| 	var dst []byte | ||||
| 	h = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) | ||||
| 	alloc := make([]uintptr, (sdLen+psize-1)/psize) | ||||
| 	h.Data = (*unsafeheader.Slice)(unsafe.Pointer(&alloc)).Data | ||||
| 	h.Len = sdLen | ||||
| 	h.Cap = sdLen | ||||
|  | ||||
| 	dst := unsafe.Slice((*byte)(unsafe.Pointer(&alloc[0])), sdLen) | ||||
| 	copy(dst, src) | ||||
| 	return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0])) | ||||
| } | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/golang.org/x/sys/windows/service.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/golang.org/x/sys/windows/service.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -218,6 +218,10 @@ type SERVICE_FAILURE_ACTIONS struct { | ||||
| 	Actions      *SC_ACTION | ||||
| } | ||||
|  | ||||
| type SERVICE_FAILURE_ACTIONS_FLAG struct { | ||||
| 	FailureActionsOnNonCrashFailures int32 | ||||
| } | ||||
|  | ||||
| type SC_ACTION struct { | ||||
| 	Type  uint32 | ||||
| 	Delay uint32 | ||||
|   | ||||
							
								
								
									
										70
									
								
								vendor/golang.org/x/sys/windows/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										70
									
								
								vendor/golang.org/x/sys/windows/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -15,8 +15,6 @@ import ( | ||||
| 	"time" | ||||
| 	"unicode/utf16" | ||||
| 	"unsafe" | ||||
|  | ||||
| 	"golang.org/x/sys/internal/unsafeheader" | ||||
| ) | ||||
|  | ||||
| type Handle uintptr | ||||
| @@ -135,14 +133,14 @@ func Getpagesize() int { return 4096 } | ||||
|  | ||||
| // NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention. | ||||
| // This is useful when interoperating with Windows code requiring callbacks. | ||||
| // The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. | ||||
| // The argument is expected to be a function with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. | ||||
| func NewCallback(fn interface{}) uintptr { | ||||
| 	return syscall.NewCallback(fn) | ||||
| } | ||||
|  | ||||
| // NewCallbackCDecl converts a Go function to a function pointer conforming to the cdecl calling convention. | ||||
| // This is useful when interoperating with Windows code requiring callbacks. | ||||
| // The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. | ||||
| // The argument is expected to be a function with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. | ||||
| func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| 	return syscall.NewCallbackCDecl(fn) | ||||
| } | ||||
| @@ -216,7 +214,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath | ||||
| //sys	TerminateProcess(handle Handle, exitcode uint32) (err error) | ||||
| //sys	GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) | ||||
| //sys	GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW | ||||
| //sys	getStartupInfo(startupInfo *StartupInfo) = GetStartupInfoW | ||||
| //sys	GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) | ||||
| //sys	DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) | ||||
| //sys	WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] | ||||
| @@ -240,7 +238,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW | ||||
| //sys	GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) = kernel32.GetFileAttributesExW | ||||
| //sys	GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW | ||||
| //sys	CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW | ||||
| //sys	commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW | ||||
| //sys	LocalFree(hmem Handle) (handle Handle, err error) [failretval!=0] | ||||
| //sys	LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) | ||||
| //sys	SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) | ||||
| @@ -299,12 +297,15 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) = advapi32.RegNotifyChangeKeyValue | ||||
| //sys	GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId | ||||
| //sys	ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId | ||||
| //sys	ClosePseudoConsole(console Handle) = kernel32.ClosePseudoConsole | ||||
| //sys	createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) = kernel32.CreatePseudoConsole | ||||
| //sys	GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode | ||||
| //sys	SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode | ||||
| //sys	GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo | ||||
| //sys	setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition | ||||
| //sys	WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW | ||||
| //sys	ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW | ||||
| //sys	resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole | ||||
| //sys	CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot | ||||
| //sys	Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW | ||||
| //sys	Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32NextW | ||||
| @@ -405,7 +406,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) = version.VerQueryValueW | ||||
|  | ||||
| // Process Status API (PSAPI) | ||||
| //sys	EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses | ||||
| //sys	enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses | ||||
| //sys	EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) = psapi.EnumProcessModules | ||||
| //sys	EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) = psapi.EnumProcessModulesEx | ||||
| //sys	GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation | ||||
| @@ -437,6 +438,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmGetWindowAttribute | ||||
| //sys	DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmSetWindowAttribute | ||||
|  | ||||
| // Windows Multimedia API | ||||
| //sys TimeBeginPeriod (period uint32) (err error) [failretval != 0] = winmm.timeBeginPeriod | ||||
| //sys TimeEndPeriod (period uint32) (err error) [failretval != 0] = winmm.timeEndPeriod | ||||
|  | ||||
| // syscall interface implementation for other packages | ||||
|  | ||||
| // GetCurrentProcess returns the handle for the current process. | ||||
| @@ -1354,6 +1359,17 @@ func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { | ||||
| 	return syscall.EWINDOWS | ||||
| } | ||||
|  | ||||
| func EnumProcesses(processIds []uint32, bytesReturned *uint32) error { | ||||
| 	// EnumProcesses syscall expects the size parameter to be in bytes, but the code generated with mksyscall uses | ||||
| 	// the length of the processIds slice instead. Hence, this wrapper function is added to fix the discrepancy. | ||||
| 	var p *uint32 | ||||
| 	if len(processIds) > 0 { | ||||
| 		p = &processIds[0] | ||||
| 	} | ||||
| 	size := uint32(len(processIds) * 4) | ||||
| 	return enumProcesses(p, size, bytesReturned) | ||||
| } | ||||
|  | ||||
| func Getpid() (pid int) { return int(GetCurrentProcessId()) } | ||||
|  | ||||
| func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) { | ||||
| @@ -1613,6 +1629,11 @@ func SetConsoleCursorPosition(console Handle, position Coord) error { | ||||
| 	return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position)))) | ||||
| } | ||||
|  | ||||
| func GetStartupInfo(startupInfo *StartupInfo) error { | ||||
| 	getStartupInfo(startupInfo) | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (s NTStatus) Errno() syscall.Errno { | ||||
| 	return rtlNtStatusToDosErrorNoTeb(s) | ||||
| } | ||||
| @@ -1647,12 +1668,8 @@ func NewNTUnicodeString(s string) (*NTUnicodeString, error) { | ||||
|  | ||||
| // Slice returns a uint16 slice that aliases the data in the NTUnicodeString. | ||||
| func (s *NTUnicodeString) Slice() []uint16 { | ||||
| 	var slice []uint16 | ||||
| 	hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) | ||||
| 	hdr.Data = unsafe.Pointer(s.Buffer) | ||||
| 	hdr.Len = int(s.Length) | ||||
| 	hdr.Cap = int(s.MaximumLength) | ||||
| 	return slice | ||||
| 	slice := unsafe.Slice(s.Buffer, s.MaximumLength) | ||||
| 	return slice[:s.Length] | ||||
| } | ||||
|  | ||||
| func (s *NTUnicodeString) String() string { | ||||
| @@ -1675,12 +1692,8 @@ func NewNTString(s string) (*NTString, error) { | ||||
|  | ||||
| // Slice returns a byte slice that aliases the data in the NTString. | ||||
| func (s *NTString) Slice() []byte { | ||||
| 	var slice []byte | ||||
| 	hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) | ||||
| 	hdr.Data = unsafe.Pointer(s.Buffer) | ||||
| 	hdr.Len = int(s.Length) | ||||
| 	hdr.Cap = int(s.MaximumLength) | ||||
| 	return slice | ||||
| 	slice := unsafe.Slice(s.Buffer, s.MaximumLength) | ||||
| 	return slice[:s.Length] | ||||
| } | ||||
|  | ||||
| func (s *NTString) String() string { | ||||
| @@ -1732,10 +1745,7 @@ func LoadResourceData(module, resInfo Handle) (data []byte, err error) { | ||||
| 	if err != nil { | ||||
| 		return | ||||
| 	} | ||||
| 	h := (*unsafeheader.Slice)(unsafe.Pointer(&data)) | ||||
| 	h.Data = unsafe.Pointer(ptr) | ||||
| 	h.Len = int(size) | ||||
| 	h.Cap = int(size) | ||||
| 	data = unsafe.Slice((*byte)(unsafe.Pointer(ptr)), size) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| @@ -1806,3 +1816,17 @@ type PSAPI_WORKING_SET_EX_INFORMATION struct { | ||||
| 	// A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress. | ||||
| 	VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK | ||||
| } | ||||
|  | ||||
| // CreatePseudoConsole creates a windows pseudo console. | ||||
| func CreatePseudoConsole(size Coord, in Handle, out Handle, flags uint32, pconsole *Handle) error { | ||||
| 	// We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only | ||||
| 	// accept arguments that can be casted to uintptr, and Coord can't. | ||||
| 	return createPseudoConsole(*((*uint32)(unsafe.Pointer(&size))), in, out, flags, pconsole) | ||||
| } | ||||
|  | ||||
| // ResizePseudoConsole resizes the internal buffers of the pseudo console to the width and height specified in `size`. | ||||
| func ResizePseudoConsole(pconsole Handle, size Coord) error { | ||||
| 	// We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only | ||||
| 	// accept arguments that can be casted to uintptr, and Coord can't. | ||||
| 	return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size)))) | ||||
| } | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/golang.org/x/sys/windows/types_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/golang.org/x/sys/windows/types_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -247,6 +247,7 @@ const ( | ||||
| 	PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007 | ||||
| 	PROC_THREAD_ATTRIBUTE_UMS_THREAD        = 0x00030006 | ||||
| 	PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL  = 0x0002000b | ||||
| 	PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE     = 0x00020016 | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| @@ -2139,6 +2140,12 @@ const ( | ||||
| 	ENABLE_LVB_GRID_WORLDWIDE          = 0x10 | ||||
| ) | ||||
|  | ||||
| // Pseudo console related constants used for the flags parameter to | ||||
| // CreatePseudoConsole. See: https://learn.microsoft.com/en-us/windows/console/createpseudoconsole | ||||
| const ( | ||||
| 	PSEUDOCONSOLE_INHERIT_CURSOR = 0x1 | ||||
| ) | ||||
|  | ||||
| type Coord struct { | ||||
| 	X int16 | ||||
| 	Y int16 | ||||
|   | ||||
							
								
								
									
										62
									
								
								vendor/golang.org/x/sys/windows/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										62
									
								
								vendor/golang.org/x/sys/windows/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -55,6 +55,7 @@ var ( | ||||
| 	moduser32   = NewLazySystemDLL("user32.dll") | ||||
| 	moduserenv  = NewLazySystemDLL("userenv.dll") | ||||
| 	modversion  = NewLazySystemDLL("version.dll") | ||||
| 	modwinmm    = NewLazySystemDLL("winmm.dll") | ||||
| 	modwintrust = NewLazySystemDLL("wintrust.dll") | ||||
| 	modws2_32   = NewLazySystemDLL("ws2_32.dll") | ||||
| 	modwtsapi32 = NewLazySystemDLL("wtsapi32.dll") | ||||
| @@ -187,6 +188,7 @@ var ( | ||||
| 	procCancelIo                                             = modkernel32.NewProc("CancelIo") | ||||
| 	procCancelIoEx                                           = modkernel32.NewProc("CancelIoEx") | ||||
| 	procCloseHandle                                          = modkernel32.NewProc("CloseHandle") | ||||
| 	procClosePseudoConsole                                   = modkernel32.NewProc("ClosePseudoConsole") | ||||
| 	procConnectNamedPipe                                     = modkernel32.NewProc("ConnectNamedPipe") | ||||
| 	procCreateDirectoryW                                     = modkernel32.NewProc("CreateDirectoryW") | ||||
| 	procCreateEventExW                                       = modkernel32.NewProc("CreateEventExW") | ||||
| @@ -201,6 +203,7 @@ var ( | ||||
| 	procCreateNamedPipeW                                     = modkernel32.NewProc("CreateNamedPipeW") | ||||
| 	procCreatePipe                                           = modkernel32.NewProc("CreatePipe") | ||||
| 	procCreateProcessW                                       = modkernel32.NewProc("CreateProcessW") | ||||
| 	procCreatePseudoConsole                                  = modkernel32.NewProc("CreatePseudoConsole") | ||||
| 	procCreateSymbolicLinkW                                  = modkernel32.NewProc("CreateSymbolicLinkW") | ||||
| 	procCreateToolhelp32Snapshot                             = modkernel32.NewProc("CreateToolhelp32Snapshot") | ||||
| 	procDefineDosDeviceW                                     = modkernel32.NewProc("DefineDosDeviceW") | ||||
| @@ -327,6 +330,7 @@ var ( | ||||
| 	procReleaseMutex                                         = modkernel32.NewProc("ReleaseMutex") | ||||
| 	procRemoveDirectoryW                                     = modkernel32.NewProc("RemoveDirectoryW") | ||||
| 	procResetEvent                                           = modkernel32.NewProc("ResetEvent") | ||||
| 	procResizePseudoConsole                                  = modkernel32.NewProc("ResizePseudoConsole") | ||||
| 	procResumeThread                                         = modkernel32.NewProc("ResumeThread") | ||||
| 	procSetCommTimeouts                                      = modkernel32.NewProc("SetCommTimeouts") | ||||
| 	procSetConsoleCursorPosition                             = modkernel32.NewProc("SetConsoleCursorPosition") | ||||
| @@ -468,6 +472,8 @@ var ( | ||||
| 	procGetFileVersionInfoSizeW                              = modversion.NewProc("GetFileVersionInfoSizeW") | ||||
| 	procGetFileVersionInfoW                                  = modversion.NewProc("GetFileVersionInfoW") | ||||
| 	procVerQueryValueW                                       = modversion.NewProc("VerQueryValueW") | ||||
| 	proctimeBeginPeriod                                      = modwinmm.NewProc("timeBeginPeriod") | ||||
| 	proctimeEndPeriod                                        = modwinmm.NewProc("timeEndPeriod") | ||||
| 	procWinVerifyTrustEx                                     = modwintrust.NewProc("WinVerifyTrustEx") | ||||
| 	procFreeAddrInfoW                                        = modws2_32.NewProc("FreeAddrInfoW") | ||||
| 	procGetAddrInfoW                                         = modws2_32.NewProc("GetAddrInfoW") | ||||
| @@ -1630,6 +1636,11 @@ func CloseHandle(handle Handle) (err error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func ClosePseudoConsole(console Handle) { | ||||
| 	syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(console), 0, 0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -1759,6 +1770,14 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) { | ||||
| 	r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole)), 0) | ||||
| 	if r0 != 0 { | ||||
| 		hr = syscall.Errno(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) | ||||
| 	if r1&0xff == 0 { | ||||
| @@ -2367,11 +2386,8 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetStartupInfo(startupInfo *StartupInfo) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| func getStartupInfo(startupInfo *StartupInfo) { | ||||
| 	syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| @@ -2862,6 +2878,14 @@ func ResetEvent(event Handle) (err error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { | ||||
| 	r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(pconsole), uintptr(size), 0) | ||||
| 	if r0 != 0 { | ||||
| 		hr = syscall.Errno(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func ResumeThread(thread Handle) (ret uint32, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) | ||||
| 	ret = uint32(r0) | ||||
| @@ -3516,12 +3540,8 @@ func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *u | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { | ||||
| 	var _p0 *uint32 | ||||
| 	if len(processIds) > 0 { | ||||
| 		_p0 = &processIds[0] | ||||
| 	} | ||||
| 	r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned))) | ||||
| func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| @@ -3824,9 +3844,9 @@ func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (er | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { | ||||
| func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) | ||||
| 	argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) | ||||
| 	argv = (**uint16)(unsafe.Pointer(r0)) | ||||
| 	if argv == nil { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| @@ -4021,6 +4041,22 @@ func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPoint | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func TimeBeginPeriod(period uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0) | ||||
| 	if r1 != 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func TimeEndPeriod(period uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(proctimeEndPeriod.Addr(), 1, uintptr(period), 0, 0) | ||||
| 	if r1 != 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) { | ||||
| 	r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) | ||||
| 	if r0 != 0 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Justin Chadwell
					Justin Chadwell