summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys/windows
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/windows')
-rw-r--r--vendor/golang.org/x/sys/windows/dll_windows.go1
-rw-r--r--vendor/golang.org/x/sys/windows/memory_windows.go26
-rw-r--r--vendor/golang.org/x/sys/windows/registry/registry_test.go2
-rw-r--r--vendor/golang.org/x/sys/windows/svc/service.go26
-rw-r--r--vendor/golang.org/x/sys/windows/syscall_windows.go3
-rw-r--r--vendor/golang.org/x/sys/windows/zsyscall_windows.go40
-rw-r--r--vendor/golang.org/x/sys/windows/ztypes_windows.go7
7 files changed, 93 insertions, 12 deletions
diff --git a/vendor/golang.org/x/sys/windows/dll_windows.go b/vendor/golang.org/x/sys/windows/dll_windows.go
index 0f6204674..e77a37055 100644
--- a/vendor/golang.org/x/sys/windows/dll_windows.go
+++ b/vendor/golang.org/x/sys/windows/dll_windows.go
@@ -160,7 +160,6 @@ func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
default:
panic("Call " + p.Name + " with too many arguments " + itoa(len(a)) + ".")
}
- return
}
// A LazyDLL implements access to a single DLL.
diff --git a/vendor/golang.org/x/sys/windows/memory_windows.go b/vendor/golang.org/x/sys/windows/memory_windows.go
new file mode 100644
index 000000000..f63e899ac
--- /dev/null
+++ b/vendor/golang.org/x/sys/windows/memory_windows.go
@@ -0,0 +1,26 @@
+// Copyright 2017 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
+
+const (
+ MEM_COMMIT = 0x00001000
+ MEM_RESERVE = 0x00002000
+ MEM_DECOMMIT = 0x00004000
+ MEM_RELEASE = 0x00008000
+ MEM_RESET = 0x00080000
+ MEM_TOP_DOWN = 0x00100000
+ MEM_WRITE_WATCH = 0x00200000
+ MEM_PHYSICAL = 0x00400000
+ MEM_RESET_UNDO = 0x01000000
+ MEM_LARGE_PAGES = 0x20000000
+
+ PAGE_NOACCESS = 0x01
+ PAGE_READONLY = 0x02
+ PAGE_READWRITE = 0x04
+ PAGE_WRITECOPY = 0x08
+ PAGE_EXECUTE_READ = 0x20
+ PAGE_EXECUTE_READWRITE = 0x40
+ PAGE_EXECUTE_WRITECOPY = 0x80
+)
diff --git a/vendor/golang.org/x/sys/windows/registry/registry_test.go b/vendor/golang.org/x/sys/windows/registry/registry_test.go
index 9c1b7820e..3cb9771ca 100644
--- a/vendor/golang.org/x/sys/windows/registry/registry_test.go
+++ b/vendor/golang.org/x/sys/windows/registry/registry_test.go
@@ -336,7 +336,7 @@ func testGetValue(t *testing.T, k registry.Key, test ValueTest, size int) {
// read data with short buffer
gotsize, gottype, err = k.GetValue(test.Name, make([]byte, size-1))
if err == nil {
- t.Errorf("GetValue(%s, [%d]byte) should fail, but suceeded", test.Name, size-1)
+ t.Errorf("GetValue(%s, [%d]byte) should fail, but succeeded", test.Name, size-1)
return
}
if err != registry.ErrShortBuffer {
diff --git a/vendor/golang.org/x/sys/windows/svc/service.go b/vendor/golang.org/x/sys/windows/svc/service.go
index 1ea4a88f1..903cba3f1 100644
--- a/vendor/golang.org/x/sys/windows/svc/service.go
+++ b/vendor/golang.org/x/sys/windows/svc/service.go
@@ -56,9 +56,14 @@ const (
type Accepted uint32
const (
- AcceptStop = Accepted(windows.SERVICE_ACCEPT_STOP)
- AcceptShutdown = Accepted(windows.SERVICE_ACCEPT_SHUTDOWN)
- AcceptPauseAndContinue = Accepted(windows.SERVICE_ACCEPT_PAUSE_CONTINUE)
+ AcceptStop = Accepted(windows.SERVICE_ACCEPT_STOP)
+ AcceptShutdown = Accepted(windows.SERVICE_ACCEPT_SHUTDOWN)
+ AcceptPauseAndContinue = Accepted(windows.SERVICE_ACCEPT_PAUSE_CONTINUE)
+ AcceptParamChange = Accepted(windows.SERVICE_ACCEPT_PARAMCHANGE)
+ AcceptNetBindChange = Accepted(windows.SERVICE_ACCEPT_NETBINDCHANGE)
+ AcceptHardwareProfileChange = Accepted(windows.SERVICE_ACCEPT_HARDWAREPROFILECHANGE)
+ AcceptPowerEvent = Accepted(windows.SERVICE_ACCEPT_POWEREVENT)
+ AcceptSessionChange = Accepted(windows.SERVICE_ACCEPT_SESSIONCHANGE)
)
// Status combines State and Accepted commands to fully describe running service.
@@ -180,6 +185,21 @@ func (s *service) updateStatus(status *Status, ec *exitCode) error {
if status.Accepts&AcceptPauseAndContinue != 0 {
t.ControlsAccepted |= windows.SERVICE_ACCEPT_PAUSE_CONTINUE
}
+ if status.Accepts&AcceptParamChange != 0 {
+ t.ControlsAccepted |= windows.SERVICE_ACCEPT_PARAMCHANGE
+ }
+ if status.Accepts&AcceptNetBindChange != 0 {
+ t.ControlsAccepted |= windows.SERVICE_ACCEPT_NETBINDCHANGE
+ }
+ if status.Accepts&AcceptHardwareProfileChange != 0 {
+ t.ControlsAccepted |= windows.SERVICE_ACCEPT_HARDWAREPROFILECHANGE
+ }
+ if status.Accepts&AcceptPowerEvent != 0 {
+ t.ControlsAccepted |= windows.SERVICE_ACCEPT_POWEREVENT
+ }
+ if status.Accepts&AcceptSessionChange != 0 {
+ t.ControlsAccepted |= windows.SERVICE_ACCEPT_SESSIONCHANGE
+ }
if ec.errno == 0 {
t.Win32ExitCode = windows.NO_ERROR
t.ServiceSpecificExitCode = windows.NO_ERROR
diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go
index e439c48ab..518250e70 100644
--- a/vendor/golang.org/x/sys/windows/syscall_windows.go
+++ b/vendor/golang.org/x/sys/windows/syscall_windows.go
@@ -154,6 +154,9 @@ func NewCallbackCDecl(fn interface{}) uintptr
//sys FlushViewOfFile(addr uintptr, length uintptr) (err error)
//sys VirtualLock(addr uintptr, length uintptr) (err error)
//sys VirtualUnlock(addr uintptr, length uintptr) (err error)
+//sys VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) = kernel32.VirtualAlloc
+//sys VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) = kernel32.VirtualFree
+//sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile
//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW
//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW
diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go
index b9ee82782..d588e1d03 100644
--- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go
+++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go
@@ -139,6 +139,9 @@ var (
procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile")
procVirtualLock = modkernel32.NewProc("VirtualLock")
procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
+ procVirtualAlloc = modkernel32.NewProc("VirtualAlloc")
+ procVirtualFree = modkernel32.NewProc("VirtualFree")
+ procVirtualProtect = modkernel32.NewProc("VirtualProtect")
procTransmitFile = modmswsock.NewProc("TransmitFile")
procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW")
procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW")
@@ -1384,6 +1387,43 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) {
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)
+ if value == 0 {
+ if e1 != 0 {
+ err = errnoErr(e1)
+ } else {
+ err = syscall.EINVAL
+ }
+ }
+ return
+}
+
+func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) {
+ r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype))
+ if r1 == 0 {
+ if e1 != 0 {
+ err = errnoErr(e1)
+ } else {
+ err = syscall.EINVAL
+ }
+ }
+ return
+}
+
+func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) {
+ r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0)
+ if r1 == 0 {
+ if e1 != 0 {
+ err = errnoErr(e1)
+ } else {
+ err = syscall.EINVAL
+ }
+ }
+ return
+}
+
func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0)
if r1 == 0 {
diff --git a/vendor/golang.org/x/sys/windows/ztypes_windows.go b/vendor/golang.org/x/sys/windows/ztypes_windows.go
index a907ff2ce..c99a3fe5f 100644
--- a/vendor/golang.org/x/sys/windows/ztypes_windows.go
+++ b/vendor/golang.org/x/sys/windows/ztypes_windows.go
@@ -165,13 +165,6 @@ const (
PROCESS_QUERY_INFORMATION = 0x00000400
SYNCHRONIZE = 0x00100000
- PAGE_READONLY = 0x02
- PAGE_READWRITE = 0x04
- PAGE_WRITECOPY = 0x08
- PAGE_EXECUTE_READ = 0x20
- PAGE_EXECUTE_READWRITE = 0x40
- PAGE_EXECUTE_WRITECOPY = 0x80
-
FILE_MAP_COPY = 0x01
FILE_MAP_WRITE = 0x02
FILE_MAP_READ = 0x04