Ignore:
Timestamp:
Sep 13, 2023, 10:49:50 AM (21 months ago)
Author:
Izuru Yakumo
Message:

Ready to release 0.6.0

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

Location:
trunk/vendor/golang.org/x/sys/windows
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/vendor/golang.org/x/sys/windows/setupapi_windows.go

    r67 r69  
    297297        DI_INF_IS_SORTED DI_FLAGS = 0x00008000
    298298
    299         // Flag to indicate that only the the INF specified by SP_DEVINSTALL_PARAMS.DriverPath should be searched.
     299        // Flag to indicate that only the INF specified by SP_DEVINSTALL_PARAMS.DriverPath should be searched.
    300300        DI_ENUMSINGLEINF DI_FLAGS = 0x00010000
    301301
  • trunk/vendor/golang.org/x/sys/windows/syscall.go

    r67 r69  
    3131        "syscall"
    3232        "unsafe"
    33 
    34         "golang.org/x/sys/internal/unsafeheader"
    3533)
    3634
     
    8482        }
    8583
    86         var s []byte
    87         h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
    88         h.Data = unsafe.Pointer(p)
    89         h.Len = n
    90         h.Cap = n
    91 
    92         return string(s)
     84        return string(unsafe.Slice(p, n))
    9385}
    9486
  • trunk/vendor/golang.org/x/sys/windows/syscall_windows.go

    r67 r69  
    139139        }
    140140
    141         var s []uint16
    142         h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
    143         h.Data = unsafe.Pointer(p)
    144         h.Len = n
    145         h.Cap = n
    146 
    147         return string(utf16.Decode(s))
     141        return string(utf16.Decode(unsafe.Slice(p, n)))
    148142}
    149143
     
    365359//sys   GetActiveProcessorCount(groupNumber uint16) (ret uint32)
    366360//sys   GetMaximumProcessorCount(groupNumber uint16) (ret uint32)
     361//sys   EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows
     362//sys   EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) = user32.EnumChildWindows
     363//sys   GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) = user32.GetClassNameW
     364//sys   GetDesktopWindow() (hwnd HWND) = user32.GetDesktopWindow
     365//sys   GetForegroundWindow() (hwnd HWND) = user32.GetForegroundWindow
     366//sys   IsWindow(hwnd HWND) (isWindow bool) = user32.IsWindow
     367//sys   IsWindowUnicode(hwnd HWND) (isUnicode bool) = user32.IsWindowUnicode
     368//sys   IsWindowVisible(hwnd HWND) (isVisible bool) = user32.IsWindowVisible
     369//sys   GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) = user32.GetGUIThreadInfo
    367370
    368371// Volume Management Functions
     
    418421//sys   GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW
    419422//sys   GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW
     423//sys   QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) = psapi.QueryWorkingSetEx
    420424
    421425// NT Native APIs
     
    439443//sys   RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) = ntdll.RtlDeleteFunctionTable
    440444
     445// Desktop Window Manager API (Dwmapi)
     446//sys   DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmGetWindowAttribute
     447//sys   DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmSetWindowAttribute
     448
    441449// syscall interface implementation for other packages
    442450
     
    748756                return e
    749757        }
    750         defer Close(h)
     758        defer CloseHandle(h)
    751759        a := NsecToFiletime(tv[0].Nanoseconds())
    752760        w := NsecToFiletime(tv[1].Nanoseconds())
     
    768776                return e
    769777        }
    770         defer Close(h)
     778        defer CloseHandle(h)
    771779        a := NsecToFiletime(TimespecToNsec(ts[0]))
    772780        w := NsecToFiletime(TimespecToNsec(ts[1]))
     
    972980}
    973981
     982type RawSockaddrBth struct {
     983        AddressFamily  [2]byte
     984        BtAddr         [8]byte
     985        ServiceClassId [16]byte
     986        Port           [4]byte
     987}
     988
     989type SockaddrBth struct {
     990        BtAddr         uint64
     991        ServiceClassId GUID
     992        Port           uint32
     993
     994        raw RawSockaddrBth
     995}
     996
     997func (sa *SockaddrBth) sockaddr() (unsafe.Pointer, int32, error) {
     998        family := AF_BTH
     999        sa.raw = RawSockaddrBth{
     1000                AddressFamily:  *(*[2]byte)(unsafe.Pointer(&family)),
     1001                BtAddr:         *(*[8]byte)(unsafe.Pointer(&sa.BtAddr)),
     1002                Port:           *(*[4]byte)(unsafe.Pointer(&sa.Port)),
     1003                ServiceClassId: *(*[16]byte)(unsafe.Pointer(&sa.ServiceClassId)),
     1004        }
     1005        return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil
     1006}
     1007
    9741008func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
    9751009        switch rsa.Addr.Family {
     
    10821116
    10831117func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (err error) {
    1084         rsa, l, err := to.sockaddr()
    1085         if err != nil {
    1086                 return err
     1118        var rsa unsafe.Pointer
     1119        var l int32
     1120        if to != nil {
     1121                rsa, l, err = to.sockaddr()
     1122                if err != nil {
     1123                        return err
     1124                }
    10871125        }
    10881126        return WSASendTo(s, bufs, bufcnt, sent, flags, (*RawSockaddrAny)(unsafe.Pointer(rsa)), l, overlapped, croutine)
     
    17081746        return
    17091747}
     1748
     1749// PSAPI_WORKING_SET_EX_BLOCK contains extended working set information for a page.
     1750type PSAPI_WORKING_SET_EX_BLOCK uint64
     1751
     1752// Valid returns the validity of this page.
     1753// If this bit is 1, the subsequent members are valid; otherwise they should be ignored.
     1754func (b PSAPI_WORKING_SET_EX_BLOCK) Valid() bool {
     1755        return (b & 1) == 1
     1756}
     1757
     1758// ShareCount is the number of processes that share this page. The maximum value of this member is 7.
     1759func (b PSAPI_WORKING_SET_EX_BLOCK) ShareCount() uint64 {
     1760        return b.intField(1, 3)
     1761}
     1762
     1763// Win32Protection is the memory protection attributes of the page. For a list of values, see
     1764// https://docs.microsoft.com/en-us/windows/win32/memory/memory-protection-constants
     1765func (b PSAPI_WORKING_SET_EX_BLOCK) Win32Protection() uint64 {
     1766        return b.intField(4, 11)
     1767}
     1768
     1769// Shared returns the shared status of this page.
     1770// If this bit is 1, the page can be shared.
     1771func (b PSAPI_WORKING_SET_EX_BLOCK) Shared() bool {
     1772        return (b & (1 << 15)) == 1
     1773}
     1774
     1775// Node is the NUMA node. The maximum value of this member is 63.
     1776func (b PSAPI_WORKING_SET_EX_BLOCK) Node() uint64 {
     1777        return b.intField(16, 6)
     1778}
     1779
     1780// Locked returns the locked status of this page.
     1781// If this bit is 1, the virtual page is locked in physical memory.
     1782func (b PSAPI_WORKING_SET_EX_BLOCK) Locked() bool {
     1783        return (b & (1 << 22)) == 1
     1784}
     1785
     1786// LargePage returns the large page status of this page.
     1787// If this bit is 1, the page is a large page.
     1788func (b PSAPI_WORKING_SET_EX_BLOCK) LargePage() bool {
     1789        return (b & (1 << 23)) == 1
     1790}
     1791
     1792// Bad returns the bad status of this page.
     1793// If this bit is 1, the page is has been reported as bad.
     1794func (b PSAPI_WORKING_SET_EX_BLOCK) Bad() bool {
     1795        return (b & (1 << 31)) == 1
     1796}
     1797
     1798// intField extracts an integer field in the PSAPI_WORKING_SET_EX_BLOCK union.
     1799func (b PSAPI_WORKING_SET_EX_BLOCK) intField(start, length int) uint64 {
     1800        var mask PSAPI_WORKING_SET_EX_BLOCK
     1801        for pos := start; pos < start+length; pos++ {
     1802                mask |= (1 << pos)
     1803        }
     1804
     1805        masked := b & mask
     1806        return uint64(masked >> start)
     1807}
     1808
     1809// PSAPI_WORKING_SET_EX_INFORMATION contains extended working set information for a process.
     1810type PSAPI_WORKING_SET_EX_INFORMATION struct {
     1811        // The virtual address.
     1812        VirtualAddress Pointer
     1813        // A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress.
     1814        VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK
     1815}
  • trunk/vendor/golang.org/x/sys/windows/types_windows.go

    r67 r69  
    32143214
    32153215const ALL_PROCESSOR_GROUPS = 0xFFFF
     3216
     3217type Rect struct {
     3218        Left   int32
     3219        Top    int32
     3220        Right  int32
     3221        Bottom int32
     3222}
     3223
     3224type GUIThreadInfo struct {
     3225        Size        uint32
     3226        Flags       uint32
     3227        Active      HWND
     3228        Focus       HWND
     3229        Capture     HWND
     3230        MenuOwner   HWND
     3231        MoveSize    HWND
     3232        CaretHandle HWND
     3233        CaretRect   Rect
     3234}
     3235
     3236const (
     3237        DWMWA_NCRENDERING_ENABLED            = 1
     3238        DWMWA_NCRENDERING_POLICY             = 2
     3239        DWMWA_TRANSITIONS_FORCEDISABLED      = 3
     3240        DWMWA_ALLOW_NCPAINT                  = 4
     3241        DWMWA_CAPTION_BUTTON_BOUNDS          = 5
     3242        DWMWA_NONCLIENT_RTL_LAYOUT           = 6
     3243        DWMWA_FORCE_ICONIC_REPRESENTATION    = 7
     3244        DWMWA_FLIP3D_POLICY                  = 8
     3245        DWMWA_EXTENDED_FRAME_BOUNDS          = 9
     3246        DWMWA_HAS_ICONIC_BITMAP              = 10
     3247        DWMWA_DISALLOW_PEEK                  = 11
     3248        DWMWA_EXCLUDED_FROM_PEEK             = 12
     3249        DWMWA_CLOAK                          = 13
     3250        DWMWA_CLOAKED                        = 14
     3251        DWMWA_FREEZE_REPRESENTATION          = 15
     3252        DWMWA_PASSIVE_UPDATE_MODE            = 16
     3253        DWMWA_USE_HOSTBACKDROPBRUSH          = 17
     3254        DWMWA_USE_IMMERSIVE_DARK_MODE        = 20
     3255        DWMWA_WINDOW_CORNER_PREFERENCE       = 33
     3256        DWMWA_BORDER_COLOR                   = 34
     3257        DWMWA_CAPTION_COLOR                  = 35
     3258        DWMWA_TEXT_COLOR                     = 36
     3259        DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37
     3260)
  • trunk/vendor/golang.org/x/sys/windows/zsyscall_windows.go

    r67 r69  
    4141        modcrypt32  = NewLazySystemDLL("crypt32.dll")
    4242        moddnsapi   = NewLazySystemDLL("dnsapi.dll")
     43        moddwmapi   = NewLazySystemDLL("dwmapi.dll")
    4344        modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
    4445        modkernel32 = NewLazySystemDLL("kernel32.dll")
     
    176177        procDnsQuery_W                                           = moddnsapi.NewProc("DnsQuery_W")
    177178        procDnsRecordListFree                                    = moddnsapi.NewProc("DnsRecordListFree")
     179        procDwmGetWindowAttribute                                = moddwmapi.NewProc("DwmGetWindowAttribute")
     180        procDwmSetWindowAttribute                                = moddwmapi.NewProc("DwmSetWindowAttribute")
    178181        procGetAdaptersAddresses                                 = modiphlpapi.NewProc("GetAdaptersAddresses")
    179182        procGetAdaptersInfo                                      = modiphlpapi.NewProc("GetAdaptersInfo")
     
    409412        procGetModuleFileNameExW                                 = modpsapi.NewProc("GetModuleFileNameExW")
    410413        procGetModuleInformation                                 = modpsapi.NewProc("GetModuleInformation")
     414        procQueryWorkingSetEx                                    = modpsapi.NewProc("QueryWorkingSetEx")
    411415        procSubscribeServiceChangeNotifications                  = modsechost.NewProc("SubscribeServiceChangeNotifications")
    412416        procUnsubscribeServiceChangeNotifications                = modsechost.NewProc("UnsubscribeServiceChangeNotifications")
     
    444448        procSHGetKnownFolderPath                                 = modshell32.NewProc("SHGetKnownFolderPath")
    445449        procShellExecuteW                                        = modshell32.NewProc("ShellExecuteW")
     450        procEnumChildWindows                                     = moduser32.NewProc("EnumChildWindows")
     451        procEnumWindows                                          = moduser32.NewProc("EnumWindows")
    446452        procExitWindowsEx                                        = moduser32.NewProc("ExitWindowsEx")
     453        procGetClassNameW                                        = moduser32.NewProc("GetClassNameW")
     454        procGetDesktopWindow                                     = moduser32.NewProc("GetDesktopWindow")
     455        procGetForegroundWindow                                  = moduser32.NewProc("GetForegroundWindow")
     456        procGetGUIThreadInfo                                     = moduser32.NewProc("GetGUIThreadInfo")
    447457        procGetShellWindow                                       = moduser32.NewProc("GetShellWindow")
    448458        procGetWindowThreadProcessId                             = moduser32.NewProc("GetWindowThreadProcessId")
     459        procIsWindow                                             = moduser32.NewProc("IsWindow")
     460        procIsWindowUnicode                                      = moduser32.NewProc("IsWindowUnicode")
     461        procIsWindowVisible                                      = moduser32.NewProc("IsWindowVisible")
    449462        procMessageBoxW                                          = moduser32.NewProc("MessageBoxW")
    450463        procCreateEnvironmentBlock                               = moduserenv.NewProc("CreateEnvironmentBlock")
     
    15251538}
    15261539
     1540func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) {
     1541        r0, _, _ := syscall.Syscall6(procDwmGetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0)
     1542        if r0 != 0 {
     1543                ret = syscall.Errno(r0)
     1544        }
     1545        return
     1546}
     1547
     1548func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) {
     1549        r0, _, _ := syscall.Syscall6(procDwmSetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0)
     1550        if r0 != 0 {
     1551                ret = syscall.Errno(r0)
     1552        }
     1553        return
     1554}
     1555
    15271556func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
    15281557        r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
     
    35053534}
    35063535
     3536func QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) {
     3537        r1, _, e1 := syscall.Syscall(procQueryWorkingSetEx.Addr(), 3, uintptr(process), uintptr(pv), uintptr(cb))
     3538        if r1 == 0 {
     3539                err = errnoErr(e1)
     3540        }
     3541        return
     3542}
     3543
    35073544func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) {
    35083545        ret = procSubscribeServiceChangeNotifications.Find()
     
    37943831}
    37953832
     3833func EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) {
     3834        syscall.Syscall(procEnumChildWindows.Addr(), 3, uintptr(hwnd), uintptr(enumFunc), uintptr(param))
     3835        return
     3836}
     3837
     3838func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) {
     3839        r1, _, e1 := syscall.Syscall(procEnumWindows.Addr(), 2, uintptr(enumFunc), uintptr(param), 0)
     3840        if r1 == 0 {
     3841                err = errnoErr(e1)
     3842        }
     3843        return
     3844}
     3845
    37963846func ExitWindowsEx(flags uint32, reason uint32) (err error) {
    37973847        r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
     3848        if r1 == 0 {
     3849                err = errnoErr(e1)
     3850        }
     3851        return
     3852}
     3853
     3854func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) {
     3855        r0, _, e1 := syscall.Syscall(procGetClassNameW.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount))
     3856        copied = int32(r0)
     3857        if copied == 0 {
     3858                err = errnoErr(e1)
     3859        }
     3860        return
     3861}
     3862
     3863func GetDesktopWindow() (hwnd HWND) {
     3864        r0, _, _ := syscall.Syscall(procGetDesktopWindow.Addr(), 0, 0, 0, 0)
     3865        hwnd = HWND(r0)
     3866        return
     3867}
     3868
     3869func GetForegroundWindow() (hwnd HWND) {
     3870        r0, _, _ := syscall.Syscall(procGetForegroundWindow.Addr(), 0, 0, 0, 0)
     3871        hwnd = HWND(r0)
     3872        return
     3873}
     3874
     3875func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) {
     3876        r1, _, e1 := syscall.Syscall(procGetGUIThreadInfo.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(info)), 0)
    37983877        if r1 == 0 {
    37993878                err = errnoErr(e1)
     
    38143893                err = errnoErr(e1)
    38153894        }
     3895        return
     3896}
     3897
     3898func IsWindow(hwnd HWND) (isWindow bool) {
     3899        r0, _, _ := syscall.Syscall(procIsWindow.Addr(), 1, uintptr(hwnd), 0, 0)
     3900        isWindow = r0 != 0
     3901        return
     3902}
     3903
     3904func IsWindowUnicode(hwnd HWND) (isUnicode bool) {
     3905        r0, _, _ := syscall.Syscall(procIsWindowUnicode.Addr(), 1, uintptr(hwnd), 0, 0)
     3906        isUnicode = r0 != 0
     3907        return
     3908}
     3909
     3910func IsWindowVisible(hwnd HWND) (isVisible bool) {
     3911        r0, _, _ := syscall.Syscall(procIsWindowVisible.Addr(), 1, uintptr(hwnd), 0, 0)
     3912        isVisible = r0 != 0
    38163913        return
    38173914}
Note: See TracChangeset for help on using the changeset viewer.