mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	Update buildkit
- updated buildkit to current code in master via: go mod edit -require github.com/moby/buildkit@master && go mod tidy && ./hack/update-vendor Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
This commit is contained in:
		
							
								
								
									
										35
									
								
								vendor/golang.org/x/sys/windows/exec_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								vendor/golang.org/x/sys/windows/exec_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -6,6 +6,11 @@ | ||||
|  | ||||
| package windows | ||||
|  | ||||
| import ( | ||||
| 	errorspkg "errors" | ||||
| 	"unsafe" | ||||
| ) | ||||
|  | ||||
| // EscapeArg rewrites command line argument s as prescribed | ||||
| // in http://msdn.microsoft.com/en-us/library/ms880421. | ||||
| // This function returns "" (2 double quotes) if s is empty. | ||||
| @@ -95,3 +100,33 @@ func FullPath(name string) (path string, err error) { | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // NewProcThreadAttributeList allocates a new ProcThreadAttributeList, with the requested maximum number of attributes. | ||||
| func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeList, 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 | ||||
| 	} | ||||
| 	const psize = unsafe.Sizeof(uintptr(0)) | ||||
| 	// size is guaranteed to be ≥1 by InitializeProcThreadAttributeList. | ||||
| 	al := (*ProcThreadAttributeList)(unsafe.Pointer(&make([]unsafe.Pointer, (size+psize-1)/psize)[0])) | ||||
| 	err = initializeProcThreadAttributeList(al, maxAttrCount, 0, &size) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return al, err | ||||
| } | ||||
|  | ||||
| // Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute. | ||||
| func (al *ProcThreadAttributeList) Update(attribute uintptr, flags uint32, value unsafe.Pointer, size uintptr, prevValue unsafe.Pointer, returnedSize *uintptr) error { | ||||
| 	return updateProcThreadAttribute(al, flags, attribute, value, size, prevValue, returnedSize) | ||||
| } | ||||
|  | ||||
| // Delete frees ProcThreadAttributeList's resources. | ||||
| func (al *ProcThreadAttributeList) Delete() { | ||||
| 	deleteProcThreadAttributeList(al) | ||||
| } | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/golang.org/x/sys/windows/mkerrors.bash
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/golang.org/x/sys/windows/mkerrors.bash
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -9,6 +9,8 @@ shopt -s nullglob | ||||
|  | ||||
| winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" | ||||
| [[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } | ||||
| ntstatus="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/ntstatus.h | sort -Vr | head -n 1)" | ||||
| [[ -n $ntstatus ]] || { echo "Unable to find ntstatus.h" >&2; exit 1; } | ||||
|  | ||||
| declare -A errors | ||||
|  | ||||
| @@ -59,5 +61,10 @@ declare -A errors | ||||
| 		echo "$key $vtype = $value" | ||||
| 	done < "$winerror" | ||||
|  | ||||
| 	while read -r line; do | ||||
| 		[[ $line =~ ^#define\ (STATUS_[^\s]+)\ +\(\(NTSTATUS\)((0x)?[0-9a-fA-F]+)L?\) ]] || continue | ||||
| 		echo "${BASH_REMATCH[1]} NTStatus = ${BASH_REMATCH[2]}" | ||||
| 	done < "$ntstatus" | ||||
|  | ||||
| 	echo ")" | ||||
| } | gofmt > "zerrors_windows.go" | ||||
|   | ||||
							
								
								
									
										13
									
								
								vendor/golang.org/x/sys/windows/security_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/golang.org/x/sys/windows/security_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -908,6 +908,19 @@ type SECURITY_DESCRIPTOR struct { | ||||
| 	dacl     *ACL | ||||
| } | ||||
|  | ||||
| type SECURITY_QUALITY_OF_SERVICE struct { | ||||
| 	Length              uint32 | ||||
| 	ImpersonationLevel  uint32 | ||||
| 	ContextTrackingMode byte | ||||
| 	EffectiveOnly       byte | ||||
| } | ||||
|  | ||||
| // Constants for the ContextTrackingMode field of SECURITY_QUALITY_OF_SERVICE. | ||||
| const ( | ||||
| 	SECURITY_STATIC_TRACKING  = 0 | ||||
| 	SECURITY_DYNAMIC_TRACKING = 1 | ||||
| ) | ||||
|  | ||||
| type SecurityAttributes struct { | ||||
| 	Length             uint32 | ||||
| 	SecurityDescriptor *SECURITY_DESCRIPTOR | ||||
|   | ||||
							
								
								
									
										190
									
								
								vendor/golang.org/x/sys/windows/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										190
									
								
								vendor/golang.org/x/sys/windows/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -8,6 +8,8 @@ package windows | ||||
|  | ||||
| import ( | ||||
| 	errorspkg "errors" | ||||
| 	"fmt" | ||||
| 	"runtime" | ||||
| 	"sync" | ||||
| 	"syscall" | ||||
| 	"time" | ||||
| @@ -65,9 +67,8 @@ const ( | ||||
| 	LOCKFILE_FAIL_IMMEDIATELY = 0x00000001 | ||||
| 	LOCKFILE_EXCLUSIVE_LOCK   = 0x00000002 | ||||
|  | ||||
| 	// Return values of SleepEx and other APC functions | ||||
| 	STATUS_USER_APC    = 0x000000C0 | ||||
| 	WAIT_IO_COMPLETION = STATUS_USER_APC | ||||
| 	// Return value of SleepEx and other APC functions | ||||
| 	WAIT_IO_COMPLETION = 0x000000C0 | ||||
| ) | ||||
|  | ||||
| // StringToUTF16 is deprecated. Use UTF16FromString instead. | ||||
| @@ -180,6 +181,11 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process | ||||
| //sys	IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) = IsWow64Process2? | ||||
| //sys	CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW | ||||
| //sys	CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error)  [failretval==InvalidHandle] = CreateNamedPipeW | ||||
| //sys	ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) | ||||
| //sys	GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) | ||||
| //sys	GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW | ||||
| //sys	SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState | ||||
| //sys	ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) | ||||
| //sys	WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) | ||||
| //sys	GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) | ||||
| @@ -208,12 +214,15 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	GetSystemTimeAsFileTime(time *Filetime) | ||||
| //sys	GetSystemTimePreciseAsFileTime(time *Filetime) | ||||
| //sys	GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff] | ||||
| //sys	CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) | ||||
| //sys	GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) | ||||
| //sys	PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) | ||||
| //sys	CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) | ||||
| //sys	GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) | ||||
| //sys	PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) | ||||
| //sys	CancelIo(s Handle) (err error) | ||||
| //sys	CancelIoEx(s Handle, o *Overlapped) (err error) | ||||
| //sys	CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW | ||||
| //sys   initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) = InitializeProcThreadAttributeList | ||||
| //sys   deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) = DeleteProcThreadAttributeList | ||||
| //sys   updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) = UpdateProcThreadAttribute | ||||
| //sys	OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) | ||||
| //sys	ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW | ||||
| //sys	GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId | ||||
| @@ -248,13 +257,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW | ||||
| //sys	CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]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) | ||||
| //sys	FlushFileBuffers(handle Handle) (err error) | ||||
| //sys	GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) = kernel32.GetFullPathNameW | ||||
| //sys	GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) = kernel32.GetLongPathNameW | ||||
| //sys	GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) = kernel32.GetShortPathNameW | ||||
| //sys	GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) = kernel32.GetFinalPathNameByHandleW | ||||
| //sys	CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) = kernel32.CreateFileMappingW | ||||
| //sys	CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateFileMappingW | ||||
| //sys	MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) | ||||
| //sys	UnmapViewOfFile(addr uintptr) (err error) | ||||
| //sys	FlushViewOfFile(addr uintptr, length uintptr) (err error) | ||||
| @@ -283,6 +293,9 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy | ||||
| //sys	CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) = crypt32.CertGetNameStringW | ||||
| //sys	CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) = crypt32.CertFindExtension | ||||
| //sys   CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) [failretval==nil] = crypt32.CertFindCertificateInStore | ||||
| //sys   CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) [failretval==nil] = crypt32.CertFindChainInStore | ||||
| //sys   CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) = crypt32.CryptAcquireCertificatePrivateKey | ||||
| //sys	CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) = crypt32.CryptQueryObject | ||||
| //sys	CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) = crypt32.CryptDecodeObject | ||||
| //sys	CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptProtectData | ||||
| @@ -312,14 +325,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW | ||||
| //sys	CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) [failretval&0xff==0] = CreateHardLinkW | ||||
| //sys	GetCurrentThreadId() (id uint32) | ||||
| //sys	CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) = kernel32.CreateEventW | ||||
| //sys	CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateEventExW | ||||
| //sys	CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventW | ||||
| //sys	CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventExW | ||||
| //sys	OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenEventW | ||||
| //sys	SetEvent(event Handle) (err error) = kernel32.SetEvent | ||||
| //sys	ResetEvent(event Handle) (err error) = kernel32.ResetEvent | ||||
| //sys	PulseEvent(event Handle) (err error) = kernel32.PulseEvent | ||||
| //sys	CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) = kernel32.CreateMutexW | ||||
| //sys	CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateMutexExW | ||||
| //sys	CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexW | ||||
| //sys	CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexExW | ||||
| //sys	OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenMutexW | ||||
| //sys	ReleaseMutex(mutex Handle) (err error) = kernel32.ReleaseMutex | ||||
| //sys	SleepEx(milliseconds uint32, alertable bool) (ret uint32) = kernel32.SleepEx | ||||
| @@ -334,10 +347,13 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) | ||||
| //sys	GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) | ||||
| //sys	GetProcessId(process Handle) (id uint32, err error) | ||||
| //sys	QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) = kernel32.QueryFullProcessImageNameW | ||||
| //sys	OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) | ||||
| //sys	SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost | ||||
| //sys	GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) | ||||
| //sys	SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) | ||||
| //sys	GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) | ||||
| //sys	SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) | ||||
|  | ||||
| // Volume Management Functions | ||||
| //sys	DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW | ||||
| @@ -367,16 +383,36 @@ func NewCallbackCDecl(fn interface{}) uintptr { | ||||
| //sys	stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) = ole32.StringFromGUID2 | ||||
| //sys	coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid | ||||
| //sys	CoTaskMemFree(address unsafe.Pointer) = ole32.CoTaskMemFree | ||||
| //sys	rtlGetVersion(info *OsVersionInfoEx) (ret error) = ntdll.RtlGetVersion | ||||
| //sys	rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers | ||||
| //sys	CoInitializeEx(reserved uintptr, coInit uint32) (ret error) = ole32.CoInitializeEx | ||||
| //sys	CoUninitialize() = ole32.CoUninitialize | ||||
| //sys	CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) = ole32.CoGetObject | ||||
| //sys	getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetProcessPreferredUILanguages | ||||
| //sys	getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetThreadPreferredUILanguages | ||||
| //sys	getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetUserPreferredUILanguages | ||||
| //sys	getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetSystemPreferredUILanguages | ||||
| //sys	findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) = kernel32.FindResourceW | ||||
| //sys	SizeofResource(module Handle, resInfo Handle) (size uint32, err error) = kernel32.SizeofResource | ||||
| //sys	LoadResource(module Handle, resInfo Handle) (resData Handle, err error) = kernel32.LoadResource | ||||
| //sys	LockResource(resData Handle) (addr uintptr, err error) = kernel32.LockResource | ||||
|  | ||||
| // Process Status API (PSAPI) | ||||
| //sys	EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses | ||||
|  | ||||
| // NT Native APIs | ||||
| //sys	rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb | ||||
| //sys	rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) = ntdll.RtlGetVersion | ||||
| //sys	rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers | ||||
| //sys	RtlGetCurrentPeb() (peb *PEB) = ntdll.RtlGetCurrentPeb | ||||
| //sys	RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) = ntdll.RtlInitUnicodeString | ||||
| //sys	RtlInitString(destinationString *NTString, sourceString *byte) = ntdll.RtlInitString | ||||
| //sys	NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) = ntdll.NtCreateFile | ||||
| //sys	NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) = ntdll.NtCreateNamedPipeFile | ||||
| //sys	RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToNtPathName_U_WithStatus | ||||
| //sys	RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToRelativeNtPathName_U_WithStatus | ||||
| //sys	RtlDefaultNpAcl(acl **ACL) (ntstatus error) = ntdll.RtlDefaultNpAcl | ||||
| //sys	NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) = ntdll.NtQueryInformationProcess | ||||
| //sys	NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) = ntdll.NtSetInformationProcess | ||||
|  | ||||
| // syscall interface implementation for other packages | ||||
|  | ||||
| // GetCurrentProcess returns the handle for the current process. | ||||
| @@ -770,6 +806,7 @@ const socket_error = uintptr(^uint32(0)) | ||||
| //sys	WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASend | ||||
| //sys	WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32,  from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecvFrom | ||||
| //sys	WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32,  overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASendTo | ||||
| //sys	WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.WSASocketW | ||||
| //sys	GetHostByName(name string) (h *Hostent, err error) [failretval==nil] = ws2_32.gethostbyname | ||||
| //sys	GetServByName(name string, proto string) (s *Servent, err error) [failretval==nil] = ws2_32.getservbyname | ||||
| //sys	Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs | ||||
| @@ -783,6 +820,7 @@ const socket_error = uintptr(^uint32(0)) | ||||
| //sys	GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) = iphlpapi.GetAdaptersInfo | ||||
| //sys	SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) = kernel32.SetFileCompletionNotificationModes | ||||
| //sys	WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) [failretval==-1] = ws2_32.WSAEnumProtocolsW | ||||
| //sys	WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult | ||||
| //sys	GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) = iphlpapi.GetAdaptersAddresses | ||||
| //sys	GetACP() (acp uint32) = kernel32.GetACP | ||||
| //sys	MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar | ||||
| @@ -1505,3 +1543,129 @@ func getUILanguages(flags uint32, f func(flags uint32, numLanguages *uint32, buf | ||||
| func SetConsoleCursorPosition(console Handle, position Coord) error { | ||||
| 	return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position)))) | ||||
| } | ||||
|  | ||||
| func (s NTStatus) Errno() syscall.Errno { | ||||
| 	return rtlNtStatusToDosErrorNoTeb(s) | ||||
| } | ||||
|  | ||||
| func langID(pri, sub uint16) uint32 { return uint32(sub)<<10 | uint32(pri) } | ||||
|  | ||||
| func (s NTStatus) Error() string { | ||||
| 	b := make([]uint16, 300) | ||||
| 	n, err := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ARGUMENT_ARRAY, modntdll.Handle(), uint32(s), langID(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil) | ||||
| 	if err != nil { | ||||
| 		return fmt.Sprintf("NTSTATUS 0x%08x", uint32(s)) | ||||
| 	} | ||||
| 	// trim terminating \r and \n | ||||
| 	for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- { | ||||
| 	} | ||||
| 	return string(utf16.Decode(b[:n])) | ||||
| } | ||||
|  | ||||
| // NewNTUnicodeString returns a new NTUnicodeString structure for use with native | ||||
| // NT APIs that work over the NTUnicodeString type. Note that most Windows APIs | ||||
| // do not use NTUnicodeString, and instead UTF16PtrFromString should be used for | ||||
| // the more common *uint16 string type. | ||||
| func NewNTUnicodeString(s string) (*NTUnicodeString, error) { | ||||
| 	var u NTUnicodeString | ||||
| 	s16, err := UTF16PtrFromString(s) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	RtlInitUnicodeString(&u, s16) | ||||
| 	return &u, nil | ||||
| } | ||||
|  | ||||
| // 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 | ||||
| } | ||||
|  | ||||
| func (s *NTUnicodeString) String() string { | ||||
| 	return UTF16ToString(s.Slice()) | ||||
| } | ||||
|  | ||||
| // NewNTString returns a new NTString structure for use with native | ||||
| // NT APIs that work over the NTString type. Note that most Windows APIs | ||||
| // do not use NTString, and instead UTF16PtrFromString should be used for | ||||
| // the more common *uint16 string type. | ||||
| func NewNTString(s string) (*NTString, error) { | ||||
| 	var nts NTString | ||||
| 	s8, err := BytePtrFromString(s) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	RtlInitString(&nts, s8) | ||||
| 	return &nts, nil | ||||
| } | ||||
|  | ||||
| // 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 | ||||
| } | ||||
|  | ||||
| func (s *NTString) String() string { | ||||
| 	return ByteSliceToString(s.Slice()) | ||||
| } | ||||
|  | ||||
| // FindResource resolves a resource of the given name and resource type. | ||||
| func FindResource(module Handle, name, resType ResourceIDOrString) (Handle, error) { | ||||
| 	var namePtr, resTypePtr uintptr | ||||
| 	var name16, resType16 *uint16 | ||||
| 	var err error | ||||
| 	resolvePtr := func(i interface{}, keep **uint16) (uintptr, error) { | ||||
| 		switch v := i.(type) { | ||||
| 		case string: | ||||
| 			*keep, err = UTF16PtrFromString(v) | ||||
| 			if err != nil { | ||||
| 				return 0, err | ||||
| 			} | ||||
| 			return uintptr(unsafe.Pointer(*keep)), nil | ||||
| 		case ResourceID: | ||||
| 			return uintptr(v), nil | ||||
| 		} | ||||
| 		return 0, errorspkg.New("parameter must be a ResourceID or a string") | ||||
| 	} | ||||
| 	namePtr, err = resolvePtr(name, &name16) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 	resTypePtr, err = resolvePtr(resType, &resType16) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 	resInfo, err := findResource(module, namePtr, resTypePtr) | ||||
| 	runtime.KeepAlive(name16) | ||||
| 	runtime.KeepAlive(resType16) | ||||
| 	return resInfo, err | ||||
| } | ||||
|  | ||||
| func LoadResourceData(module, resInfo Handle) (data []byte, err error) { | ||||
| 	size, err := SizeofResource(module, resInfo) | ||||
| 	if err != nil { | ||||
| 		return | ||||
| 	} | ||||
| 	resData, err := LoadResource(module, resInfo) | ||||
| 	if err != nil { | ||||
| 		return | ||||
| 	} | ||||
| 	ptr, err := LockResource(resData) | ||||
| 	if err != nil { | ||||
| 		return | ||||
| 	} | ||||
| 	h := (*unsafeheader.Slice)(unsafe.Pointer(&data)) | ||||
| 	h.Data = unsafe.Pointer(ptr) | ||||
| 	h.Len = int(size) | ||||
| 	h.Cap = int(size) | ||||
| 	return | ||||
| } | ||||
|   | ||||
							
								
								
									
										681
									
								
								vendor/golang.org/x/sys/windows/types_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										681
									
								
								vendor/golang.org/x/sys/windows/types_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -10,6 +10,10 @@ import ( | ||||
| 	"unsafe" | ||||
| ) | ||||
|  | ||||
| // NTStatus corresponds with NTSTATUS, error values returned by ntdll.dll and | ||||
| // other native functions. | ||||
| type NTStatus uint32 | ||||
|  | ||||
| const ( | ||||
| 	// Invented values to support what package os expects. | ||||
| 	O_RDONLY   = 0x00000 | ||||
| @@ -215,6 +219,18 @@ const ( | ||||
| 	INHERIT_PARENT_AFFINITY          = 0x00010000 | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	// attributes for ProcThreadAttributeList | ||||
| 	PROC_THREAD_ATTRIBUTE_PARENT_PROCESS    = 0x00020000 | ||||
| 	PROC_THREAD_ATTRIBUTE_HANDLE_LIST       = 0x00020002 | ||||
| 	PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY    = 0x00030003 | ||||
| 	PROC_THREAD_ATTRIBUTE_PREFERRED_NODE    = 0x00020004 | ||||
| 	PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR   = 0x00030005 | ||||
| 	PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007 | ||||
| 	PROC_THREAD_ATTRIBUTE_UMS_THREAD        = 0x00030006 | ||||
| 	PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL  = 0x0002000b | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	// flags for CreateToolhelp32Snapshot | ||||
| 	TH32CS_SNAPHEAPLIST = 0x01 | ||||
| @@ -287,6 +303,23 @@ const ( | ||||
| 	PKCS12_NO_PERSIST_KEY              = 0x00008000 | ||||
| 	PKCS12_INCLUDE_EXTENDED_PROPERTIES = 0x00000010 | ||||
|  | ||||
| 	/* Flags for CryptAcquireCertificatePrivateKey */ | ||||
| 	CRYPT_ACQUIRE_CACHE_FLAG             = 0x00000001 | ||||
| 	CRYPT_ACQUIRE_USE_PROV_INFO_FLAG     = 0x00000002 | ||||
| 	CRYPT_ACQUIRE_COMPARE_KEY_FLAG       = 0x00000004 | ||||
| 	CRYPT_ACQUIRE_NO_HEALING             = 0x00000008 | ||||
| 	CRYPT_ACQUIRE_SILENT_FLAG            = 0x00000040 | ||||
| 	CRYPT_ACQUIRE_WINDOW_HANDLE_FLAG     = 0x00000080 | ||||
| 	CRYPT_ACQUIRE_NCRYPT_KEY_FLAGS_MASK  = 0x00070000 | ||||
| 	CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG  = 0x00010000 | ||||
| 	CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG = 0x00020000 | ||||
| 	CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG   = 0x00040000 | ||||
|  | ||||
| 	/* pdwKeySpec for CryptAcquireCertificatePrivateKey */ | ||||
| 	AT_KEYEXCHANGE       = 1 | ||||
| 	AT_SIGNATURE         = 2 | ||||
| 	CERT_NCRYPT_KEY_SPEC = 0xFFFFFFFF | ||||
|  | ||||
| 	/* Default usage match type is AND with value zero */ | ||||
| 	USAGE_MATCH_TYPE_AND = 0 | ||||
| 	USAGE_MATCH_TYPE_OR  = 1 | ||||
| @@ -412,6 +445,89 @@ const ( | ||||
| 	CERT_TRUST_IS_CA_TRUSTED                 = 0x00004000 | ||||
| 	CERT_TRUST_IS_COMPLEX_CHAIN              = 0x00010000 | ||||
|  | ||||
| 	/* Certificate Information Flags */ | ||||
| 	CERT_INFO_VERSION_FLAG                 = 1 | ||||
| 	CERT_INFO_SERIAL_NUMBER_FLAG           = 2 | ||||
| 	CERT_INFO_SIGNATURE_ALGORITHM_FLAG     = 3 | ||||
| 	CERT_INFO_ISSUER_FLAG                  = 4 | ||||
| 	CERT_INFO_NOT_BEFORE_FLAG              = 5 | ||||
| 	CERT_INFO_NOT_AFTER_FLAG               = 6 | ||||
| 	CERT_INFO_SUBJECT_FLAG                 = 7 | ||||
| 	CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG = 8 | ||||
| 	CERT_INFO_ISSUER_UNIQUE_ID_FLAG        = 9 | ||||
| 	CERT_INFO_SUBJECT_UNIQUE_ID_FLAG       = 10 | ||||
| 	CERT_INFO_EXTENSION_FLAG               = 11 | ||||
|  | ||||
| 	/* dwFindType for CertFindCertificateInStore  */ | ||||
| 	CERT_COMPARE_MASK                     = 0xFFFF | ||||
| 	CERT_COMPARE_SHIFT                    = 16 | ||||
| 	CERT_COMPARE_ANY                      = 0 | ||||
| 	CERT_COMPARE_SHA1_HASH                = 1 | ||||
| 	CERT_COMPARE_NAME                     = 2 | ||||
| 	CERT_COMPARE_ATTR                     = 3 | ||||
| 	CERT_COMPARE_MD5_HASH                 = 4 | ||||
| 	CERT_COMPARE_PROPERTY                 = 5 | ||||
| 	CERT_COMPARE_PUBLIC_KEY               = 6 | ||||
| 	CERT_COMPARE_HASH                     = CERT_COMPARE_SHA1_HASH | ||||
| 	CERT_COMPARE_NAME_STR_A               = 7 | ||||
| 	CERT_COMPARE_NAME_STR_W               = 8 | ||||
| 	CERT_COMPARE_KEY_SPEC                 = 9 | ||||
| 	CERT_COMPARE_ENHKEY_USAGE             = 10 | ||||
| 	CERT_COMPARE_CTL_USAGE                = CERT_COMPARE_ENHKEY_USAGE | ||||
| 	CERT_COMPARE_SUBJECT_CERT             = 11 | ||||
| 	CERT_COMPARE_ISSUER_OF                = 12 | ||||
| 	CERT_COMPARE_EXISTING                 = 13 | ||||
| 	CERT_COMPARE_SIGNATURE_HASH           = 14 | ||||
| 	CERT_COMPARE_KEY_IDENTIFIER           = 15 | ||||
| 	CERT_COMPARE_CERT_ID                  = 16 | ||||
| 	CERT_COMPARE_CROSS_CERT_DIST_POINTS   = 17 | ||||
| 	CERT_COMPARE_PUBKEY_MD5_HASH          = 18 | ||||
| 	CERT_COMPARE_SUBJECT_INFO_ACCESS      = 19 | ||||
| 	CERT_COMPARE_HASH_STR                 = 20 | ||||
| 	CERT_COMPARE_HAS_PRIVATE_KEY          = 21 | ||||
| 	CERT_FIND_ANY                         = (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_SHA1_HASH                   = (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_MD5_HASH                    = (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_SIGNATURE_HASH              = (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_KEY_IDENTIFIER              = (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_HASH                        = CERT_FIND_SHA1_HASH | ||||
| 	CERT_FIND_PROPERTY                    = (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_PUBLIC_KEY                  = (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_SUBJECT_NAME                = (CERT_COMPARE_NAME<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) | ||||
| 	CERT_FIND_SUBJECT_ATTR                = (CERT_COMPARE_ATTR<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) | ||||
| 	CERT_FIND_ISSUER_NAME                 = (CERT_COMPARE_NAME<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) | ||||
| 	CERT_FIND_ISSUER_ATTR                 = (CERT_COMPARE_ATTR<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) | ||||
| 	CERT_FIND_SUBJECT_STR_A               = (CERT_COMPARE_NAME_STR_A<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) | ||||
| 	CERT_FIND_SUBJECT_STR_W               = (CERT_COMPARE_NAME_STR_W<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) | ||||
| 	CERT_FIND_SUBJECT_STR                 = CERT_FIND_SUBJECT_STR_W | ||||
| 	CERT_FIND_ISSUER_STR_A                = (CERT_COMPARE_NAME_STR_A<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) | ||||
| 	CERT_FIND_ISSUER_STR_W                = (CERT_COMPARE_NAME_STR_W<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) | ||||
| 	CERT_FIND_ISSUER_STR                  = CERT_FIND_ISSUER_STR_W | ||||
| 	CERT_FIND_KEY_SPEC                    = (CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_ENHKEY_USAGE                = (CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_CTL_USAGE                   = CERT_FIND_ENHKEY_USAGE | ||||
| 	CERT_FIND_SUBJECT_CERT                = (CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_ISSUER_OF                   = (CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_EXISTING                    = (CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_CERT_ID                     = (CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_CROSS_CERT_DIST_POINTS      = (CERT_COMPARE_CROSS_CERT_DIST_POINTS << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_PUBKEY_MD5_HASH             = (CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_SUBJECT_INFO_ACCESS         = (CERT_COMPARE_SUBJECT_INFO_ACCESS << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_HASH_STR                    = (CERT_COMPARE_HASH_STR << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_HAS_PRIVATE_KEY             = (CERT_COMPARE_HAS_PRIVATE_KEY << CERT_COMPARE_SHIFT) | ||||
| 	CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG  = 0x1 | ||||
| 	CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG  = 0x2 | ||||
| 	CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG = 0x4 | ||||
| 	CERT_FIND_NO_ENHKEY_USAGE_FLAG        = 0x8 | ||||
| 	CERT_FIND_OR_ENHKEY_USAGE_FLAG        = 0x10 | ||||
| 	CERT_FIND_VALID_ENHKEY_USAGE_FLAG     = 0x20 | ||||
| 	CERT_FIND_OPTIONAL_CTL_USAGE_FLAG     = CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG | ||||
| 	CERT_FIND_EXT_ONLY_CTL_USAGE_FLAG     = CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG | ||||
| 	CERT_FIND_PROP_ONLY_CTL_USAGE_FLAG    = CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG | ||||
| 	CERT_FIND_NO_CTL_USAGE_FLAG           = CERT_FIND_NO_ENHKEY_USAGE_FLAG | ||||
| 	CERT_FIND_OR_CTL_USAGE_FLAG           = CERT_FIND_OR_ENHKEY_USAGE_FLAG | ||||
| 	CERT_FIND_VALID_CTL_USAGE_FLAG        = CERT_FIND_VALID_ENHKEY_USAGE_FLAG | ||||
|  | ||||
| 	/* policyOID values for CertVerifyCertificateChainPolicy function */ | ||||
| 	CERT_CHAIN_POLICY_BASE              = 1 | ||||
| 	CERT_CHAIN_POLICY_AUTHENTICODE      = 2 | ||||
| @@ -423,6 +539,17 @@ const ( | ||||
| 	CERT_CHAIN_POLICY_EV                = 8 | ||||
| 	CERT_CHAIN_POLICY_SSL_F12           = 9 | ||||
|  | ||||
| 	/* flag for dwFindType CertFindChainInStore  */ | ||||
| 	CERT_CHAIN_FIND_BY_ISSUER = 1 | ||||
|  | ||||
| 	/* dwFindFlags for CertFindChainInStore when dwFindType == CERT_CHAIN_FIND_BY_ISSUER */ | ||||
| 	CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG    = 0x0001 | ||||
| 	CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG  = 0x0002 | ||||
| 	CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG = 0x0004 | ||||
| 	CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG  = 0x0008 | ||||
| 	CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG         = 0x4000 | ||||
| 	CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG     = 0x8000 | ||||
|  | ||||
| 	/* Certificate Store close flags */ | ||||
| 	CERT_CLOSE_STORE_FORCE_FLAG = 0x00000001 | ||||
| 	CERT_CLOSE_STORE_CHECK_FLAG = 0x00000002 | ||||
| @@ -683,6 +810,14 @@ type win32finddata1 struct { | ||||
| 	Reserved1         uint32 | ||||
| 	FileName          [MAX_PATH]uint16 | ||||
| 	AlternateFileName [14]uint16 | ||||
|  | ||||
| 	// The Microsoft documentation for this struct¹ describes three additional | ||||
| 	// fields: dwFileType, dwCreatorType, and wFinderFlags. However, those fields | ||||
| 	// are empirically only present in the macOS port of the Win32 API,² and thus | ||||
| 	// not needed for binaries built for Windows. | ||||
| 	// | ||||
| 	// ¹ https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-win32_find_dataw describe | ||||
| 	// ² https://golang.org/issue/42637#issuecomment-760715755. | ||||
| } | ||||
|  | ||||
| func copyFindData(dst *Win32finddata, src *win32finddata1) { | ||||
| @@ -767,6 +902,23 @@ type StartupInfo struct { | ||||
| 	StdErr        Handle | ||||
| } | ||||
|  | ||||
| type StartupInfoEx struct { | ||||
| 	StartupInfo | ||||
| 	ProcThreadAttributeList *ProcThreadAttributeList | ||||
| } | ||||
|  | ||||
| // ProcThreadAttributeList is a placeholder type to represent a PROC_THREAD_ATTRIBUTE_LIST. | ||||
| // | ||||
| // To create a *ProcThreadAttributeList, use NewProcThreadAttributeList, and | ||||
| // free its memory using ProcThreadAttributeList.Delete. | ||||
| type ProcThreadAttributeList struct { | ||||
| 	// This is of type unsafe.Pointer, not of type byte or uintptr, because | ||||
| 	// the contents of it is mostly a list of pointers, and in most cases, | ||||
| 	// that's a list of pointers to Go-allocated objects. In order to keep | ||||
| 	// the GC from collecting these objects, we declare this as unsafe.Pointer. | ||||
| 	_ [1]unsafe.Pointer | ||||
| } | ||||
|  | ||||
| type ProcessInformation struct { | ||||
| 	Process   Handle | ||||
| 	Thread    Handle | ||||
| @@ -868,6 +1020,7 @@ const ( | ||||
|  | ||||
| 	// cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 | ||||
|  | ||||
| 	IP_HDRINCL         = 0x2 | ||||
| 	IP_TOS             = 0x3 | ||||
| 	IP_TTL             = 0x4 | ||||
| 	IP_MULTICAST_IF    = 0x9 | ||||
| @@ -875,6 +1028,7 @@ const ( | ||||
| 	IP_MULTICAST_LOOP  = 0xb | ||||
| 	IP_ADD_MEMBERSHIP  = 0xc | ||||
| 	IP_DROP_MEMBERSHIP = 0xd | ||||
| 	IP_PKTINFO         = 0x13 | ||||
|  | ||||
| 	IPV6_V6ONLY         = 0x1b | ||||
| 	IPV6_UNICAST_HOPS   = 0x4 | ||||
| @@ -883,6 +1037,7 @@ const ( | ||||
| 	IPV6_MULTICAST_LOOP = 0xb | ||||
| 	IPV6_JOIN_GROUP     = 0xc | ||||
| 	IPV6_LEAVE_GROUP    = 0xd | ||||
| 	IPV6_PKTINFO        = 0x13 | ||||
|  | ||||
| 	MSG_OOB       = 0x1 | ||||
| 	MSG_PEEK      = 0x2 | ||||
| @@ -920,6 +1075,18 @@ type WSAMsg struct { | ||||
| 	Flags       uint32 | ||||
| } | ||||
|  | ||||
| // Flags for WSASocket | ||||
| const ( | ||||
| 	WSA_FLAG_OVERLAPPED             = 0x01 | ||||
| 	WSA_FLAG_MULTIPOINT_C_ROOT      = 0x02 | ||||
| 	WSA_FLAG_MULTIPOINT_C_LEAF      = 0x04 | ||||
| 	WSA_FLAG_MULTIPOINT_D_ROOT      = 0x08 | ||||
| 	WSA_FLAG_MULTIPOINT_D_LEAF      = 0x10 | ||||
| 	WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40 | ||||
| 	WSA_FLAG_NO_HANDLE_INHERIT      = 0x80 | ||||
| 	WSA_FLAG_REGISTERED_IO          = 0x100 | ||||
| ) | ||||
|  | ||||
| // Invented values to support what package os expects. | ||||
| const ( | ||||
| 	S_IFMT   = 0x1f000 | ||||
| @@ -1360,6 +1527,19 @@ type CryptProtectPromptStruct struct { | ||||
| 	Prompt      *uint16 | ||||
| } | ||||
|  | ||||
| type CertChainFindByIssuerPara struct { | ||||
| 	Size                   uint32 | ||||
| 	UsageIdentifier        *byte | ||||
| 	KeySpec                uint32 | ||||
| 	AcquirePrivateKeyFlags uint32 | ||||
| 	IssuerCount            uint32 | ||||
| 	Issuer                 Pointer | ||||
| 	FindCallback           Pointer | ||||
| 	FindArg                Pointer | ||||
| 	IssuerChainIndex       *uint32 | ||||
| 	IssuerElementIndex     *uint32 | ||||
| } | ||||
|  | ||||
| type WinTrustData struct { | ||||
| 	Size                            uint32 | ||||
| 	PolicyCallbackData              uintptr | ||||
| @@ -2091,3 +2271,504 @@ const ( | ||||
| 	// REG_NOTIFY_THREAD_AGNOSTIC indicates that the lifetime of the registration must not be tied to the lifetime of the thread issuing the RegNotifyChangeKeyValue call. Note: This flag value is only supported in Windows 8 and later. | ||||
| 	REG_NOTIFY_THREAD_AGNOSTIC = 0x10000000 | ||||
| ) | ||||
|  | ||||
| type CommTimeouts struct { | ||||
| 	ReadIntervalTimeout         uint32 | ||||
| 	ReadTotalTimeoutMultiplier  uint32 | ||||
| 	ReadTotalTimeoutConstant    uint32 | ||||
| 	WriteTotalTimeoutMultiplier uint32 | ||||
| 	WriteTotalTimeoutConstant   uint32 | ||||
| } | ||||
|  | ||||
| // NTUnicodeString is a UTF-16 string for NT native APIs, corresponding to UNICODE_STRING. | ||||
| type NTUnicodeString struct { | ||||
| 	Length        uint16 | ||||
| 	MaximumLength uint16 | ||||
| 	Buffer        *uint16 | ||||
| } | ||||
|  | ||||
| // NTString is an ANSI string for NT native APIs, corresponding to STRING. | ||||
| type NTString struct { | ||||
| 	Length        uint16 | ||||
| 	MaximumLength uint16 | ||||
| 	Buffer        *byte | ||||
| } | ||||
|  | ||||
| type LIST_ENTRY struct { | ||||
| 	Flink *LIST_ENTRY | ||||
| 	Blink *LIST_ENTRY | ||||
| } | ||||
|  | ||||
| type LDR_DATA_TABLE_ENTRY struct { | ||||
| 	reserved1          [2]uintptr | ||||
| 	InMemoryOrderLinks LIST_ENTRY | ||||
| 	reserved2          [2]uintptr | ||||
| 	DllBase            uintptr | ||||
| 	reserved3          [2]uintptr | ||||
| 	FullDllName        NTUnicodeString | ||||
| 	reserved4          [8]byte | ||||
| 	reserved5          [3]uintptr | ||||
| 	reserved6          uintptr | ||||
| 	TimeDateStamp      uint32 | ||||
| } | ||||
|  | ||||
| type PEB_LDR_DATA struct { | ||||
| 	reserved1               [8]byte | ||||
| 	reserved2               [3]uintptr | ||||
| 	InMemoryOrderModuleList LIST_ENTRY | ||||
| } | ||||
|  | ||||
| type CURDIR struct { | ||||
| 	DosPath NTUnicodeString | ||||
| 	Handle  Handle | ||||
| } | ||||
|  | ||||
| type RTL_DRIVE_LETTER_CURDIR struct { | ||||
| 	Flags     uint16 | ||||
| 	Length    uint16 | ||||
| 	TimeStamp uint32 | ||||
| 	DosPath   NTString | ||||
| } | ||||
|  | ||||
| type RTL_USER_PROCESS_PARAMETERS struct { | ||||
| 	MaximumLength, Length uint32 | ||||
|  | ||||
| 	Flags, DebugFlags uint32 | ||||
|  | ||||
| 	ConsoleHandle                                Handle | ||||
| 	ConsoleFlags                                 uint32 | ||||
| 	StandardInput, StandardOutput, StandardError Handle | ||||
|  | ||||
| 	CurrentDirectory CURDIR | ||||
| 	DllPath          NTUnicodeString | ||||
| 	ImagePathName    NTUnicodeString | ||||
| 	CommandLine      NTUnicodeString | ||||
| 	Environment      unsafe.Pointer | ||||
|  | ||||
| 	StartingX, StartingY, CountX, CountY, CountCharsX, CountCharsY, FillAttribute uint32 | ||||
|  | ||||
| 	WindowFlags, ShowWindowFlags                     uint32 | ||||
| 	WindowTitle, DesktopInfo, ShellInfo, RuntimeData NTUnicodeString | ||||
| 	CurrentDirectories                               [32]RTL_DRIVE_LETTER_CURDIR | ||||
|  | ||||
| 	EnvironmentSize, EnvironmentVersion uintptr | ||||
|  | ||||
| 	PackageDependencyData unsafe.Pointer | ||||
| 	ProcessGroupId        uint32 | ||||
| 	LoaderThreads         uint32 | ||||
|  | ||||
| 	RedirectionDllName               NTUnicodeString | ||||
| 	HeapPartitionName                NTUnicodeString | ||||
| 	DefaultThreadpoolCpuSetMasks     uintptr | ||||
| 	DefaultThreadpoolCpuSetMaskCount uint32 | ||||
| } | ||||
|  | ||||
| type PEB struct { | ||||
| 	reserved1              [2]byte | ||||
| 	BeingDebugged          byte | ||||
| 	BitField               byte | ||||
| 	reserved3              uintptr | ||||
| 	ImageBaseAddress       uintptr | ||||
| 	Ldr                    *PEB_LDR_DATA | ||||
| 	ProcessParameters      *RTL_USER_PROCESS_PARAMETERS | ||||
| 	reserved4              [3]uintptr | ||||
| 	AtlThunkSListPtr       uintptr | ||||
| 	reserved5              uintptr | ||||
| 	reserved6              uint32 | ||||
| 	reserved7              uintptr | ||||
| 	reserved8              uint32 | ||||
| 	AtlThunkSListPtr32     uint32 | ||||
| 	reserved9              [45]uintptr | ||||
| 	reserved10             [96]byte | ||||
| 	PostProcessInitRoutine uintptr | ||||
| 	reserved11             [128]byte | ||||
| 	reserved12             [1]uintptr | ||||
| 	SessionId              uint32 | ||||
| } | ||||
|  | ||||
| type OBJECT_ATTRIBUTES struct { | ||||
| 	Length             uint32 | ||||
| 	RootDirectory      Handle | ||||
| 	ObjectName         *NTUnicodeString | ||||
| 	Attributes         uint32 | ||||
| 	SecurityDescriptor *SECURITY_DESCRIPTOR | ||||
| 	SecurityQoS        *SECURITY_QUALITY_OF_SERVICE | ||||
| } | ||||
|  | ||||
| // Values for the Attributes member of OBJECT_ATTRIBUTES. | ||||
| const ( | ||||
| 	OBJ_INHERIT                       = 0x00000002 | ||||
| 	OBJ_PERMANENT                     = 0x00000010 | ||||
| 	OBJ_EXCLUSIVE                     = 0x00000020 | ||||
| 	OBJ_CASE_INSENSITIVE              = 0x00000040 | ||||
| 	OBJ_OPENIF                        = 0x00000080 | ||||
| 	OBJ_OPENLINK                      = 0x00000100 | ||||
| 	OBJ_KERNEL_HANDLE                 = 0x00000200 | ||||
| 	OBJ_FORCE_ACCESS_CHECK            = 0x00000400 | ||||
| 	OBJ_IGNORE_IMPERSONATED_DEVICEMAP = 0x00000800 | ||||
| 	OBJ_DONT_REPARSE                  = 0x00001000 | ||||
| 	OBJ_VALID_ATTRIBUTES              = 0x00001FF2 | ||||
| ) | ||||
|  | ||||
| type IO_STATUS_BLOCK struct { | ||||
| 	Status      NTStatus | ||||
| 	Information uintptr | ||||
| } | ||||
|  | ||||
| type RTLP_CURDIR_REF struct { | ||||
| 	RefCount int32 | ||||
| 	Handle   Handle | ||||
| } | ||||
|  | ||||
| type RTL_RELATIVE_NAME struct { | ||||
| 	RelativeName        NTUnicodeString | ||||
| 	ContainingDirectory Handle | ||||
| 	CurDirRef           *RTLP_CURDIR_REF | ||||
| } | ||||
|  | ||||
| const ( | ||||
| 	// CreateDisposition flags for NtCreateFile and NtCreateNamedPipeFile. | ||||
| 	FILE_SUPERSEDE           = 0x00000000 | ||||
| 	FILE_OPEN                = 0x00000001 | ||||
| 	FILE_CREATE              = 0x00000002 | ||||
| 	FILE_OPEN_IF             = 0x00000003 | ||||
| 	FILE_OVERWRITE           = 0x00000004 | ||||
| 	FILE_OVERWRITE_IF        = 0x00000005 | ||||
| 	FILE_MAXIMUM_DISPOSITION = 0x00000005 | ||||
|  | ||||
| 	// CreateOptions flags for NtCreateFile and NtCreateNamedPipeFile. | ||||
| 	FILE_DIRECTORY_FILE            = 0x00000001 | ||||
| 	FILE_WRITE_THROUGH             = 0x00000002 | ||||
| 	FILE_SEQUENTIAL_ONLY           = 0x00000004 | ||||
| 	FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008 | ||||
| 	FILE_SYNCHRONOUS_IO_ALERT      = 0x00000010 | ||||
| 	FILE_SYNCHRONOUS_IO_NONALERT   = 0x00000020 | ||||
| 	FILE_NON_DIRECTORY_FILE        = 0x00000040 | ||||
| 	FILE_CREATE_TREE_CONNECTION    = 0x00000080 | ||||
| 	FILE_COMPLETE_IF_OPLOCKED      = 0x00000100 | ||||
| 	FILE_NO_EA_KNOWLEDGE           = 0x00000200 | ||||
| 	FILE_OPEN_REMOTE_INSTANCE      = 0x00000400 | ||||
| 	FILE_RANDOM_ACCESS             = 0x00000800 | ||||
| 	FILE_DELETE_ON_CLOSE           = 0x00001000 | ||||
| 	FILE_OPEN_BY_FILE_ID           = 0x00002000 | ||||
| 	FILE_OPEN_FOR_BACKUP_INTENT    = 0x00004000 | ||||
| 	FILE_NO_COMPRESSION            = 0x00008000 | ||||
| 	FILE_OPEN_REQUIRING_OPLOCK     = 0x00010000 | ||||
| 	FILE_DISALLOW_EXCLUSIVE        = 0x00020000 | ||||
| 	FILE_RESERVE_OPFILTER          = 0x00100000 | ||||
| 	FILE_OPEN_REPARSE_POINT        = 0x00200000 | ||||
| 	FILE_OPEN_NO_RECALL            = 0x00400000 | ||||
| 	FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000 | ||||
|  | ||||
| 	// Parameter constants for NtCreateNamedPipeFile. | ||||
|  | ||||
| 	FILE_PIPE_BYTE_STREAM_TYPE = 0x00000000 | ||||
| 	FILE_PIPE_MESSAGE_TYPE     = 0x00000001 | ||||
|  | ||||
| 	FILE_PIPE_ACCEPT_REMOTE_CLIENTS = 0x00000000 | ||||
| 	FILE_PIPE_REJECT_REMOTE_CLIENTS = 0x00000002 | ||||
|  | ||||
| 	FILE_PIPE_TYPE_VALID_MASK = 0x00000003 | ||||
|  | ||||
| 	FILE_PIPE_BYTE_STREAM_MODE = 0x00000000 | ||||
| 	FILE_PIPE_MESSAGE_MODE     = 0x00000001 | ||||
|  | ||||
| 	FILE_PIPE_QUEUE_OPERATION    = 0x00000000 | ||||
| 	FILE_PIPE_COMPLETE_OPERATION = 0x00000001 | ||||
|  | ||||
| 	FILE_PIPE_INBOUND     = 0x00000000 | ||||
| 	FILE_PIPE_OUTBOUND    = 0x00000001 | ||||
| 	FILE_PIPE_FULL_DUPLEX = 0x00000002 | ||||
|  | ||||
| 	FILE_PIPE_DISCONNECTED_STATE = 0x00000001 | ||||
| 	FILE_PIPE_LISTENING_STATE    = 0x00000002 | ||||
| 	FILE_PIPE_CONNECTED_STATE    = 0x00000003 | ||||
| 	FILE_PIPE_CLOSING_STATE      = 0x00000004 | ||||
|  | ||||
| 	FILE_PIPE_CLIENT_END = 0x00000000 | ||||
| 	FILE_PIPE_SERVER_END = 0x00000001 | ||||
| ) | ||||
|  | ||||
| // ProcessInformationClasses for NtQueryInformationProcess and NtSetInformationProcess. | ||||
| const ( | ||||
| 	ProcessBasicInformation = iota | ||||
| 	ProcessQuotaLimits | ||||
| 	ProcessIoCounters | ||||
| 	ProcessVmCounters | ||||
| 	ProcessTimes | ||||
| 	ProcessBasePriority | ||||
| 	ProcessRaisePriority | ||||
| 	ProcessDebugPort | ||||
| 	ProcessExceptionPort | ||||
| 	ProcessAccessToken | ||||
| 	ProcessLdtInformation | ||||
| 	ProcessLdtSize | ||||
| 	ProcessDefaultHardErrorMode | ||||
| 	ProcessIoPortHandlers | ||||
| 	ProcessPooledUsageAndLimits | ||||
| 	ProcessWorkingSetWatch | ||||
| 	ProcessUserModeIOPL | ||||
| 	ProcessEnableAlignmentFaultFixup | ||||
| 	ProcessPriorityClass | ||||
| 	ProcessWx86Information | ||||
| 	ProcessHandleCount | ||||
| 	ProcessAffinityMask | ||||
| 	ProcessPriorityBoost | ||||
| 	ProcessDeviceMap | ||||
| 	ProcessSessionInformation | ||||
| 	ProcessForegroundInformation | ||||
| 	ProcessWow64Information | ||||
| 	ProcessImageFileName | ||||
| 	ProcessLUIDDeviceMapsEnabled | ||||
| 	ProcessBreakOnTermination | ||||
| 	ProcessDebugObjectHandle | ||||
| 	ProcessDebugFlags | ||||
| 	ProcessHandleTracing | ||||
| 	ProcessIoPriority | ||||
| 	ProcessExecuteFlags | ||||
| 	ProcessTlsInformation | ||||
| 	ProcessCookie | ||||
| 	ProcessImageInformation | ||||
| 	ProcessCycleTime | ||||
| 	ProcessPagePriority | ||||
| 	ProcessInstrumentationCallback | ||||
| 	ProcessThreadStackAllocation | ||||
| 	ProcessWorkingSetWatchEx | ||||
| 	ProcessImageFileNameWin32 | ||||
| 	ProcessImageFileMapping | ||||
| 	ProcessAffinityUpdateMode | ||||
| 	ProcessMemoryAllocationMode | ||||
| 	ProcessGroupInformation | ||||
| 	ProcessTokenVirtualizationEnabled | ||||
| 	ProcessConsoleHostProcess | ||||
| 	ProcessWindowInformation | ||||
| 	ProcessHandleInformation | ||||
| 	ProcessMitigationPolicy | ||||
| 	ProcessDynamicFunctionTableInformation | ||||
| 	ProcessHandleCheckingMode | ||||
| 	ProcessKeepAliveCount | ||||
| 	ProcessRevokeFileHandles | ||||
| 	ProcessWorkingSetControl | ||||
| 	ProcessHandleTable | ||||
| 	ProcessCheckStackExtentsMode | ||||
| 	ProcessCommandLineInformation | ||||
| 	ProcessProtectionInformation | ||||
| 	ProcessMemoryExhaustion | ||||
| 	ProcessFaultInformation | ||||
| 	ProcessTelemetryIdInformation | ||||
| 	ProcessCommitReleaseInformation | ||||
| 	ProcessDefaultCpuSetsInformation | ||||
| 	ProcessAllowedCpuSetsInformation | ||||
| 	ProcessSubsystemProcess | ||||
| 	ProcessJobMemoryInformation | ||||
| 	ProcessInPrivate | ||||
| 	ProcessRaiseUMExceptionOnInvalidHandleClose | ||||
| 	ProcessIumChallengeResponse | ||||
| 	ProcessChildProcessInformation | ||||
| 	ProcessHighGraphicsPriorityInformation | ||||
| 	ProcessSubsystemInformation | ||||
| 	ProcessEnergyValues | ||||
| 	ProcessActivityThrottleState | ||||
| 	ProcessActivityThrottlePolicy | ||||
| 	ProcessWin32kSyscallFilterInformation | ||||
| 	ProcessDisableSystemAllowedCpuSets | ||||
| 	ProcessWakeInformation | ||||
| 	ProcessEnergyTrackingState | ||||
| 	ProcessManageWritesToExecutableMemory | ||||
| 	ProcessCaptureTrustletLiveDump | ||||
| 	ProcessTelemetryCoverage | ||||
| 	ProcessEnclaveInformation | ||||
| 	ProcessEnableReadWriteVmLogging | ||||
| 	ProcessUptimeInformation | ||||
| 	ProcessImageSection | ||||
| 	ProcessDebugAuthInformation | ||||
| 	ProcessSystemResourceManagement | ||||
| 	ProcessSequenceNumber | ||||
| 	ProcessLoaderDetour | ||||
| 	ProcessSecurityDomainInformation | ||||
| 	ProcessCombineSecurityDomainsInformation | ||||
| 	ProcessEnableLogging | ||||
| 	ProcessLeapSecondInformation | ||||
| 	ProcessFiberShadowStackAllocation | ||||
| 	ProcessFreeFiberShadowStackAllocation | ||||
| 	ProcessAltSystemCallInformation | ||||
| 	ProcessDynamicEHContinuationTargets | ||||
| 	ProcessDynamicEnforcedCetCompatibleRanges | ||||
| ) | ||||
|  | ||||
| type PROCESS_BASIC_INFORMATION struct { | ||||
| 	ExitStatus                   NTStatus | ||||
| 	PebBaseAddress               *PEB | ||||
| 	AffinityMask                 uintptr | ||||
| 	BasePriority                 int32 | ||||
| 	UniqueProcessId              uintptr | ||||
| 	InheritedFromUniqueProcessId uintptr | ||||
| } | ||||
|  | ||||
| // Constants for LocalAlloc flags. | ||||
| const ( | ||||
| 	LMEM_FIXED          = 0x0 | ||||
| 	LMEM_MOVEABLE       = 0x2 | ||||
| 	LMEM_NOCOMPACT      = 0x10 | ||||
| 	LMEM_NODISCARD      = 0x20 | ||||
| 	LMEM_ZEROINIT       = 0x40 | ||||
| 	LMEM_MODIFY         = 0x80 | ||||
| 	LMEM_DISCARDABLE    = 0xf00 | ||||
| 	LMEM_VALID_FLAGS    = 0xf72 | ||||
| 	LMEM_INVALID_HANDLE = 0x8000 | ||||
| 	LHND                = LMEM_MOVEABLE | LMEM_ZEROINIT | ||||
| 	LPTR                = LMEM_FIXED | LMEM_ZEROINIT | ||||
| 	NONZEROLHND         = LMEM_MOVEABLE | ||||
| 	NONZEROLPTR         = LMEM_FIXED | ||||
| ) | ||||
|  | ||||
| // Constants for the CreateNamedPipe-family of functions. | ||||
| const ( | ||||
| 	PIPE_ACCESS_INBOUND  = 0x1 | ||||
| 	PIPE_ACCESS_OUTBOUND = 0x2 | ||||
| 	PIPE_ACCESS_DUPLEX   = 0x3 | ||||
|  | ||||
| 	PIPE_CLIENT_END = 0x0 | ||||
| 	PIPE_SERVER_END = 0x1 | ||||
|  | ||||
| 	PIPE_WAIT                  = 0x0 | ||||
| 	PIPE_NOWAIT                = 0x1 | ||||
| 	PIPE_READMODE_BYTE         = 0x0 | ||||
| 	PIPE_READMODE_MESSAGE      = 0x2 | ||||
| 	PIPE_TYPE_BYTE             = 0x0 | ||||
| 	PIPE_TYPE_MESSAGE          = 0x4 | ||||
| 	PIPE_ACCEPT_REMOTE_CLIENTS = 0x0 | ||||
| 	PIPE_REJECT_REMOTE_CLIENTS = 0x8 | ||||
|  | ||||
| 	PIPE_UNLIMITED_INSTANCES = 255 | ||||
| ) | ||||
|  | ||||
| // Constants for security attributes when opening named pipes. | ||||
| const ( | ||||
| 	SECURITY_ANONYMOUS      = SecurityAnonymous << 16 | ||||
| 	SECURITY_IDENTIFICATION = SecurityIdentification << 16 | ||||
| 	SECURITY_IMPERSONATION  = SecurityImpersonation << 16 | ||||
| 	SECURITY_DELEGATION     = SecurityDelegation << 16 | ||||
|  | ||||
| 	SECURITY_CONTEXT_TRACKING = 0x40000 | ||||
| 	SECURITY_EFFECTIVE_ONLY   = 0x80000 | ||||
|  | ||||
| 	SECURITY_SQOS_PRESENT     = 0x100000 | ||||
| 	SECURITY_VALID_SQOS_FLAGS = 0x1f0000 | ||||
| ) | ||||
|  | ||||
| // ResourceID represents a 16-bit resource identifier, traditionally created with the MAKEINTRESOURCE macro. | ||||
| type ResourceID uint16 | ||||
|  | ||||
| // ResourceIDOrString must be either a ResourceID, to specify a resource or resource type by ID, | ||||
| // or a string, to specify a resource or resource type by name. | ||||
| type ResourceIDOrString interface{} | ||||
|  | ||||
| // Predefined resource names and types. | ||||
| var ( | ||||
| 	// Predefined names. | ||||
| 	CREATEPROCESS_MANIFEST_RESOURCE_ID                 ResourceID = 1 | ||||
| 	ISOLATIONAWARE_MANIFEST_RESOURCE_ID                ResourceID = 2 | ||||
| 	ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID ResourceID = 3 | ||||
| 	ISOLATIONPOLICY_MANIFEST_RESOURCE_ID               ResourceID = 4 | ||||
| 	ISOLATIONPOLICY_BROWSER_MANIFEST_RESOURCE_ID       ResourceID = 5 | ||||
| 	MINIMUM_RESERVED_MANIFEST_RESOURCE_ID              ResourceID = 1  // inclusive | ||||
| 	MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID              ResourceID = 16 // inclusive | ||||
|  | ||||
| 	// Predefined types. | ||||
| 	RT_CURSOR       ResourceID = 1 | ||||
| 	RT_BITMAP       ResourceID = 2 | ||||
| 	RT_ICON         ResourceID = 3 | ||||
| 	RT_MENU         ResourceID = 4 | ||||
| 	RT_DIALOG       ResourceID = 5 | ||||
| 	RT_STRING       ResourceID = 6 | ||||
| 	RT_FONTDIR      ResourceID = 7 | ||||
| 	RT_FONT         ResourceID = 8 | ||||
| 	RT_ACCELERATOR  ResourceID = 9 | ||||
| 	RT_RCDATA       ResourceID = 10 | ||||
| 	RT_MESSAGETABLE ResourceID = 11 | ||||
| 	RT_GROUP_CURSOR ResourceID = 12 | ||||
| 	RT_GROUP_ICON   ResourceID = 14 | ||||
| 	RT_VERSION      ResourceID = 16 | ||||
| 	RT_DLGINCLUDE   ResourceID = 17 | ||||
| 	RT_PLUGPLAY     ResourceID = 19 | ||||
| 	RT_VXD          ResourceID = 20 | ||||
| 	RT_ANICURSOR    ResourceID = 21 | ||||
| 	RT_ANIICON      ResourceID = 22 | ||||
| 	RT_HTML         ResourceID = 23 | ||||
| 	RT_MANIFEST     ResourceID = 24 | ||||
| ) | ||||
|  | ||||
| type COAUTHIDENTITY struct { | ||||
| 	User           *uint16 | ||||
| 	UserLength     uint32 | ||||
| 	Domain         *uint16 | ||||
| 	DomainLength   uint32 | ||||
| 	Password       *uint16 | ||||
| 	PasswordLength uint32 | ||||
| 	Flags          uint32 | ||||
| } | ||||
|  | ||||
| type COAUTHINFO struct { | ||||
| 	AuthnSvc           uint32 | ||||
| 	AuthzSvc           uint32 | ||||
| 	ServerPrincName    *uint16 | ||||
| 	AuthnLevel         uint32 | ||||
| 	ImpersonationLevel uint32 | ||||
| 	AuthIdentityData   *COAUTHIDENTITY | ||||
| 	Capabilities       uint32 | ||||
| } | ||||
|  | ||||
| type COSERVERINFO struct { | ||||
| 	Reserved1 uint32 | ||||
| 	Aame      *uint16 | ||||
| 	AuthInfo  *COAUTHINFO | ||||
| 	Reserved2 uint32 | ||||
| } | ||||
|  | ||||
| type BIND_OPTS3 struct { | ||||
| 	CbStruct          uint32 | ||||
| 	Flags             uint32 | ||||
| 	Mode              uint32 | ||||
| 	TickCountDeadline uint32 | ||||
| 	TrackFlags        uint32 | ||||
| 	ClassContext      uint32 | ||||
| 	Locale            uint32 | ||||
| 	ServerInfo        *COSERVERINFO | ||||
| 	Hwnd              HWND | ||||
| } | ||||
|  | ||||
| const ( | ||||
| 	CLSCTX_INPROC_SERVER          = 0x1 | ||||
| 	CLSCTX_INPROC_HANDLER         = 0x2 | ||||
| 	CLSCTX_LOCAL_SERVER           = 0x4 | ||||
| 	CLSCTX_INPROC_SERVER16        = 0x8 | ||||
| 	CLSCTX_REMOTE_SERVER          = 0x10 | ||||
| 	CLSCTX_INPROC_HANDLER16       = 0x20 | ||||
| 	CLSCTX_RESERVED1              = 0x40 | ||||
| 	CLSCTX_RESERVED2              = 0x80 | ||||
| 	CLSCTX_RESERVED3              = 0x100 | ||||
| 	CLSCTX_RESERVED4              = 0x200 | ||||
| 	CLSCTX_NO_CODE_DOWNLOAD       = 0x400 | ||||
| 	CLSCTX_RESERVED5              = 0x800 | ||||
| 	CLSCTX_NO_CUSTOM_MARSHAL      = 0x1000 | ||||
| 	CLSCTX_ENABLE_CODE_DOWNLOAD   = 0x2000 | ||||
| 	CLSCTX_NO_FAILURE_LOG         = 0x4000 | ||||
| 	CLSCTX_DISABLE_AAA            = 0x8000 | ||||
| 	CLSCTX_ENABLE_AAA             = 0x10000 | ||||
| 	CLSCTX_FROM_DEFAULT_CONTEXT   = 0x20000 | ||||
| 	CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000 | ||||
| 	CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000 | ||||
| 	CLSCTX_ENABLE_CLOAKING        = 0x100000 | ||||
| 	CLSCTX_APPCONTAINER           = 0x400000 | ||||
| 	CLSCTX_ACTIVATE_AAA_AS_IU     = 0x800000 | ||||
| 	CLSCTX_PS_DLL                 = 0x80000000 | ||||
|  | ||||
| 	COINIT_MULTITHREADED     = 0x0 | ||||
| 	COINIT_APARTMENTTHREADED = 0x2 | ||||
| 	COINIT_DISABLE_OLE1DDE   = 0x4 | ||||
| 	COINIT_SPEED_OVER_MEMORY = 0x8 | ||||
| ) | ||||
|  | ||||
| // Flag for QueryFullProcessImageName. | ||||
| const PROCESS_NAME_NATIVE = 1 | ||||
|   | ||||
							
								
								
									
										34
									
								
								vendor/golang.org/x/sys/windows/types_windows_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								vendor/golang.org/x/sys/windows/types_windows_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| // Copyright 2011 The Go Authors. All rights reserved. | ||||
| // Use of this source code is governed by a BSD-style | ||||
| // license that can be found in the LICENSE file. | ||||
|  | ||||
| package windows | ||||
|  | ||||
| type WSAData struct { | ||||
| 	Version      uint16 | ||||
| 	HighVersion  uint16 | ||||
| 	MaxSockets   uint16 | ||||
| 	MaxUdpDg     uint16 | ||||
| 	VendorInfo   *byte | ||||
| 	Description  [WSADESCRIPTION_LEN + 1]byte | ||||
| 	SystemStatus [WSASYS_STATUS_LEN + 1]byte | ||||
| } | ||||
|  | ||||
| type Servent struct { | ||||
| 	Name    *byte | ||||
| 	Aliases **byte | ||||
| 	Proto   *byte | ||||
| 	Port    uint16 | ||||
| } | ||||
|  | ||||
| type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { | ||||
| 	PerProcessUserTimeLimit int64 | ||||
| 	PerJobUserTimeLimit     int64 | ||||
| 	LimitFlags              uint32 | ||||
| 	MinimumWorkingSetSize   uintptr | ||||
| 	MaximumWorkingSetSize   uintptr | ||||
| 	ActiveProcessLimit      uint32 | ||||
| 	Affinity                uintptr | ||||
| 	PriorityClass           uint32 | ||||
| 	SchedulingClass         uint32 | ||||
| } | ||||
							
								
								
									
										2619
									
								
								vendor/golang.org/x/sys/windows/zerrors_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2619
									
								
								vendor/golang.org/x/sys/windows/zerrors_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										337
									
								
								vendor/golang.org/x/sys/windows/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										337
									
								
								vendor/golang.org/x/sys/windows/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -146,6 +146,8 @@ var ( | ||||
| 	procCertDeleteCertificateFromStore                       = modcrypt32.NewProc("CertDeleteCertificateFromStore") | ||||
| 	procCertDuplicateCertificateContext                      = modcrypt32.NewProc("CertDuplicateCertificateContext") | ||||
| 	procCertEnumCertificatesInStore                          = modcrypt32.NewProc("CertEnumCertificatesInStore") | ||||
| 	procCertFindCertificateInStore                           = modcrypt32.NewProc("CertFindCertificateInStore") | ||||
| 	procCertFindChainInStore                                 = modcrypt32.NewProc("CertFindChainInStore") | ||||
| 	procCertFindExtension                                    = modcrypt32.NewProc("CertFindExtension") | ||||
| 	procCertFreeCertificateChain                             = modcrypt32.NewProc("CertFreeCertificateChain") | ||||
| 	procCertFreeCertificateContext                           = modcrypt32.NewProc("CertFreeCertificateContext") | ||||
| @@ -154,6 +156,7 @@ var ( | ||||
| 	procCertOpenStore                                        = modcrypt32.NewProc("CertOpenStore") | ||||
| 	procCertOpenSystemStoreW                                 = modcrypt32.NewProc("CertOpenSystemStoreW") | ||||
| 	procCertVerifyCertificateChainPolicy                     = modcrypt32.NewProc("CertVerifyCertificateChainPolicy") | ||||
| 	procCryptAcquireCertificatePrivateKey                    = modcrypt32.NewProc("CryptAcquireCertificatePrivateKey") | ||||
| 	procCryptDecodeObject                                    = modcrypt32.NewProc("CryptDecodeObject") | ||||
| 	procCryptProtectData                                     = modcrypt32.NewProc("CryptProtectData") | ||||
| 	procCryptQueryObject                                     = modcrypt32.NewProc("CryptQueryObject") | ||||
| @@ -169,6 +172,7 @@ var ( | ||||
| 	procCancelIo                                             = modkernel32.NewProc("CancelIo") | ||||
| 	procCancelIoEx                                           = modkernel32.NewProc("CancelIoEx") | ||||
| 	procCloseHandle                                          = modkernel32.NewProc("CloseHandle") | ||||
| 	procConnectNamedPipe                                     = modkernel32.NewProc("ConnectNamedPipe") | ||||
| 	procCreateDirectoryW                                     = modkernel32.NewProc("CreateDirectoryW") | ||||
| 	procCreateEventExW                                       = modkernel32.NewProc("CreateEventExW") | ||||
| 	procCreateEventW                                         = modkernel32.NewProc("CreateEventW") | ||||
| @@ -179,12 +183,14 @@ var ( | ||||
| 	procCreateJobObjectW                                     = modkernel32.NewProc("CreateJobObjectW") | ||||
| 	procCreateMutexExW                                       = modkernel32.NewProc("CreateMutexExW") | ||||
| 	procCreateMutexW                                         = modkernel32.NewProc("CreateMutexW") | ||||
| 	procCreateNamedPipeW                                     = modkernel32.NewProc("CreateNamedPipeW") | ||||
| 	procCreatePipe                                           = modkernel32.NewProc("CreatePipe") | ||||
| 	procCreateProcessW                                       = modkernel32.NewProc("CreateProcessW") | ||||
| 	procCreateSymbolicLinkW                                  = modkernel32.NewProc("CreateSymbolicLinkW") | ||||
| 	procCreateToolhelp32Snapshot                             = modkernel32.NewProc("CreateToolhelp32Snapshot") | ||||
| 	procDefineDosDeviceW                                     = modkernel32.NewProc("DefineDosDeviceW") | ||||
| 	procDeleteFileW                                          = modkernel32.NewProc("DeleteFileW") | ||||
| 	procDeleteProcThreadAttributeList                        = modkernel32.NewProc("DeleteProcThreadAttributeList") | ||||
| 	procDeleteVolumeMountPointW                              = modkernel32.NewProc("DeleteVolumeMountPointW") | ||||
| 	procDeviceIoControl                                      = modkernel32.NewProc("DeviceIoControl") | ||||
| 	procDuplicateHandle                                      = modkernel32.NewProc("DuplicateHandle") | ||||
| @@ -199,6 +205,7 @@ var ( | ||||
| 	procFindNextFileW                                        = modkernel32.NewProc("FindNextFileW") | ||||
| 	procFindNextVolumeMountPointW                            = modkernel32.NewProc("FindNextVolumeMountPointW") | ||||
| 	procFindNextVolumeW                                      = modkernel32.NewProc("FindNextVolumeW") | ||||
| 	procFindResourceW                                        = modkernel32.NewProc("FindResourceW") | ||||
| 	procFindVolumeClose                                      = modkernel32.NewProc("FindVolumeClose") | ||||
| 	procFindVolumeMountPointClose                            = modkernel32.NewProc("FindVolumeMountPointClose") | ||||
| 	procFlushFileBuffers                                     = modkernel32.NewProc("FlushFileBuffers") | ||||
| @@ -208,6 +215,7 @@ var ( | ||||
| 	procFreeLibrary                                          = modkernel32.NewProc("FreeLibrary") | ||||
| 	procGenerateConsoleCtrlEvent                             = modkernel32.NewProc("GenerateConsoleCtrlEvent") | ||||
| 	procGetACP                                               = modkernel32.NewProc("GetACP") | ||||
| 	procGetCommTimeouts                                      = modkernel32.NewProc("GetCommTimeouts") | ||||
| 	procGetCommandLineW                                      = modkernel32.NewProc("GetCommandLineW") | ||||
| 	procGetComputerNameExW                                   = modkernel32.NewProc("GetComputerNameExW") | ||||
| 	procGetComputerNameW                                     = modkernel32.NewProc("GetComputerNameW") | ||||
| @@ -234,6 +242,8 @@ var ( | ||||
| 	procGetLongPathNameW                                     = modkernel32.NewProc("GetLongPathNameW") | ||||
| 	procGetModuleFileNameW                                   = modkernel32.NewProc("GetModuleFileNameW") | ||||
| 	procGetModuleHandleExW                                   = modkernel32.NewProc("GetModuleHandleExW") | ||||
| 	procGetNamedPipeHandleStateW                             = modkernel32.NewProc("GetNamedPipeHandleStateW") | ||||
| 	procGetNamedPipeInfo                                     = modkernel32.NewProc("GetNamedPipeInfo") | ||||
| 	procGetOverlappedResult                                  = modkernel32.NewProc("GetOverlappedResult") | ||||
| 	procGetPriorityClass                                     = modkernel32.NewProc("GetPriorityClass") | ||||
| 	procGetProcAddress                                       = modkernel32.NewProc("GetProcAddress") | ||||
| @@ -263,12 +273,16 @@ var ( | ||||
| 	procGetVolumePathNameW                                   = modkernel32.NewProc("GetVolumePathNameW") | ||||
| 	procGetVolumePathNamesForVolumeNameW                     = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW") | ||||
| 	procGetWindowsDirectoryW                                 = modkernel32.NewProc("GetWindowsDirectoryW") | ||||
| 	procInitializeProcThreadAttributeList                    = modkernel32.NewProc("InitializeProcThreadAttributeList") | ||||
| 	procIsWow64Process                                       = modkernel32.NewProc("IsWow64Process") | ||||
| 	procIsWow64Process2                                      = modkernel32.NewProc("IsWow64Process2") | ||||
| 	procLoadLibraryExW                                       = modkernel32.NewProc("LoadLibraryExW") | ||||
| 	procLoadLibraryW                                         = modkernel32.NewProc("LoadLibraryW") | ||||
| 	procLoadResource                                         = modkernel32.NewProc("LoadResource") | ||||
| 	procLocalAlloc                                           = modkernel32.NewProc("LocalAlloc") | ||||
| 	procLocalFree                                            = modkernel32.NewProc("LocalFree") | ||||
| 	procLockFileEx                                           = modkernel32.NewProc("LockFileEx") | ||||
| 	procLockResource                                         = modkernel32.NewProc("LockResource") | ||||
| 	procMapViewOfFile                                        = modkernel32.NewProc("MapViewOfFile") | ||||
| 	procMoveFileExW                                          = modkernel32.NewProc("MoveFileExW") | ||||
| 	procMoveFileW                                            = modkernel32.NewProc("MoveFileW") | ||||
| @@ -283,6 +297,7 @@ var ( | ||||
| 	procProcessIdToSessionId                                 = modkernel32.NewProc("ProcessIdToSessionId") | ||||
| 	procPulseEvent                                           = modkernel32.NewProc("PulseEvent") | ||||
| 	procQueryDosDeviceW                                      = modkernel32.NewProc("QueryDosDeviceW") | ||||
| 	procQueryFullProcessImageNameW                           = modkernel32.NewProc("QueryFullProcessImageNameW") | ||||
| 	procQueryInformationJobObject                            = modkernel32.NewProc("QueryInformationJobObject") | ||||
| 	procReadConsoleW                                         = modkernel32.NewProc("ReadConsoleW") | ||||
| 	procReadDirectoryChangesW                                = modkernel32.NewProc("ReadDirectoryChangesW") | ||||
| @@ -291,6 +306,7 @@ var ( | ||||
| 	procRemoveDirectoryW                                     = modkernel32.NewProc("RemoveDirectoryW") | ||||
| 	procResetEvent                                           = modkernel32.NewProc("ResetEvent") | ||||
| 	procResumeThread                                         = modkernel32.NewProc("ResumeThread") | ||||
| 	procSetCommTimeouts                                      = modkernel32.NewProc("SetCommTimeouts") | ||||
| 	procSetConsoleCursorPosition                             = modkernel32.NewProc("SetConsoleCursorPosition") | ||||
| 	procSetConsoleMode                                       = modkernel32.NewProc("SetConsoleMode") | ||||
| 	procSetCurrentDirectoryW                                 = modkernel32.NewProc("SetCurrentDirectoryW") | ||||
| @@ -307,6 +323,7 @@ var ( | ||||
| 	procSetFileTime                                          = modkernel32.NewProc("SetFileTime") | ||||
| 	procSetHandleInformation                                 = modkernel32.NewProc("SetHandleInformation") | ||||
| 	procSetInformationJobObject                              = modkernel32.NewProc("SetInformationJobObject") | ||||
| 	procSetNamedPipeHandleState                              = modkernel32.NewProc("SetNamedPipeHandleState") | ||||
| 	procSetPriorityClass                                     = modkernel32.NewProc("SetPriorityClass") | ||||
| 	procSetProcessPriorityBoost                              = modkernel32.NewProc("SetProcessPriorityBoost") | ||||
| 	procSetProcessShutdownParameters                         = modkernel32.NewProc("SetProcessShutdownParameters") | ||||
| @@ -314,6 +331,7 @@ var ( | ||||
| 	procSetStdHandle                                         = modkernel32.NewProc("SetStdHandle") | ||||
| 	procSetVolumeLabelW                                      = modkernel32.NewProc("SetVolumeLabelW") | ||||
| 	procSetVolumeMountPointW                                 = modkernel32.NewProc("SetVolumeMountPointW") | ||||
| 	procSizeofResource                                       = modkernel32.NewProc("SizeofResource") | ||||
| 	procSleepEx                                              = modkernel32.NewProc("SleepEx") | ||||
| 	procTerminateJobObject                                   = modkernel32.NewProc("TerminateJobObject") | ||||
| 	procTerminateProcess                                     = modkernel32.NewProc("TerminateProcess") | ||||
| @@ -321,6 +339,7 @@ var ( | ||||
| 	procThread32Next                                         = modkernel32.NewProc("Thread32Next") | ||||
| 	procUnlockFileEx                                         = modkernel32.NewProc("UnlockFileEx") | ||||
| 	procUnmapViewOfFile                                      = modkernel32.NewProc("UnmapViewOfFile") | ||||
| 	procUpdateProcThreadAttribute                            = modkernel32.NewProc("UpdateProcThreadAttribute") | ||||
| 	procVirtualAlloc                                         = modkernel32.NewProc("VirtualAlloc") | ||||
| 	procVirtualFree                                          = modkernel32.NewProc("VirtualFree") | ||||
| 	procVirtualLock                                          = modkernel32.NewProc("VirtualLock") | ||||
| @@ -336,11 +355,25 @@ var ( | ||||
| 	procNetApiBufferFree                                     = modnetapi32.NewProc("NetApiBufferFree") | ||||
| 	procNetGetJoinInformation                                = modnetapi32.NewProc("NetGetJoinInformation") | ||||
| 	procNetUserGetInfo                                       = modnetapi32.NewProc("NetUserGetInfo") | ||||
| 	procNtCreateFile                                         = modntdll.NewProc("NtCreateFile") | ||||
| 	procNtCreateNamedPipeFile                                = modntdll.NewProc("NtCreateNamedPipeFile") | ||||
| 	procNtQueryInformationProcess                            = modntdll.NewProc("NtQueryInformationProcess") | ||||
| 	procNtSetInformationProcess                              = modntdll.NewProc("NtSetInformationProcess") | ||||
| 	procRtlDefaultNpAcl                                      = modntdll.NewProc("RtlDefaultNpAcl") | ||||
| 	procRtlDosPathNameToNtPathName_U_WithStatus              = modntdll.NewProc("RtlDosPathNameToNtPathName_U_WithStatus") | ||||
| 	procRtlDosPathNameToRelativeNtPathName_U_WithStatus      = modntdll.NewProc("RtlDosPathNameToRelativeNtPathName_U_WithStatus") | ||||
| 	procRtlGetCurrentPeb                                     = modntdll.NewProc("RtlGetCurrentPeb") | ||||
| 	procRtlGetNtVersionNumbers                               = modntdll.NewProc("RtlGetNtVersionNumbers") | ||||
| 	procRtlGetVersion                                        = modntdll.NewProc("RtlGetVersion") | ||||
| 	procRtlInitString                                        = modntdll.NewProc("RtlInitString") | ||||
| 	procRtlInitUnicodeString                                 = modntdll.NewProc("RtlInitUnicodeString") | ||||
| 	procRtlNtStatusToDosErrorNoTeb                           = modntdll.NewProc("RtlNtStatusToDosErrorNoTeb") | ||||
| 	procCLSIDFromString                                      = modole32.NewProc("CLSIDFromString") | ||||
| 	procCoCreateGuid                                         = modole32.NewProc("CoCreateGuid") | ||||
| 	procCoGetObject                                          = modole32.NewProc("CoGetObject") | ||||
| 	procCoInitializeEx                                       = modole32.NewProc("CoInitializeEx") | ||||
| 	procCoTaskMemFree                                        = modole32.NewProc("CoTaskMemFree") | ||||
| 	procCoUninitialize                                       = modole32.NewProc("CoUninitialize") | ||||
| 	procStringFromGUID2                                      = modole32.NewProc("StringFromGUID2") | ||||
| 	procEnumProcesses                                        = modpsapi.NewProc("EnumProcesses") | ||||
| 	procSubscribeServiceChangeNotifications                  = modsechost.NewProc("SubscribeServiceChangeNotifications") | ||||
| @@ -362,11 +395,13 @@ var ( | ||||
| 	procGetAddrInfoW                                         = modws2_32.NewProc("GetAddrInfoW") | ||||
| 	procWSACleanup                                           = modws2_32.NewProc("WSACleanup") | ||||
| 	procWSAEnumProtocolsW                                    = modws2_32.NewProc("WSAEnumProtocolsW") | ||||
| 	procWSAGetOverlappedResult                               = modws2_32.NewProc("WSAGetOverlappedResult") | ||||
| 	procWSAIoctl                                             = modws2_32.NewProc("WSAIoctl") | ||||
| 	procWSARecv                                              = modws2_32.NewProc("WSARecv") | ||||
| 	procWSARecvFrom                                          = modws2_32.NewProc("WSARecvFrom") | ||||
| 	procWSASend                                              = modws2_32.NewProc("WSASend") | ||||
| 	procWSASendTo                                            = modws2_32.NewProc("WSASendTo") | ||||
| 	procWSASocketW                                           = modws2_32.NewProc("WSASocketW") | ||||
| 	procWSAStartup                                           = modws2_32.NewProc("WSAStartup") | ||||
| 	procbind                                                 = modws2_32.NewProc("bind") | ||||
| 	procclosesocket                                          = modws2_32.NewProc("closesocket") | ||||
| @@ -1210,6 +1245,24 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procCertFindCertificateInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) | ||||
| 	cert = (*CertContext)(unsafe.Pointer(r0)) | ||||
| 	if cert == nil { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procCertFindChainInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) | ||||
| 	certchain = (*CertChainContext)(unsafe.Pointer(r0)) | ||||
| 	if certchain == nil { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) { | ||||
| 	r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) | ||||
| 	ret = (*CertExtension)(unsafe.Pointer(r0)) | ||||
| @@ -1269,6 +1322,19 @@ func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) { | ||||
| 	var _p0 uint32 | ||||
| 	if *callerFreeProvOrNCryptKey { | ||||
| 		_p0 = 1 | ||||
| 	} | ||||
| 	r1, _, e1 := syscall.Syscall6(procCryptAcquireCertificatePrivateKey.Addr(), 6, uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) | ||||
| 	*callerFreeProvOrNCryptKey = _p0 != 0 | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -1394,6 +1460,14 @@ func CloseHandle(handle Handle) (err error) { | ||||
| 	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 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -1405,7 +1479,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { | ||||
| func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == 0 { | ||||
| 	if handle == 0 || e1 == ERROR_ALREADY_EXISTS { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| @@ -1414,7 +1488,7 @@ func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, d | ||||
| func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == 0 { | ||||
| 	if handle == 0 || e1 == ERROR_ALREADY_EXISTS { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| @@ -1423,7 +1497,7 @@ func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialStat | ||||
| func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == 0 { | ||||
| 	if handle == 0 || e1 == ERROR_ALREADY_EXISTS { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| @@ -1446,7 +1520,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) { | ||||
| func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == 0 { | ||||
| @@ -1467,7 +1541,7 @@ func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, | ||||
| func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == 0 { | ||||
| 	if handle == 0 || e1 == ERROR_ALREADY_EXISTS { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| @@ -1480,7 +1554,16 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 | ||||
| 	} | ||||
| 	r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == 0 { | ||||
| 	if handle == 0 || e1 == ERROR_ALREADY_EXISTS { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == InvalidHandle { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| @@ -1539,6 +1622,11 @@ func DeleteFile(path *uint16) (err error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) { | ||||
| 	syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -1669,6 +1757,15 @@ func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procFindResourceW.Addr(), 3, uintptr(module), uintptr(name), uintptr(resType)) | ||||
| 	resInfo = Handle(r0) | ||||
| 	if resInfo == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func FindVolumeClose(findVolume Handle) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -1744,6 +1841,14 @@ func GetACP() (acp uint32) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetCommandLine() (cmd *uint16) { | ||||
| 	r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) | ||||
| 	cmd = (*uint16)(unsafe.Pointer(r0)) | ||||
| @@ -1955,6 +2060,22 @@ func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err er | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) { | ||||
| 	var _p0 uint32 | ||||
| 	if wait { | ||||
| @@ -2032,7 +2153,7 @@ func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintpt | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) { | ||||
| func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| @@ -2200,6 +2321,14 @@ func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func IsWow64Process(handle Handle, isWow64 *bool) (err error) { | ||||
| 	var _p0 uint32 | ||||
| 	if *isWow64 { | ||||
| @@ -2261,6 +2390,24 @@ func _LoadLibrary(libname *uint16) (handle Handle, err error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procLoadResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) | ||||
| 	resData = Handle(r0) | ||||
| 	if resData == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0) | ||||
| 	ptr = uintptr(r0) | ||||
| 	if ptr == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func LocalFree(hmem Handle) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) | ||||
| 	handle = Handle(r0) | ||||
| @@ -2278,6 +2425,15 @@ func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, byt | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func LockResource(resData Handle) (addr uintptr, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procLockResource.Addr(), 1, uintptr(resData), 0, 0) | ||||
| 	addr = uintptr(r0) | ||||
| 	if addr == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) | ||||
| 	addr = uintptr(r0) | ||||
| @@ -2364,7 +2520,7 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) { | ||||
| func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| @@ -2413,6 +2569,14 @@ func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint3 | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -2486,6 +2650,14 @@ func ResumeThread(thread Handle) (ret uint32, err error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func setConsoleCursorPosition(console Handle, position uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -2623,6 +2795,14 @@ func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobOb | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall6(procSetNamedPipeHandleState.Addr(), 4, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func SetPriorityClass(process Handle, priorityClass uint32) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) | ||||
| 	if r1 == 0 { | ||||
| @@ -2683,6 +2863,15 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) | ||||
| 	size = uint32(r0) | ||||
| 	if size == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { | ||||
| 	var _p0 uint32 | ||||
| 	if alertable { | ||||
| @@ -2741,6 +2930,14 @@ func UnmapViewOfFile(addr uintptr) (err error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) | ||||
| 	value = uintptr(r0) | ||||
| @@ -2869,19 +3066,97 @@ func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **by | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0) | ||||
| 	if r0 != 0 { | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0) | ||||
| 	if r0 != 0 { | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0) | ||||
| 	if r0 != 0 { | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0) | ||||
| 	if r0 != 0 { | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(acl)), 0, 0) | ||||
| 	if r0 != 0 { | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) | ||||
| 	if r0 != 0 { | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall6(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) | ||||
| 	if r0 != 0 { | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func RtlGetCurrentPeb() (peb *PEB) { | ||||
| 	r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0) | ||||
| 	peb = (*PEB)(unsafe.Pointer(r0)) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) { | ||||
| 	syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func rtlGetVersion(info *OsVersionInfoEx) (ret error) { | ||||
| func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { | ||||
| 	r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) | ||||
| 	if r0 != 0 { | ||||
| 		ret = syscall.Errno(r0) | ||||
| 		ntstatus = NTStatus(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func RtlInitString(destinationString *NTString, sourceString *byte) { | ||||
| 	syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) { | ||||
| 	syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) { | ||||
| 	r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0) | ||||
| 	ret = syscall.Errno(r0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { | ||||
| 	r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) | ||||
| 	if r0 != 0 { | ||||
| @@ -2898,11 +3173,32 @@ func coCreateGuid(pguid *GUID) (ret error) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) { | ||||
| 	r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0) | ||||
| 	if r0 != 0 { | ||||
| 		ret = syscall.Errno(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { | ||||
| 	r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0) | ||||
| 	if r0 != 0 { | ||||
| 		ret = syscall.Errno(r0) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CoTaskMemFree(address unsafe.Pointer) { | ||||
| 	syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func CoUninitialize() { | ||||
| 	syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { | ||||
| 	r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) | ||||
| 	chars = int32(r0) | ||||
| @@ -3081,6 +3377,18 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) { | ||||
| 	var _p0 uint32 | ||||
| 	if wait { | ||||
| 		_p0 = 1 | ||||
| 	} | ||||
| 	r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) | ||||
| 	if r1 == 0 { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { | ||||
| 	r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) | ||||
| 	if r1 == socket_error { | ||||
| @@ -3121,6 +3429,15 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) { | ||||
| 	r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) | ||||
| 	handle = Handle(r0) | ||||
| 	if handle == InvalidHandle { | ||||
| 		err = errnoErr(e1) | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { | ||||
| 	r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) | ||||
| 	if r0 != 0 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alex Couture-Beil
					Alex Couture-Beil