aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/windows/syscall_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/windows/syscall_windows.go')
-rw-r--r--vendor/golang.org/x/sys/windows/syscall_windows.go35
1 files changed, 23 insertions, 12 deletions
diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go
index e279138..7a6ba43 100644
--- a/vendor/golang.org/x/sys/windows/syscall_windows.go
+++ b/vendor/golang.org/x/sys/windows/syscall_windows.go
@@ -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
@@ -439,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.
@@ -748,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)
@@ -768,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)
@@ -1108,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)
}