mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
go.mod: golang.org/x/crypto v0.1.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
130
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
130
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
@ -138,13 +138,7 @@ func UTF16PtrToString(p *uint16) string {
|
||||
ptr = unsafe.Pointer(uintptr(ptr) + unsafe.Sizeof(*p))
|
||||
}
|
||||
|
||||
var s []uint16
|
||||
h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
|
||||
h.Data = unsafe.Pointer(p)
|
||||
h.Len = n
|
||||
h.Cap = n
|
||||
|
||||
return string(utf16.Decode(s))
|
||||
return string(utf16.Decode(unsafe.Slice(p, n)))
|
||||
}
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
@ -364,6 +358,15 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
|
||||
//sys GetActiveProcessorCount(groupNumber uint16) (ret uint32)
|
||||
//sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32)
|
||||
//sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows
|
||||
//sys EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) = user32.EnumChildWindows
|
||||
//sys GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) = user32.GetClassNameW
|
||||
//sys GetDesktopWindow() (hwnd HWND) = user32.GetDesktopWindow
|
||||
//sys GetForegroundWindow() (hwnd HWND) = user32.GetForegroundWindow
|
||||
//sys IsWindow(hwnd HWND) (isWindow bool) = user32.IsWindow
|
||||
//sys IsWindowUnicode(hwnd HWND) (isUnicode bool) = user32.IsWindowUnicode
|
||||
//sys IsWindowVisible(hwnd HWND) (isVisible bool) = user32.IsWindowVisible
|
||||
//sys GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) = user32.GetGUIThreadInfo
|
||||
|
||||
// Volume Management Functions
|
||||
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
|
||||
@ -417,6 +420,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation
|
||||
//sys GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW
|
||||
//sys GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW
|
||||
//sys QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) = psapi.QueryWorkingSetEx
|
||||
|
||||
// NT Native APIs
|
||||
//sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb
|
||||
@ -438,6 +442,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) = ntdll.RtlAddFunctionTable
|
||||
//sys RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) = ntdll.RtlDeleteFunctionTable
|
||||
|
||||
// Desktop Window Manager API (Dwmapi)
|
||||
//sys DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmGetWindowAttribute
|
||||
//sys DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmSetWindowAttribute
|
||||
|
||||
// syscall interface implementation for other packages
|
||||
|
||||
// GetCurrentProcess returns the handle for the current process.
|
||||
@ -747,7 +755,7 @@ func Utimes(path string, tv []Timeval) (err error) {
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
defer Close(h)
|
||||
defer CloseHandle(h)
|
||||
a := NsecToFiletime(tv[0].Nanoseconds())
|
||||
w := NsecToFiletime(tv[1].Nanoseconds())
|
||||
return SetFileTime(h, nil, &a, &w)
|
||||
@ -767,7 +775,7 @@ func UtimesNano(path string, ts []Timespec) (err error) {
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
defer Close(h)
|
||||
defer CloseHandle(h)
|
||||
a := NsecToFiletime(TimespecToNsec(ts[0]))
|
||||
w := NsecToFiletime(TimespecToNsec(ts[1]))
|
||||
return SetFileTime(h, nil, &a, &w)
|
||||
@ -971,6 +979,32 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) {
|
||||
return unsafe.Pointer(&sa.raw), sl, nil
|
||||
}
|
||||
|
||||
type RawSockaddrBth struct {
|
||||
AddressFamily [2]byte
|
||||
BtAddr [8]byte
|
||||
ServiceClassId [16]byte
|
||||
Port [4]byte
|
||||
}
|
||||
|
||||
type SockaddrBth struct {
|
||||
BtAddr uint64
|
||||
ServiceClassId GUID
|
||||
Port uint32
|
||||
|
||||
raw RawSockaddrBth
|
||||
}
|
||||
|
||||
func (sa *SockaddrBth) sockaddr() (unsafe.Pointer, int32, error) {
|
||||
family := AF_BTH
|
||||
sa.raw = RawSockaddrBth{
|
||||
AddressFamily: *(*[2]byte)(unsafe.Pointer(&family)),
|
||||
BtAddr: *(*[8]byte)(unsafe.Pointer(&sa.BtAddr)),
|
||||
Port: *(*[4]byte)(unsafe.Pointer(&sa.Port)),
|
||||
ServiceClassId: *(*[16]byte)(unsafe.Pointer(&sa.ServiceClassId)),
|
||||
}
|
||||
return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil
|
||||
}
|
||||
|
||||
func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_UNIX:
|
||||
@ -1081,9 +1115,13 @@ func Shutdown(fd Handle, how int) (err error) {
|
||||
}
|
||||
|
||||
func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (err error) {
|
||||
rsa, l, err := to.sockaddr()
|
||||
if err != nil {
|
||||
return err
|
||||
var rsa unsafe.Pointer
|
||||
var l int32
|
||||
if to != nil {
|
||||
rsa, l, err = to.sockaddr()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return WSASendTo(s, bufs, bufcnt, sent, flags, (*RawSockaddrAny)(unsafe.Pointer(rsa)), l, overlapped, croutine)
|
||||
}
|
||||
@ -1707,3 +1745,71 @@ func LoadResourceData(module, resInfo Handle) (data []byte, err error) {
|
||||
h.Cap = int(size)
|
||||
return
|
||||
}
|
||||
|
||||
// PSAPI_WORKING_SET_EX_BLOCK contains extended working set information for a page.
|
||||
type PSAPI_WORKING_SET_EX_BLOCK uint64
|
||||
|
||||
// Valid returns the validity of this page.
|
||||
// If this bit is 1, the subsequent members are valid; otherwise they should be ignored.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Valid() bool {
|
||||
return (b & 1) == 1
|
||||
}
|
||||
|
||||
// ShareCount is the number of processes that share this page. The maximum value of this member is 7.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) ShareCount() uint64 {
|
||||
return b.intField(1, 3)
|
||||
}
|
||||
|
||||
// Win32Protection is the memory protection attributes of the page. For a list of values, see
|
||||
// https://docs.microsoft.com/en-us/windows/win32/memory/memory-protection-constants
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Win32Protection() uint64 {
|
||||
return b.intField(4, 11)
|
||||
}
|
||||
|
||||
// Shared returns the shared status of this page.
|
||||
// If this bit is 1, the page can be shared.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Shared() bool {
|
||||
return (b & (1 << 15)) == 1
|
||||
}
|
||||
|
||||
// Node is the NUMA node. The maximum value of this member is 63.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Node() uint64 {
|
||||
return b.intField(16, 6)
|
||||
}
|
||||
|
||||
// Locked returns the locked status of this page.
|
||||
// If this bit is 1, the virtual page is locked in physical memory.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Locked() bool {
|
||||
return (b & (1 << 22)) == 1
|
||||
}
|
||||
|
||||
// LargePage returns the large page status of this page.
|
||||
// If this bit is 1, the page is a large page.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) LargePage() bool {
|
||||
return (b & (1 << 23)) == 1
|
||||
}
|
||||
|
||||
// Bad returns the bad status of this page.
|
||||
// If this bit is 1, the page is has been reported as bad.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Bad() bool {
|
||||
return (b & (1 << 31)) == 1
|
||||
}
|
||||
|
||||
// intField extracts an integer field in the PSAPI_WORKING_SET_EX_BLOCK union.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) intField(start, length int) uint64 {
|
||||
var mask PSAPI_WORKING_SET_EX_BLOCK
|
||||
for pos := start; pos < start+length; pos++ {
|
||||
mask |= (1 << pos)
|
||||
}
|
||||
|
||||
masked := b & mask
|
||||
return uint64(masked >> start)
|
||||
}
|
||||
|
||||
// PSAPI_WORKING_SET_EX_INFORMATION contains extended working set information for a process.
|
||||
type PSAPI_WORKING_SET_EX_INFORMATION struct {
|
||||
// The virtual address.
|
||||
VirtualAddress Pointer
|
||||
// A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress.
|
||||
VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK
|
||||
}
|
||||
|
Reference in New Issue
Block a user