Browse code

vendor: golang.org/x/sys eeed37f84f13f52d35e095e8023ba65671ff86a1

https://github.com/golang/sys/compare/aee5d888a86055dc6ab0342f9cdc7b53aaeaec62...eeed37f84f13f52d35e095e8023ba65671ff86a1

- all: add GOOS=ios
- unix: add back IoctlCtlInfo on darwin
- windows: add SetConsoleCursorPosition
- unix: update Dockerfile to Linux 5.9 and Go 1.15.2 (adds `CAP_CHECKPOINT_RESTORE`)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/10/21 06:50:03
Showing 63 changed files
... ...
@@ -13,7 +13,7 @@ github.com/creack/pty                               3a6a957789163cacdfe0e291617a
13 13
 github.com/sirupsen/logrus                          6699a89a232f3db797f2e280639854bbc4b89725 # v1.7.0
14 14
 github.com/tchap/go-patricia                        a7f0089c6f496e8e70402f61733606daa326cac5 # v2.3.0
15 15
 golang.org/x/net                                    ab34263943818b32f575efc978a3d24e80b04bd7
16
-golang.org/x/sys                                    aee5d888a86055dc6ab0342f9cdc7b53aaeaec62
16
+golang.org/x/sys                                    eeed37f84f13f52d35e095e8023ba65671ff86a1
17 17
 github.com/docker/go-units                          519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0
18 18
 github.com/docker/go-connections                    7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
19 19
 github.com/moby/sys                                 6154f11e6840c0d6b0dbb23f4125a6134b3013c9 # mountinfo/v0.1.3
... ...
@@ -29,26 +29,46 @@ type CacheLinePad struct{ _ [cacheLineSize]byte }
29 29
 // and HasAVX2 are only set if the OS supports XMM and YMM
30 30
 // registers in addition to the CPUID feature bit being set.
31 31
 var X86 struct {
32
-	_            CacheLinePad
33
-	HasAES       bool // AES hardware implementation (AES NI)
34
-	HasADX       bool // Multi-precision add-carry instruction extensions
35
-	HasAVX       bool // Advanced vector extension
36
-	HasAVX2      bool // Advanced vector extension 2
37
-	HasBMI1      bool // Bit manipulation instruction set 1
38
-	HasBMI2      bool // Bit manipulation instruction set 2
39
-	HasERMS      bool // Enhanced REP for MOVSB and STOSB
40
-	HasFMA       bool // Fused-multiply-add instructions
41
-	HasOSXSAVE   bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
42
-	HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM
43
-	HasPOPCNT    bool // Hamming weight instruction POPCNT.
44
-	HasRDRAND    bool // RDRAND instruction (on-chip random number generator)
45
-	HasRDSEED    bool // RDSEED instruction (on-chip random number generator)
46
-	HasSSE2      bool // Streaming SIMD extension 2 (always available on amd64)
47
-	HasSSE3      bool // Streaming SIMD extension 3
48
-	HasSSSE3     bool // Supplemental streaming SIMD extension 3
49
-	HasSSE41     bool // Streaming SIMD extension 4 and 4.1
50
-	HasSSE42     bool // Streaming SIMD extension 4 and 4.2
51
-	_            CacheLinePad
32
+	_                   CacheLinePad
33
+	HasAES              bool // AES hardware implementation (AES NI)
34
+	HasADX              bool // Multi-precision add-carry instruction extensions
35
+	HasAVX              bool // Advanced vector extension
36
+	HasAVX2             bool // Advanced vector extension 2
37
+	HasAVX512           bool // Advanced vector extension 512
38
+	HasAVX512F          bool // Advanced vector extension 512 Foundation Instructions
39
+	HasAVX512CD         bool // Advanced vector extension 512 Conflict Detection Instructions
40
+	HasAVX512ER         bool // Advanced vector extension 512 Exponential and Reciprocal Instructions
41
+	HasAVX512PF         bool // Advanced vector extension 512 Prefetch Instructions Instructions
42
+	HasAVX512VL         bool // Advanced vector extension 512 Vector Length Extensions
43
+	HasAVX512BW         bool // Advanced vector extension 512 Byte and Word Instructions
44
+	HasAVX512DQ         bool // Advanced vector extension 512 Doubleword and Quadword Instructions
45
+	HasAVX512IFMA       bool // Advanced vector extension 512 Integer Fused Multiply Add
46
+	HasAVX512VBMI       bool // Advanced vector extension 512 Vector Byte Manipulation Instructions
47
+	HasAVX5124VNNIW     bool // Advanced vector extension 512 Vector Neural Network Instructions Word variable precision
48
+	HasAVX5124FMAPS     bool // Advanced vector extension 512 Fused Multiply Accumulation Packed Single precision
49
+	HasAVX512VPOPCNTDQ  bool // Advanced vector extension 512 Double and quad word population count instructions
50
+	HasAVX512VPCLMULQDQ bool // Advanced vector extension 512 Vector carry-less multiply operations
51
+	HasAVX512VNNI       bool // Advanced vector extension 512 Vector Neural Network Instructions
52
+	HasAVX512GFNI       bool // Advanced vector extension 512 Galois field New Instructions
53
+	HasAVX512VAES       bool // Advanced vector extension 512 Vector AES instructions
54
+	HasAVX512VBMI2      bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2
55
+	HasAVX512BITALG     bool // Advanced vector extension 512 Bit Algorithms
56
+	HasAVX512BF16       bool // Advanced vector extension 512 BFloat16 Instructions
57
+	HasBMI1             bool // Bit manipulation instruction set 1
58
+	HasBMI2             bool // Bit manipulation instruction set 2
59
+	HasERMS             bool // Enhanced REP for MOVSB and STOSB
60
+	HasFMA              bool // Fused-multiply-add instructions
61
+	HasOSXSAVE          bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
62
+	HasPCLMULQDQ        bool // PCLMULQDQ instruction - most often used for AES-GCM
63
+	HasPOPCNT           bool // Hamming weight instruction POPCNT.
64
+	HasRDRAND           bool // RDRAND instruction (on-chip random number generator)
65
+	HasRDSEED           bool // RDSEED instruction (on-chip random number generator)
66
+	HasSSE2             bool // Streaming SIMD extension 2 (always available on amd64)
67
+	HasSSE3             bool // Streaming SIMD extension 3
68
+	HasSSSE3            bool // Supplemental streaming SIMD extension 3
69
+	HasSSE41            bool // Streaming SIMD extension 4 and 4.1
70
+	HasSSE42            bool // Streaming SIMD extension 4 and 4.2
71
+	_                   CacheLinePad
52 72
 }
53 73
 
54 74
 // ARM64 contains the supported CPU features of the
... ...
@@ -39,7 +39,7 @@ func initOptions() {
39 39
 
40 40
 func archInit() {
41 41
 	switch runtime.GOOS {
42
-	case "android", "darwin", "netbsd":
42
+	case "android", "darwin", "ios", "netbsd", "openbsd":
43 43
 		// Android and iOS don't seem to allow reading these registers.
44 44
 		//
45 45
 		// NetBSD:
... ...
@@ -47,6 +47,9 @@ func archInit() {
47 47
 		// It can be read via sysctl(3). Example for future implementers:
48 48
 		// https://nxr.netbsd.org/xref/src/usr.sbin/cpuctl/arch/aarch64.c
49 49
 		//
50
+		// OpenBSD:
51
+		// See https://golang.org/issue/31746
52
+		//
50 53
 		// Fake the minimal features expected by
51 54
 		// TestARM64minimalFeatures.
52 55
 		ARM64.HasASIMD = true
... ...
@@ -16,6 +16,26 @@ func initOptions() {
16 16
 		{Name: "aes", Feature: &X86.HasAES},
17 17
 		{Name: "avx", Feature: &X86.HasAVX},
18 18
 		{Name: "avx2", Feature: &X86.HasAVX2},
19
+		{Name: "avx512", Feature: &X86.HasAVX512},
20
+		{Name: "avx512f", Feature: &X86.HasAVX512F},
21
+		{Name: "avx512cd", Feature: &X86.HasAVX512CD},
22
+		{Name: "avx512er", Feature: &X86.HasAVX512ER},
23
+		{Name: "avx512pf", Feature: &X86.HasAVX512PF},
24
+		{Name: "avx512vl", Feature: &X86.HasAVX512VL},
25
+		{Name: "avx512bw", Feature: &X86.HasAVX512BW},
26
+		{Name: "avx512dq", Feature: &X86.HasAVX512DQ},
27
+		{Name: "avx512ifma", Feature: &X86.HasAVX512IFMA},
28
+		{Name: "avx512vbmi", Feature: &X86.HasAVX512VBMI},
29
+		{Name: "avx512vnniw", Feature: &X86.HasAVX5124VNNIW},
30
+		{Name: "avx5124fmaps", Feature: &X86.HasAVX5124FMAPS},
31
+		{Name: "avx512vpopcntdq", Feature: &X86.HasAVX512VPOPCNTDQ},
32
+		{Name: "avx512vpclmulqdq", Feature: &X86.HasAVX512VPCLMULQDQ},
33
+		{Name: "avx512vnni", Feature: &X86.HasAVX512VNNI},
34
+		{Name: "avx512gfni", Feature: &X86.HasAVX512GFNI},
35
+		{Name: "avx512vaes", Feature: &X86.HasAVX512VAES},
36
+		{Name: "avx512vbmi2", Feature: &X86.HasAVX512VBMI2},
37
+		{Name: "avx512bitalg", Feature: &X86.HasAVX512BITALG},
38
+		{Name: "avx512bf16", Feature: &X86.HasAVX512BF16},
19 39
 		{Name: "bmi1", Feature: &X86.HasBMI1},
20 40
 		{Name: "bmi2", Feature: &X86.HasBMI2},
21 41
 		{Name: "erms", Feature: &X86.HasERMS},
... ...
@@ -59,12 +79,15 @@ func archInit() {
59 59
 	X86.HasOSXSAVE = isSet(27, ecx1)
60 60
 	X86.HasRDRAND = isSet(30, ecx1)
61 61
 
62
-	osSupportsAVX := false
62
+	var osSupportsAVX, osSupportsAVX512 bool
63 63
 	// For XGETBV, OSXSAVE bit is required and sufficient.
64 64
 	if X86.HasOSXSAVE {
65 65
 		eax, _ := xgetbv()
66 66
 		// Check if XMM and YMM registers have OS support.
67 67
 		osSupportsAVX = isSet(1, eax) && isSet(2, eax)
68
+
69
+		// Check if OPMASK and ZMM registers have OS support.
70
+		osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax)
68 71
 	}
69 72
 
70 73
 	X86.HasAVX = isSet(28, ecx1) && osSupportsAVX
... ...
@@ -73,7 +96,7 @@ func archInit() {
73 73
 		return
74 74
 	}
75 75
 
76
-	_, ebx7, _, _ := cpuid(7, 0)
76
+	_, ebx7, ecx7, edx7 := cpuid(7, 0)
77 77
 	X86.HasBMI1 = isSet(3, ebx7)
78 78
 	X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX
79 79
 	X86.HasBMI2 = isSet(8, ebx7)
... ...
@@ -81,6 +104,30 @@ func archInit() {
81 81
 	X86.HasRDSEED = isSet(18, ebx7)
82 82
 	X86.HasADX = isSet(19, ebx7)
83 83
 
84
+	X86.HasAVX512 = isSet(16, ebx7) && osSupportsAVX512 // Because avx-512 foundation is the core required extension
85
+	if X86.HasAVX512 {
86
+		X86.HasAVX512F = true
87
+		X86.HasAVX512CD = isSet(28, ebx7)
88
+		X86.HasAVX512ER = isSet(27, ebx7)
89
+		X86.HasAVX512PF = isSet(26, ebx7)
90
+		X86.HasAVX512VL = isSet(31, ebx7)
91
+		X86.HasAVX512BW = isSet(30, ebx7)
92
+		X86.HasAVX512DQ = isSet(17, ebx7)
93
+		X86.HasAVX512IFMA = isSet(21, ebx7)
94
+		X86.HasAVX512VBMI = isSet(1, ecx7)
95
+		X86.HasAVX5124VNNIW = isSet(2, edx7)
96
+		X86.HasAVX5124FMAPS = isSet(3, edx7)
97
+		X86.HasAVX512VPOPCNTDQ = isSet(14, ecx7)
98
+		X86.HasAVX512VPCLMULQDQ = isSet(10, ecx7)
99
+		X86.HasAVX512VNNI = isSet(11, ecx7)
100
+		X86.HasAVX512GFNI = isSet(8, ecx7)
101
+		X86.HasAVX512VAES = isSet(9, ecx7)
102
+		X86.HasAVX512VBMI2 = isSet(6, ecx7)
103
+		X86.HasAVX512BITALG = isSet(12, ecx7)
104
+
105
+		eax71, _, _, _ := cpuid(7, 1)
106
+		X86.HasAVX512BF16 = isSet(5, eax71)
107
+	}
84 108
 }
85 109
 
86 110
 func isSet(bitpos uint, value uint32) bool {
... ...
@@ -1,9 +1,9 @@
1
-// +build linux,386 linux,arm linux,mips linux,mipsle
2
-
3 1
 // Copyright 2014 The Go Authors. All rights reserved.
4 2
 // Use of this source code is governed by a BSD-style
5 3
 // license that can be found in the LICENSE file.
6 4
 
5
+// +build linux,386 linux,arm linux,mips linux,mipsle
6
+
7 7
 package unix
8 8
 
9 9
 func init() {
... ...
@@ -12,10 +12,8 @@ import "syscall"
12 12
 // We can't use the gc-syntax .s files for gccgo. On the plus side
13 13
 // much of the functionality can be written directly in Go.
14 14
 
15
-//extern gccgoRealSyscallNoError
16 15
 func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
17 16
 
18
-//extern gccgoRealSyscall
19 17
 func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
20 18
 
21 19
 func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
... ...
@@ -21,6 +21,9 @@ struct ret {
21 21
 	uintptr_t err;
22 22
 };
23 23
 
24
+struct ret gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
25
+  __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscall");
26
+
24 27
 struct ret
25 28
 gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
26 29
 {
... ...
@@ -32,6 +35,9 @@ gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintp
32 32
 	return r;
33 33
 }
34 34
 
35
+uintptr_t gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
36
+  __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscallNoError");
37
+
35 38
 uintptr_t
36 39
 gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
37 40
 {
... ...
@@ -20,7 +20,7 @@ func cmsgAlignOf(salen int) int {
20 20
 	case "aix":
21 21
 		// There is no alignment on AIX.
22 22
 		salign = 1
23
-	case "darwin", "illumos", "solaris":
23
+	case "darwin", "ios", "illumos", "solaris":
24 24
 		// NOTE: It seems like 64-bit Darwin, Illumos and Solaris
25 25
 		// kernels still require 32-bit aligned access to network
26 26
 		// subsystem.
... ...
@@ -32,6 +32,10 @@ func cmsgAlignOf(salen int) int {
32 32
 		if runtime.GOARCH == "arm" {
33 33
 			salign = 8
34 34
 		}
35
+		// NetBSD aarch64 requires 128-bit alignment.
36
+		if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" {
37
+			salign = 16
38
+		}
35 39
 	}
36 40
 
37 41
 	return (salen + salign - 1) & ^(salign - 1)
... ...
@@ -19,6 +19,22 @@ import "unsafe"
19 19
  * Wrapped
20 20
  */
21 21
 
22
+func Access(path string, mode uint32) (err error) {
23
+	return Faccessat(AT_FDCWD, path, mode, 0)
24
+}
25
+
26
+func Chmod(path string, mode uint32) (err error) {
27
+	return Fchmodat(AT_FDCWD, path, mode, 0)
28
+}
29
+
30
+func Chown(path string, uid int, gid int) (err error) {
31
+	return Fchownat(AT_FDCWD, path, uid, gid, 0)
32
+}
33
+
34
+func Creat(path string, mode uint32) (fd int, err error) {
35
+	return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
36
+}
37
+
22 38
 //sys	utimes(path string, times *[2]Timeval) (err error)
23 39
 func Utimes(path string, tv []Timeval) error {
24 40
 	if len(tv) != 2 {
... ...
@@ -18,6 +18,21 @@ import (
18 18
 	"unsafe"
19 19
 )
20 20
 
21
+const ImplementsGetwd = true
22
+
23
+func Getwd() (string, error) {
24
+	var buf [PathMax]byte
25
+	_, err := Getcwd(buf[0:])
26
+	if err != nil {
27
+		return "", err
28
+	}
29
+	n := clen(buf[:])
30
+	if n < 1 {
31
+		return "", EINVAL
32
+	}
33
+	return string(buf[:n]), nil
34
+}
35
+
21 36
 /*
22 37
  * Wrapped
23 38
  */
... ...
@@ -272,7 +287,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
272 272
 	if err != nil {
273 273
 		return
274 274
 	}
275
-	if runtime.GOOS == "darwin" && len == 0 {
275
+	if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 {
276 276
 		// Accepted socket has no address.
277 277
 		// This is likely due to a bug in xnu kernels,
278 278
 		// where instead of ECONNABORTED error socket
... ...
@@ -13,29 +13,11 @@
13 13
 package unix
14 14
 
15 15
 import (
16
-	"errors"
16
+	"runtime"
17 17
 	"syscall"
18 18
 	"unsafe"
19 19
 )
20 20
 
21
-const ImplementsGetwd = true
22
-
23
-func Getwd() (string, error) {
24
-	buf := make([]byte, 2048)
25
-	attrs, err := getAttrList(".", attrList{CommonAttr: attrCmnFullpath}, buf, 0)
26
-	if err == nil && len(attrs) == 1 && len(attrs[0]) >= 2 {
27
-		wd := string(attrs[0])
28
-		// Sanity check that it's an absolute path and ends
29
-		// in a null byte, which we then strip.
30
-		if wd[0] == '/' && wd[len(wd)-1] == 0 {
31
-			return wd[:len(wd)-1], nil
32
-		}
33
-	}
34
-	// If pkg/os/getwd.go gets ENOTSUP, it will fall back to the
35
-	// slow algorithm.
36
-	return "", ENOTSUP
37
-}
38
-
39 21
 // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
40 22
 type SockaddrDatalink struct {
41 23
 	Len    uint8
... ...
@@ -97,11 +79,6 @@ func direntNamlen(buf []byte) (uint64, bool) {
97 97
 func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
98 98
 func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
99 99
 
100
-const (
101
-	attrBitMapCount = 5
102
-	attrCmnFullpath = 0x08000000
103
-)
104
-
105 100
 type attrList struct {
106 101
 	bitmapCount uint16
107 102
 	_           uint16
... ...
@@ -112,54 +89,6 @@ type attrList struct {
112 112
 	Forkattr    uint32
113 113
 }
114 114
 
115
-func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (attrs [][]byte, err error) {
116
-	if len(attrBuf) < 4 {
117
-		return nil, errors.New("attrBuf too small")
118
-	}
119
-	attrList.bitmapCount = attrBitMapCount
120
-
121
-	var _p0 *byte
122
-	_p0, err = BytePtrFromString(path)
123
-	if err != nil {
124
-		return nil, err
125
-	}
126
-
127
-	if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil {
128
-		return nil, err
129
-	}
130
-	size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
131
-
132
-	// dat is the section of attrBuf that contains valid data,
133
-	// without the 4 byte length header. All attribute offsets
134
-	// are relative to dat.
135
-	dat := attrBuf
136
-	if int(size) < len(attrBuf) {
137
-		dat = dat[:size]
138
-	}
139
-	dat = dat[4:] // remove length prefix
140
-
141
-	for i := uint32(0); int(i) < len(dat); {
142
-		header := dat[i:]
143
-		if len(header) < 8 {
144
-			return attrs, errors.New("truncated attribute header")
145
-		}
146
-		datOff := *(*int32)(unsafe.Pointer(&header[0]))
147
-		attrLen := *(*uint32)(unsafe.Pointer(&header[4]))
148
-		if datOff < 0 || uint32(datOff)+attrLen > uint32(len(dat)) {
149
-			return attrs, errors.New("truncated results; attrBuf too small")
150
-		}
151
-		end := uint32(datOff) + attrLen
152
-		attrs = append(attrs, dat[datOff:end])
153
-		i = end
154
-		if r := i % 4; r != 0 {
155
-			i += (4 - r)
156
-		}
157
-	}
158
-	return
159
-}
160
-
161
-//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
162
-
163 115
 //sysnb pipe() (r int, w int, err error)
164 116
 
165 117
 func Pipe(p []int) (err error) {
... ...
@@ -329,6 +258,12 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig
329 329
 
330 330
 //sys	ioctl(fd int, req uint, arg uintptr) (err error)
331 331
 
332
+func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
333
+	err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo)))
334
+	runtime.KeepAlive(ctlInfo)
335
+	return err
336
+}
337
+
332 338
 //sys   sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
333 339
 
334 340
 func Uname(uname *Utsname) error {
... ...
@@ -419,6 +354,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
419 419
 //sys	Fpathconf(fd int, name int) (val int, err error)
420 420
 //sys	Fsync(fd int) (err error)
421 421
 //sys	Ftruncate(fd int, length int64) (err error)
422
+//sys	Getcwd(buf []byte) (n int, err error)
422 423
 //sys	Getdtablesize() (size int)
423 424
 //sysnb	Getegid() (egid int)
424 425
 //sysnb	Geteuid() (uid int)
... ...
@@ -6,11 +6,7 @@
6 6
 
7 7
 package unix
8 8
 
9
-import (
10
-	"syscall"
11
-)
12
-
13
-//sys   ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
9
+import "syscall"
14 10
 
15 11
 func setTimespec(sec, nsec int64) Timespec {
16 12
 	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
... ...
@@ -49,5 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
49 49
 //sys	Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
50 50
 //sys	getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
51 51
 //sys	Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
52
+//sys	ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
52 53
 //sys	Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
53 54
 //sys	Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
... ...
@@ -6,11 +6,7 @@
6 6
 
7 7
 package unix
8 8
 
9
-import (
10
-	"syscall"
11
-)
12
-
13
-//sys   ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
9
+import "syscall"
14 10
 
15 11
 func setTimespec(sec, nsec int64) Timespec {
16 12
 	return Timespec{Sec: sec, Nsec: nsec}
... ...
@@ -49,5 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
49 49
 //sys	Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
50 50
 //sys	getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
51 51
 //sys	Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
52
+//sys	ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
52 53
 //sys	Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
53 54
 //sys	Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
... ...
@@ -4,9 +4,7 @@
4 4
 
5 5
 package unix
6 6
 
7
-import (
8
-	"syscall"
9
-)
7
+import "syscall"
10 8
 
11 9
 func ptrace(request int, pid int, addr uintptr, data uintptr) error {
12 10
 	return ENOTSUP
... ...
@@ -6,13 +6,7 @@
6 6
 
7 7
 package unix
8 8
 
9
-import (
10
-	"syscall"
11
-)
12
-
13
-func ptrace(request int, pid int, addr uintptr, data uintptr) error {
14
-	return ENOTSUP
15
-}
9
+import "syscall"
16 10
 
17 11
 func setTimespec(sec, nsec int64) Timespec {
18 12
 	return Timespec{Sec: sec, Nsec: nsec}
... ...
@@ -51,5 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
51 51
 //sys	Fstatfs(fd int, stat *Statfs_t) (err error)
52 52
 //sys	getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
53 53
 //sys	Lstat(path string, stat *Stat_t) (err error)
54
+//sys	ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
54 55
 //sys	Stat(path string, stat *Stat_t) (err error)
55 56
 //sys	Statfs(path string, stat *Statfs_t) (err error)
... ...
@@ -129,23 +129,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
129 129
 	return
130 130
 }
131 131
 
132
-const ImplementsGetwd = true
133
-
134 132
 //sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
135 133
 
136
-func Getwd() (string, error) {
137
-	var buf [PathMax]byte
138
-	_, err := Getcwd(buf[0:])
139
-	if err != nil {
140
-		return "", err
141
-	}
142
-	n := clen(buf[:])
143
-	if n < 1 {
144
-		return "", EINVAL
145
-	}
146
-	return string(buf[:n]), nil
147
-}
148
-
149 134
 func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
150 135
 	var _p0 unsafe.Pointer
151 136
 	var bufsize uintptr
... ...
@@ -140,23 +140,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
140 140
 	return
141 141
 }
142 142
 
143
-const ImplementsGetwd = true
144
-
145 143
 //sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
146 144
 
147
-func Getwd() (string, error) {
148
-	var buf [PathMax]byte
149
-	_, err := Getcwd(buf[0:])
150
-	if err != nil {
151
-		return "", err
152
-	}
153
-	n := clen(buf[:])
154
-	if n < 1 {
155
-		return "", EINVAL
156
-	}
157
-	return string(buf[:n]), nil
158
-}
159
-
160 145
 func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
161 146
 	var (
162 147
 		_p0          unsafe.Pointer
... ...
@@ -106,15 +106,24 @@ func IoctlGetRTCTime(fd int) (*RTCTime, error) {
106 106
 	return &value, err
107 107
 }
108 108
 
109
+// IoctlGetWatchdogInfo fetches information about a watchdog device from the
110
+// Linux watchdog API. For more information, see:
111
+// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
112
+func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
113
+	var value WatchdogInfo
114
+	err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value)))
115
+	return &value, err
116
+}
117
+
109 118
 func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
110 119
 	var value RTCWkAlrm
111 120
 	err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value)))
112 121
 	return &value, err
113 122
 }
114 123
 
115
-// IoctlFileClone performs an FICLONERANGE ioctl operation to clone the range of
116
-// data conveyed in value to the file associated with the file descriptor
117
-// destFd. See the ioctl_ficlonerange(2) man page for details.
124
+// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
125
+// range of data conveyed in value to the file associated with the file
126
+// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
118 127
 func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
119 128
 	err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value)))
120 129
 	runtime.KeepAlive(value)
... ...
@@ -128,15 +137,22 @@ func IoctlFileClone(destFd, srcFd int) error {
128 128
 	return ioctl(destFd, FICLONE, uintptr(srcFd))
129 129
 }
130 130
 
131
-// IoctlFileClone performs an FIDEDUPERANGE ioctl operation to share the range of
132
-// data conveyed in value with the file associated with the file descriptor
133
-// destFd. See the ioctl_fideduperange(2) man page for details.
131
+// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
132
+// range of data conveyed in value with the file associated with the file
133
+// descriptor destFd. See the ioctl_fideduperange(2) man page for details.
134 134
 func IoctlFileDedupeRange(destFd int, value *FileDedupeRange) error {
135 135
 	err := ioctl(destFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(value)))
136 136
 	runtime.KeepAlive(value)
137 137
 	return err
138 138
 }
139 139
 
140
+// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
141
+// more information, see:
142
+// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
143
+func IoctlWatchdogKeepalive(fd int) error {
144
+	return ioctl(fd, WDIOC_KEEPALIVE, 0)
145
+}
146
+
140 147
 //sys	Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
141 148
 
142 149
 func Link(oldpath string, newpath string) (err error) {
... ...
@@ -2,9 +2,6 @@
2 2
 // Use of this source code is governed by a BSD-style
3 3
 // license that can be found in the LICENSE file.
4 4
 
5
-// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
6
-// so that go vet can check that they are correct.
7
-
8 5
 // +build 386,linux
9 6
 
10 7
 package unix
... ...
@@ -141,23 +141,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
141 141
 	return
142 142
 }
143 143
 
144
-const ImplementsGetwd = true
145
-
146 144
 //sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
147 145
 
148
-func Getwd() (string, error) {
149
-	var buf [PathMax]byte
150
-	_, err := Getcwd(buf[0:])
151
-	if err != nil {
152
-		return "", err
153
-	}
154
-	n := clen(buf[:])
155
-	if n < 1 {
156
-		return "", EINVAL
157
-	}
158
-	return string(buf[:n]), nil
159
-}
160
-
161 146
 // TODO
162 147
 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
163 148
 	return -1, ENOSYS
... ...
@@ -114,23 +114,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
114 114
 	return
115 115
 }
116 116
 
117
-const ImplementsGetwd = true
118
-
119 117
 //sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
120 118
 
121
-func Getwd() (string, error) {
122
-	var buf [PathMax]byte
123
-	_, err := Getcwd(buf[0:])
124
-	if err != nil {
125
-		return "", err
126
-	}
127
-	n := clen(buf[:])
128
-	if n < 1 {
129
-		return "", EINVAL
130
-	}
131
-	return string(buf[:n]), nil
132
-}
133
-
134 119
 func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
135 120
 	if raceenabled {
136 121
 		raceReleaseMerge(unsafe.Pointer(&ioSync))
... ...
@@ -13,6 +13,7 @@
13 13
 package unix
14 14
 
15 15
 import (
16
+	"runtime"
16 17
 	"syscall"
17 18
 	"unsafe"
18 19
 )
... ...
@@ -553,8 +554,10 @@ func Minor(dev uint64) uint32 {
553 553
 
554 554
 //sys	ioctl(fd int, req uint, arg uintptr) (err error)
555 555
 
556
-func IoctlSetTermio(fd int, req uint, value *Termio) (err error) {
557
-	return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
556
+func IoctlSetTermio(fd int, req uint, value *Termio) error {
557
+	err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
558
+	runtime.KeepAlive(value)
559
+	return err
558 560
 }
559 561
 
560 562
 func IoctlGetTermio(fd int, req uint) (*Termio, error) {
... ...
@@ -251,6 +251,7 @@ const (
251 251
 	CSTOP                             = 0x13
252 252
 	CSTOPB                            = 0x400
253 253
 	CSUSP                             = 0x1a
254
+	CTLIOCGINFO                       = 0xc0644e03
254 255
 	CTL_HW                            = 0x6
255 256
 	CTL_KERN                          = 0x1
256 257
 	CTL_MAXNAME                       = 0xc
... ...
@@ -251,6 +251,7 @@ const (
251 251
 	CSTOP                             = 0x13
252 252
 	CSTOPB                            = 0x400
253 253
 	CSUSP                             = 0x1a
254
+	CTLIOCGINFO                       = 0xc0644e03
254 255
 	CTL_HW                            = 0x6
255 256
 	CTL_KERN                          = 0x1
256 257
 	CTL_MAXNAME                       = 0xc
... ...
@@ -251,6 +251,7 @@ const (
251 251
 	CSTOP                             = 0x13
252 252
 	CSTOPB                            = 0x400
253 253
 	CSUSP                             = 0x1a
254
+	CTLIOCGINFO                       = 0xc0644e03
254 255
 	CTL_HW                            = 0x6
255 256
 	CTL_KERN                          = 0x1
256 257
 	CTL_MAXNAME                       = 0xc
... ...
@@ -251,6 +251,7 @@ const (
251 251
 	CSTOP                             = 0x13
252 252
 	CSTOPB                            = 0x400
253 253
 	CSUSP                             = 0x1a
254
+	CTLIOCGINFO                       = 0xc0644e03
254 255
 	CTL_HW                            = 0x6
255 256
 	CTL_KERN                          = 0x1
256 257
 	CTL_MAXNAME                       = 0xc
... ...
@@ -62,6 +62,7 @@ const (
62 62
 	B28800                            = 0x7080
63 63
 	B300                              = 0x12c
64 64
 	B38400                            = 0x9600
65
+	B460800                           = 0x70800
65 66
 	B4800                             = 0x12c0
66 67
 	B50                               = 0x32
67 68
 	B57600                            = 0xe100
... ...
@@ -69,12 +70,15 @@ const (
69 69
 	B7200                             = 0x1c20
70 70
 	B75                               = 0x4b
71 71
 	B76800                            = 0x12c00
72
+	B921600                           = 0xe1000
72 73
 	B9600                             = 0x2580
74
+	BIOCFEEDBACK                      = 0x8004427d
73 75
 	BIOCFLUSH                         = 0x20004268
74 76
 	BIOCGBLEN                         = 0x40044266
75 77
 	BIOCGDLT                          = 0x4004426a
76 78
 	BIOCGDLTLIST                      = 0xc0104279
77 79
 	BIOCGETIF                         = 0x4020426b
80
+	BIOCGFEEDBACK                     = 0x4004427c
78 81
 	BIOCGHDRCMPLT                     = 0x40044274
79 82
 	BIOCGRSIG                         = 0x40044272
80 83
 	BIOCGRTIMEOUT                     = 0x4010426e
... ...
@@ -88,6 +92,7 @@ const (
88 88
 	BIOCSETF                          = 0x80104267
89 89
 	BIOCSETIF                         = 0x8020426c
90 90
 	BIOCSETWF                         = 0x8010427b
91
+	BIOCSFEEDBACK                     = 0x8004427d
91 92
 	BIOCSHDRCMPLT                     = 0x80044275
92 93
 	BIOCSRSIG                         = 0x80044273
93 94
 	BIOCSRTIMEOUT                     = 0x8010426d
... ...
@@ -125,6 +130,7 @@ const (
125 125
 	BPF_MINBUFSIZE                    = 0x20
126 126
 	BPF_MINOR_VERSION                 = 0x1
127 127
 	BPF_MISC                          = 0x7
128
+	BPF_MOD                           = 0x90
128 129
 	BPF_MSH                           = 0xa0
129 130
 	BPF_MUL                           = 0x20
130 131
 	BPF_NEG                           = 0x80
... ...
@@ -139,6 +145,7 @@ const (
139 139
 	BPF_TXA                           = 0x80
140 140
 	BPF_W                             = 0x0
141 141
 	BPF_X                             = 0x8
142
+	BPF_XOR                           = 0xa0
142 143
 	BRKINT                            = 0x2
143 144
 	CFLUSH                            = 0xf
144 145
 	CLOCAL                            = 0x8000
... ...
@@ -156,6 +163,12 @@ const (
156 156
 	CLOCK_UPTIME_FAST                 = 0x8
157 157
 	CLOCK_UPTIME_PRECISE              = 0x7
158 158
 	CLOCK_VIRTUAL                     = 0x1
159
+	CPUSTATES                         = 0x5
160
+	CP_IDLE                           = 0x4
161
+	CP_INTR                           = 0x3
162
+	CP_NICE                           = 0x1
163
+	CP_SYS                            = 0x2
164
+	CP_USER                           = 0x0
159 165
 	CREAD                             = 0x800
160 166
 	CRTSCTS                           = 0x30000
161 167
 	CS5                               = 0x0
... ...
@@ -175,6 +188,7 @@ const (
175 175
 	DLT_A429                          = 0xb8
176 176
 	DLT_A653_ICM                      = 0xb9
177 177
 	DLT_AIRONET_HEADER                = 0x78
178
+	DLT_AOS                           = 0xde
178 179
 	DLT_APPLE_IP_OVER_IEEE1394        = 0x8a
179 180
 	DLT_ARCNET                        = 0x7
180 181
 	DLT_ARCNET_LINUX                  = 0x81
... ...
@@ -184,22 +198,33 @@ const (
184 184
 	DLT_AX25                          = 0x3
185 185
 	DLT_AX25_KISS                     = 0xca
186 186
 	DLT_BACNET_MS_TP                  = 0xa5
187
+	DLT_BLUETOOTH_BREDR_BB            = 0xff
187 188
 	DLT_BLUETOOTH_HCI_H4              = 0xbb
188 189
 	DLT_BLUETOOTH_HCI_H4_WITH_PHDR    = 0xc9
190
+	DLT_BLUETOOTH_LE_LL               = 0xfb
191
+	DLT_BLUETOOTH_LE_LL_WITH_PHDR     = 0x100
192
+	DLT_BLUETOOTH_LINUX_MONITOR       = 0xfe
189 193
 	DLT_CAN20B                        = 0xbe
194
+	DLT_CAN_SOCKETCAN                 = 0xe3
190 195
 	DLT_CHAOS                         = 0x5
191 196
 	DLT_CHDLC                         = 0x68
192 197
 	DLT_CISCO_IOS                     = 0x76
193 198
 	DLT_C_HDLC                        = 0x68
194 199
 	DLT_C_HDLC_WITH_DIR               = 0xcd
200
+	DLT_DBUS                          = 0xe7
201
+	DLT_DECT                          = 0xdd
195 202
 	DLT_DOCSIS                        = 0x8f
203
+	DLT_DVB_CI                        = 0xeb
196 204
 	DLT_ECONET                        = 0x73
197 205
 	DLT_EN10MB                        = 0x1
198 206
 	DLT_EN3MB                         = 0x2
199 207
 	DLT_ENC                           = 0x6d
208
+	DLT_EPON                          = 0x103
200 209
 	DLT_ERF                           = 0xc5
201 210
 	DLT_ERF_ETH                       = 0xaf
202 211
 	DLT_ERF_POS                       = 0xb0
212
+	DLT_FC_2                          = 0xe0
213
+	DLT_FC_2_WITH_FRAME_DELIMS        = 0xe1
203 214
 	DLT_FDDI                          = 0xa
204 215
 	DLT_FLEXRAY                       = 0xd2
205 216
 	DLT_FRELAY                        = 0x6b
... ...
@@ -209,6 +234,8 @@ const (
209 209
 	DLT_GPF_F                         = 0xab
210 210
 	DLT_GPF_T                         = 0xaa
211 211
 	DLT_GPRS_LLC                      = 0xa9
212
+	DLT_GSMTAP_ABIS                   = 0xda
213
+	DLT_GSMTAP_UM                     = 0xd9
212 214
 	DLT_HHDLC                         = 0x79
213 215
 	DLT_IBM_SN                        = 0x92
214 216
 	DLT_IBM_SP                        = 0x91
... ...
@@ -218,18 +245,28 @@ const (
218 218
 	DLT_IEEE802_11_RADIO_AVS          = 0xa3
219 219
 	DLT_IEEE802_15_4                  = 0xc3
220 220
 	DLT_IEEE802_15_4_LINUX            = 0xbf
221
+	DLT_IEEE802_15_4_NOFCS            = 0xe6
221 222
 	DLT_IEEE802_15_4_NONASK_PHY       = 0xd7
222 223
 	DLT_IEEE802_16_MAC_CPS            = 0xbc
223 224
 	DLT_IEEE802_16_MAC_CPS_RADIO      = 0xc1
225
+	DLT_INFINIBAND                    = 0xf7
224 226
 	DLT_IPFILTER                      = 0x74
225 227
 	DLT_IPMB                          = 0xc7
226 228
 	DLT_IPMB_LINUX                    = 0xd1
229
+	DLT_IPMI_HPM_2                    = 0x104
230
+	DLT_IPNET                         = 0xe2
231
+	DLT_IPOIB                         = 0xf2
232
+	DLT_IPV4                          = 0xe4
233
+	DLT_IPV6                          = 0xe5
227 234
 	DLT_IP_OVER_FC                    = 0x7a
235
+	DLT_ISO_14443                     = 0x108
228 236
 	DLT_JUNIPER_ATM1                  = 0x89
229 237
 	DLT_JUNIPER_ATM2                  = 0x87
238
+	DLT_JUNIPER_ATM_CEMIC             = 0xee
230 239
 	DLT_JUNIPER_CHDLC                 = 0xb5
231 240
 	DLT_JUNIPER_ES                    = 0x84
232 241
 	DLT_JUNIPER_ETHER                 = 0xb2
242
+	DLT_JUNIPER_FIBRECHANNEL          = 0xea
233 243
 	DLT_JUNIPER_FRELAY                = 0xb4
234 244
 	DLT_JUNIPER_GGSN                  = 0x85
235 245
 	DLT_JUNIPER_ISM                   = 0xc2
... ...
@@ -242,25 +279,40 @@ const (
242 242
 	DLT_JUNIPER_PPPOE                 = 0xa7
243 243
 	DLT_JUNIPER_PPPOE_ATM             = 0xa8
244 244
 	DLT_JUNIPER_SERVICES              = 0x88
245
+	DLT_JUNIPER_SRX_E2E               = 0xe9
245 246
 	DLT_JUNIPER_ST                    = 0xc8
246 247
 	DLT_JUNIPER_VP                    = 0xb7
248
+	DLT_JUNIPER_VS                    = 0xe8
247 249
 	DLT_LAPB_WITH_DIR                 = 0xcf
248 250
 	DLT_LAPD                          = 0xcb
249 251
 	DLT_LIN                           = 0xd4
252
+	DLT_LINUX_EVDEV                   = 0xd8
250 253
 	DLT_LINUX_IRDA                    = 0x90
251 254
 	DLT_LINUX_LAPD                    = 0xb1
252 255
 	DLT_LINUX_SLL                     = 0x71
253 256
 	DLT_LOOP                          = 0x6c
254 257
 	DLT_LTALK                         = 0x72
258
+	DLT_MATCHING_MAX                  = 0x109
259
+	DLT_MATCHING_MIN                  = 0x68
255 260
 	DLT_MFR                           = 0xb6
256 261
 	DLT_MOST                          = 0xd3
262
+	DLT_MPEG_2_TS                     = 0xf3
263
+	DLT_MPLS                          = 0xdb
257 264
 	DLT_MTP2                          = 0x8c
258 265
 	DLT_MTP2_WITH_PHDR                = 0x8b
259 266
 	DLT_MTP3                          = 0x8d
267
+	DLT_MUX27010                      = 0xec
268
+	DLT_NETANALYZER                   = 0xf0
269
+	DLT_NETANALYZER_TRANSPARENT       = 0xf1
270
+	DLT_NETLINK                       = 0xfd
271
+	DLT_NFC_LLCP                      = 0xf5
272
+	DLT_NFLOG                         = 0xef
273
+	DLT_NG40                          = 0xf4
260 274
 	DLT_NULL                          = 0x0
261 275
 	DLT_PCI_EXP                       = 0x7d
262 276
 	DLT_PFLOG                         = 0x75
263 277
 	DLT_PFSYNC                        = 0x12
278
+	DLT_PKTAP                         = 0x102
264 279
 	DLT_PPI                           = 0xc0
265 280
 	DLT_PPP                           = 0x9
266 281
 	DLT_PPP_BSDOS                     = 0x10
... ...
@@ -269,22 +321,51 @@ const (
269 269
 	DLT_PPP_SERIAL                    = 0x32
270 270
 	DLT_PPP_WITH_DIR                  = 0xcc
271 271
 	DLT_PRISM_HEADER                  = 0x77
272
+	DLT_PROFIBUS_DL                   = 0x101
272 273
 	DLT_PRONET                        = 0x4
273 274
 	DLT_RAIF1                         = 0xc6
274 275
 	DLT_RAW                           = 0xc
276
+	DLT_RDS                           = 0x109
275 277
 	DLT_REDBACK_SMARTEDGE             = 0x20
276 278
 	DLT_RIO                           = 0x7c
279
+	DLT_RTAC_SERIAL                   = 0xfa
277 280
 	DLT_SCCP                          = 0x8e
281
+	DLT_SCTP                          = 0xf8
278 282
 	DLT_SITA                          = 0xc4
279 283
 	DLT_SLIP                          = 0x8
280 284
 	DLT_SLIP_BSDOS                    = 0xf
285
+	DLT_STANAG_5066_D_PDU             = 0xed
281 286
 	DLT_SUNATM                        = 0x7b
282 287
 	DLT_SYMANTEC_FIREWALL             = 0x63
283 288
 	DLT_TZSP                          = 0x80
284 289
 	DLT_USB                           = 0xba
290
+	DLT_USBPCAP                       = 0xf9
291
+	DLT_USB_FREEBSD                   = 0xba
285 292
 	DLT_USB_LINUX                     = 0xbd
293
+	DLT_USB_LINUX_MMAPPED             = 0xdc
294
+	DLT_USER0                         = 0x93
295
+	DLT_USER1                         = 0x94
296
+	DLT_USER10                        = 0x9d
297
+	DLT_USER11                        = 0x9e
298
+	DLT_USER12                        = 0x9f
299
+	DLT_USER13                        = 0xa0
300
+	DLT_USER14                        = 0xa1
301
+	DLT_USER15                        = 0xa2
302
+	DLT_USER2                         = 0x95
303
+	DLT_USER3                         = 0x96
304
+	DLT_USER4                         = 0x97
305
+	DLT_USER5                         = 0x98
306
+	DLT_USER6                         = 0x99
307
+	DLT_USER7                         = 0x9a
308
+	DLT_USER8                         = 0x9b
309
+	DLT_USER9                         = 0x9c
310
+	DLT_WATTSTOPPER_DLM               = 0x107
311
+	DLT_WIHART                        = 0xdf
312
+	DLT_WIRESHARK_UPPER_PDU           = 0xfc
286 313
 	DLT_X2E_SERIAL                    = 0xd5
287 314
 	DLT_X2E_XORAYA                    = 0xd6
315
+	DLT_ZWAVE_R1_R2                   = 0x105
316
+	DLT_ZWAVE_R3                      = 0x106
288 317
 	DT_BLK                            = 0x6
289 318
 	DT_CHR                            = 0x2
290 319
 	DT_DBF                            = 0xf
... ...
@@ -323,10 +404,11 @@ const (
323 323
 	EV_EOF                            = 0x8000
324 324
 	EV_ERROR                          = 0x4000
325 325
 	EV_FLAG1                          = 0x2000
326
+	EV_HUP                            = 0x800
326 327
 	EV_NODATA                         = 0x1000
327 328
 	EV_ONESHOT                        = 0x10
328 329
 	EV_RECEIPT                        = 0x40
329
-	EV_SYSFLAGS                       = 0xf000
330
+	EV_SYSFLAGS                       = 0xf800
330 331
 	EXTA                              = 0x4b00
331 332
 	EXTB                              = 0x9600
332 333
 	EXTEXIT_LWP                       = 0x10000
... ...
@@ -365,8 +447,9 @@ const (
365 365
 	IFF_ALLMULTI                      = 0x200
366 366
 	IFF_ALTPHYS                       = 0x4000
367 367
 	IFF_BROADCAST                     = 0x2
368
-	IFF_CANTCHANGE                    = 0x118e72
368
+	IFF_CANTCHANGE                    = 0x318e72
369 369
 	IFF_DEBUG                         = 0x4
370
+	IFF_IDIRECT                       = 0x200000
370 371
 	IFF_LINK0                         = 0x1000
371 372
 	IFF_LINK1                         = 0x2000
372 373
 	IFF_LINK2                         = 0x4000
... ...
@@ -441,7 +524,6 @@ const (
441 441
 	IFT_EPLRS                         = 0x57
442 442
 	IFT_ESCON                         = 0x49
443 443
 	IFT_ETHER                         = 0x6
444
-	IFT_FAITH                         = 0xf2
445 444
 	IFT_FAST                          = 0x7d
446 445
 	IFT_FASTETHER                     = 0x3e
447 446
 	IFT_FASTETHERFX                   = 0x45
... ...
@@ -614,6 +696,7 @@ const (
614 614
 	IN_CLASSD_NET                     = 0xf0000000
615 615
 	IN_CLASSD_NSHIFT                  = 0x1c
616 616
 	IN_LOOPBACKNET                    = 0x7f
617
+	IN_RFC3021_MASK                   = 0xfffffffe
617 618
 	IPPROTO_3PC                       = 0x22
618 619
 	IPPROTO_ADFS                      = 0x44
619 620
 	IPPROTO_AH                        = 0x33
... ...
@@ -735,7 +818,6 @@ const (
735 735
 	IPV6_DEFHLIM                      = 0x40
736 736
 	IPV6_DONTFRAG                     = 0x3e
737 737
 	IPV6_DSTOPTS                      = 0x32
738
-	IPV6_FAITH                        = 0x1d
739 738
 	IPV6_FLOWINFO_MASK                = 0xffffff0f
740 739
 	IPV6_FLOWLABEL_MASK               = 0xffff0f00
741 740
 	IPV6_FRAGTTL                      = 0x78
... ...
@@ -747,7 +829,6 @@ const (
747 747
 	IPV6_HLIMDEC                      = 0x1
748 748
 	IPV6_HOPLIMIT                     = 0x2f
749 749
 	IPV6_HOPOPTS                      = 0x31
750
-	IPV6_IPSEC_POLICY                 = 0x1c
751 750
 	IPV6_JOIN_GROUP                   = 0xc
752 751
 	IPV6_LEAVE_GROUP                  = 0xd
753 752
 	IPV6_MAXHLIM                      = 0xff
... ...
@@ -795,16 +876,22 @@ const (
795 795
 	IP_DUMMYNET_DEL                   = 0x3d
796 796
 	IP_DUMMYNET_FLUSH                 = 0x3e
797 797
 	IP_DUMMYNET_GET                   = 0x40
798
-	IP_FAITH                          = 0x16
799 798
 	IP_FW_ADD                         = 0x32
800 799
 	IP_FW_DEL                         = 0x33
801 800
 	IP_FW_FLUSH                       = 0x34
802 801
 	IP_FW_GET                         = 0x36
803 802
 	IP_FW_RESETLOG                    = 0x37
803
+	IP_FW_TBL_ADD                     = 0x2a
804
+	IP_FW_TBL_CREATE                  = 0x28
805
+	IP_FW_TBL_DEL                     = 0x2b
806
+	IP_FW_TBL_DESTROY                 = 0x29
807
+	IP_FW_TBL_EXPIRE                  = 0x2f
808
+	IP_FW_TBL_FLUSH                   = 0x2c
809
+	IP_FW_TBL_GET                     = 0x2d
810
+	IP_FW_TBL_ZERO                    = 0x2e
804 811
 	IP_FW_X                           = 0x31
805 812
 	IP_FW_ZERO                        = 0x35
806 813
 	IP_HDRINCL                        = 0x2
807
-	IP_IPSEC_POLICY                   = 0x15
808 814
 	IP_MAXPACKET                      = 0xffff
809 815
 	IP_MAX_MEMBERSHIPS                = 0x14
810 816
 	IP_MF                             = 0x2000
... ...
@@ -1080,12 +1167,10 @@ const (
1080 1080
 	RTM_MISS                          = 0x7
1081 1081
 	RTM_NEWADDR                       = 0xc
1082 1082
 	RTM_NEWMADDR                      = 0xf
1083
-	RTM_OLDADD                        = 0x9
1084
-	RTM_OLDDEL                        = 0xa
1085 1083
 	RTM_REDIRECT                      = 0x6
1086 1084
 	RTM_RESOLVE                       = 0xb
1087 1085
 	RTM_RTTUNIT                       = 0xf4240
1088
-	RTM_VERSION                       = 0x6
1086
+	RTM_VERSION                       = 0x7
1089 1087
 	RTV_EXPIRE                        = 0x4
1090 1088
 	RTV_HOPCOUNT                      = 0x2
1091 1089
 	RTV_IWCAPSEGS                     = 0x400
... ...
@@ -1106,13 +1191,13 @@ const (
1106 1106
 	SHUT_RDWR                         = 0x2
1107 1107
 	SHUT_WR                           = 0x1
1108 1108
 	SIOCADDMULTI                      = 0x80206931
1109
-	SIOCADDRT                         = 0x8040720a
1110 1109
 	SIOCAIFADDR                       = 0x8040691a
1110
+	SIOCAIFGROUP                      = 0x80286987
1111 1111
 	SIOCALIFADDR                      = 0x8118691b
1112 1112
 	SIOCATMARK                        = 0x40047307
1113 1113
 	SIOCDELMULTI                      = 0x80206932
1114
-	SIOCDELRT                         = 0x8040720b
1115 1114
 	SIOCDIFADDR                       = 0x80206919
1115
+	SIOCDIFGROUP                      = 0x80286989
1116 1116
 	SIOCDIFPHYADDR                    = 0x80206949
1117 1117
 	SIOCDLIFADDR                      = 0x8118691d
1118 1118
 	SIOCGDRVSPEC                      = 0xc028697b
... ...
@@ -1120,6 +1205,7 @@ const (
1120 1120
 	SIOCGETVIFCNT                     = 0xc028720f
1121 1121
 	SIOCGHIWAT                        = 0x40047301
1122 1122
 	SIOCGIFADDR                       = 0xc0206921
1123
+	SIOCGIFALIAS                      = 0xc0406929
1123 1124
 	SIOCGIFBRDADDR                    = 0xc0206923
1124 1125
 	SIOCGIFCAP                        = 0xc020691f
1125 1126
 	SIOCGIFCONF                       = 0xc0106924
... ...
@@ -1128,6 +1214,7 @@ const (
1128 1128
 	SIOCGIFFLAGS                      = 0xc0206911
1129 1129
 	SIOCGIFGENERIC                    = 0xc020693a
1130 1130
 	SIOCGIFGMEMB                      = 0xc028698a
1131
+	SIOCGIFGROUP                      = 0xc0286988
1131 1132
 	SIOCGIFINDEX                      = 0xc0206920
1132 1133
 	SIOCGIFMEDIA                      = 0xc0306938
1133 1134
 	SIOCGIFMETRIC                     = 0xc0206917
... ...
@@ -1194,6 +1281,7 @@ const (
1194 1194
 	SO_RCVBUF                         = 0x1002
1195 1195
 	SO_RCVLOWAT                       = 0x1004
1196 1196
 	SO_RCVTIMEO                       = 0x1006
1197
+	SO_RERROR                         = 0x2000
1197 1198
 	SO_REUSEADDR                      = 0x4
1198 1199
 	SO_REUSEPORT                      = 0x200
1199 1200
 	SO_SNDBUF                         = 0x1001
... ...
@@ -1233,6 +1321,9 @@ const (
1233 1233
 	S_IXGRP                           = 0x8
1234 1234
 	S_IXOTH                           = 0x1
1235 1235
 	S_IXUSR                           = 0x40
1236
+	TAB0                              = 0x0
1237
+	TAB3                              = 0x4
1238
+	TABDLY                            = 0x4
1236 1239
 	TCIFLUSH                          = 0x1
1237 1240
 	TCIOFF                            = 0x3
1238 1241
 	TCIOFLUSH                         = 0x3
... ...
@@ -1259,6 +1350,8 @@ const (
1259 1259
 	TCP_NOPUSH                        = 0x4
1260 1260
 	TCP_SIGNATURE_ENABLE              = 0x10
1261 1261
 	TCSAFLUSH                         = 0x2
1262
+	TIMER_ABSTIME                     = 0x1
1263
+	TIMER_RELTIME                     = 0x0
1262 1264
 	TIOCCBRK                          = 0x2000747a
1263 1265
 	TIOCCDTR                          = 0x20007478
1264 1266
 	TIOCCONS                          = 0x80047462
... ...
@@ -1272,7 +1365,6 @@ const (
1272 1272
 	TIOCGETD                          = 0x4004741a
1273 1273
 	TIOCGPGRP                         = 0x40047477
1274 1274
 	TIOCGSID                          = 0x40047463
1275
-	TIOCGSIZE                         = 0x40087468
1276 1275
 	TIOCGWINSZ                        = 0x40087468
1277 1276
 	TIOCISPTMASTER                    = 0x20007455
1278 1277
 	TIOCMBIC                          = 0x8004746b
... ...
@@ -1317,7 +1409,6 @@ const (
1317 1317
 	TIOCSETD                          = 0x8004741b
1318 1318
 	TIOCSIG                           = 0x2000745f
1319 1319
 	TIOCSPGRP                         = 0x80047476
1320
-	TIOCSSIZE                         = 0x80087467
1321 1320
 	TIOCSTART                         = 0x2000746e
1322 1321
 	TIOCSTAT                          = 0x20007465
1323 1322
 	TIOCSTI                           = 0x80017472
... ...
@@ -1326,6 +1417,8 @@ const (
1326 1326
 	TIOCTIMESTAMP                     = 0x40107459
1327 1327
 	TIOCUCNTL                         = 0x80047466
1328 1328
 	TOSTOP                            = 0x400000
1329
+	UTIME_NOW                         = -0x1
1330
+	UTIME_OMIT                        = -0x2
1329 1331
 	VCHECKPT                          = 0x13
1330 1332
 	VDISCARD                          = 0xf
1331 1333
 	VDSUSP                            = 0xb
... ...
@@ -1350,9 +1443,12 @@ const (
1350 1350
 	VWERASE                           = 0x4
1351 1351
 	WCONTINUED                        = 0x4
1352 1352
 	WCOREFLAG                         = 0x80
1353
+	WEXITED                           = 0x10
1353 1354
 	WLINUXCLONE                       = 0x80000000
1354 1355
 	WNOHANG                           = 0x1
1355
-	WSTOPPED                          = 0x7f
1356
+	WNOWAIT                           = 0x8
1357
+	WSTOPPED                          = 0x2
1358
+	WTRAPPED                          = 0x20
1356 1359
 	WUNTRACED                         = 0x2
1357 1360
 )
1358 1361
 
... ...
@@ -1452,11 +1548,6 @@ const (
1452 1452
 	ETIMEDOUT       = syscall.Errno(0x3c)
1453 1453
 	ETOOMANYREFS    = syscall.Errno(0x3b)
1454 1454
 	ETXTBSY         = syscall.Errno(0x1a)
1455
-	EUNUSED94       = syscall.Errno(0x5e)
1456
-	EUNUSED95       = syscall.Errno(0x5f)
1457
-	EUNUSED96       = syscall.Errno(0x60)
1458
-	EUNUSED97       = syscall.Errno(0x61)
1459
-	EUNUSED98       = syscall.Errno(0x62)
1460 1455
 	EUSERS          = syscall.Errno(0x44)
1461 1456
 	EWOULDBLOCK     = syscall.Errno(0x23)
1462 1457
 	EXDEV           = syscall.Errno(0x12)
... ...
@@ -1600,12 +1691,7 @@ var errorList = [...]struct {
1600 1600
 	{91, "ENOLINK", "link has been severed"},
1601 1601
 	{92, "EPROTO", "protocol error"},
1602 1602
 	{93, "ENOMEDIUM", "no medium found"},
1603
-	{94, "EUNUSED94", "unknown error: 94"},
1604
-	{95, "EUNUSED95", "unknown error: 95"},
1605
-	{96, "EUNUSED96", "unknown error: 96"},
1606
-	{97, "EUNUSED97", "unknown error: 97"},
1607
-	{98, "EUNUSED98", "unknown error: 98"},
1608
-	{99, "ELAST", "unknown error: 99"},
1603
+	{99, "EASYNC", "unknown error: 99"},
1609 1604
 }
1610 1605
 
1611 1606
 // Signal table
... ...
@@ -324,6 +324,7 @@ const (
324 324
 	CAP_AUDIT_WRITE                             = 0x1d
325 325
 	CAP_BLOCK_SUSPEND                           = 0x24
326 326
 	CAP_BPF                                     = 0x27
327
+	CAP_CHECKPOINT_RESTORE                      = 0x28
327 328
 	CAP_CHOWN                                   = 0x0
328 329
 	CAP_DAC_OVERRIDE                            = 0x1
329 330
 	CAP_DAC_READ_SEARCH                         = 0x2
... ...
@@ -332,7 +333,7 @@ const (
332 332
 	CAP_IPC_LOCK                                = 0xe
333 333
 	CAP_IPC_OWNER                               = 0xf
334 334
 	CAP_KILL                                    = 0x5
335
-	CAP_LAST_CAP                                = 0x27
335
+	CAP_LAST_CAP                                = 0x28
336 336
 	CAP_LEASE                                   = 0x1c
337 337
 	CAP_LINUX_IMMUTABLE                         = 0x9
338 338
 	CAP_MAC_ADMIN                               = 0x21
... ...
@@ -650,8 +651,8 @@ const (
650 650
 	FAN_DELETE                                  = 0x200
651 651
 	FAN_DELETE_SELF                             = 0x400
652 652
 	FAN_DENY                                    = 0x2
653
-	FAN_DIR_MODIFY                              = 0x80000
654 653
 	FAN_ENABLE_AUDIT                            = 0x40
654
+	FAN_EVENT_INFO_TYPE_DFID                    = 0x3
655 655
 	FAN_EVENT_INFO_TYPE_DFID_NAME               = 0x2
656 656
 	FAN_EVENT_INFO_TYPE_FID                     = 0x1
657 657
 	FAN_EVENT_METADATA_LEN                      = 0x18
... ...
@@ -679,7 +680,10 @@ const (
679 679
 	FAN_OPEN_EXEC_PERM                          = 0x40000
680 680
 	FAN_OPEN_PERM                               = 0x10000
681 681
 	FAN_Q_OVERFLOW                              = 0x4000
682
+	FAN_REPORT_DFID_NAME                        = 0xc00
683
+	FAN_REPORT_DIR_FID                          = 0x400
682 684
 	FAN_REPORT_FID                              = 0x200
685
+	FAN_REPORT_NAME                             = 0x800
683 686
 	FAN_REPORT_TID                              = 0x100
684 687
 	FAN_UNLIMITED_MARKS                         = 0x20
685 688
 	FAN_UNLIMITED_QUEUE                         = 0x10
... ...
@@ -1508,6 +1512,92 @@ const (
1508 1508
 	PARITY_DEFAULT                              = 0x0
1509 1509
 	PARITY_NONE                                 = 0x1
1510 1510
 	PARMRK                                      = 0x8
1511
+	PERF_ATTR_SIZE_VER0                         = 0x40
1512
+	PERF_ATTR_SIZE_VER1                         = 0x48
1513
+	PERF_ATTR_SIZE_VER2                         = 0x50
1514
+	PERF_ATTR_SIZE_VER3                         = 0x60
1515
+	PERF_ATTR_SIZE_VER4                         = 0x68
1516
+	PERF_ATTR_SIZE_VER5                         = 0x70
1517
+	PERF_ATTR_SIZE_VER6                         = 0x78
1518
+	PERF_AUX_FLAG_COLLISION                     = 0x8
1519
+	PERF_AUX_FLAG_OVERWRITE                     = 0x2
1520
+	PERF_AUX_FLAG_PARTIAL                       = 0x4
1521
+	PERF_AUX_FLAG_TRUNCATED                     = 0x1
1522
+	PERF_FLAG_FD_CLOEXEC                        = 0x8
1523
+	PERF_FLAG_FD_NO_GROUP                       = 0x1
1524
+	PERF_FLAG_FD_OUTPUT                         = 0x2
1525
+	PERF_FLAG_PID_CGROUP                        = 0x4
1526
+	PERF_MAX_CONTEXTS_PER_STACK                 = 0x8
1527
+	PERF_MAX_STACK_DEPTH                        = 0x7f
1528
+	PERF_MEM_LOCK_LOCKED                        = 0x2
1529
+	PERF_MEM_LOCK_NA                            = 0x1
1530
+	PERF_MEM_LOCK_SHIFT                         = 0x18
1531
+	PERF_MEM_LVLNUM_ANY_CACHE                   = 0xb
1532
+	PERF_MEM_LVLNUM_L1                          = 0x1
1533
+	PERF_MEM_LVLNUM_L2                          = 0x2
1534
+	PERF_MEM_LVLNUM_L3                          = 0x3
1535
+	PERF_MEM_LVLNUM_L4                          = 0x4
1536
+	PERF_MEM_LVLNUM_LFB                         = 0xc
1537
+	PERF_MEM_LVLNUM_NA                          = 0xf
1538
+	PERF_MEM_LVLNUM_PMEM                        = 0xe
1539
+	PERF_MEM_LVLNUM_RAM                         = 0xd
1540
+	PERF_MEM_LVLNUM_SHIFT                       = 0x21
1541
+	PERF_MEM_LVL_HIT                            = 0x2
1542
+	PERF_MEM_LVL_IO                             = 0x1000
1543
+	PERF_MEM_LVL_L1                             = 0x8
1544
+	PERF_MEM_LVL_L2                             = 0x20
1545
+	PERF_MEM_LVL_L3                             = 0x40
1546
+	PERF_MEM_LVL_LFB                            = 0x10
1547
+	PERF_MEM_LVL_LOC_RAM                        = 0x80
1548
+	PERF_MEM_LVL_MISS                           = 0x4
1549
+	PERF_MEM_LVL_NA                             = 0x1
1550
+	PERF_MEM_LVL_REM_CCE1                       = 0x400
1551
+	PERF_MEM_LVL_REM_CCE2                       = 0x800
1552
+	PERF_MEM_LVL_REM_RAM1                       = 0x100
1553
+	PERF_MEM_LVL_REM_RAM2                       = 0x200
1554
+	PERF_MEM_LVL_SHIFT                          = 0x5
1555
+	PERF_MEM_LVL_UNC                            = 0x2000
1556
+	PERF_MEM_OP_EXEC                            = 0x10
1557
+	PERF_MEM_OP_LOAD                            = 0x2
1558
+	PERF_MEM_OP_NA                              = 0x1
1559
+	PERF_MEM_OP_PFETCH                          = 0x8
1560
+	PERF_MEM_OP_SHIFT                           = 0x0
1561
+	PERF_MEM_OP_STORE                           = 0x4
1562
+	PERF_MEM_REMOTE_REMOTE                      = 0x1
1563
+	PERF_MEM_REMOTE_SHIFT                       = 0x25
1564
+	PERF_MEM_SNOOPX_FWD                         = 0x1
1565
+	PERF_MEM_SNOOPX_SHIFT                       = 0x25
1566
+	PERF_MEM_SNOOP_HIT                          = 0x4
1567
+	PERF_MEM_SNOOP_HITM                         = 0x10
1568
+	PERF_MEM_SNOOP_MISS                         = 0x8
1569
+	PERF_MEM_SNOOP_NA                           = 0x1
1570
+	PERF_MEM_SNOOP_NONE                         = 0x2
1571
+	PERF_MEM_SNOOP_SHIFT                        = 0x13
1572
+	PERF_MEM_TLB_HIT                            = 0x2
1573
+	PERF_MEM_TLB_L1                             = 0x8
1574
+	PERF_MEM_TLB_L2                             = 0x10
1575
+	PERF_MEM_TLB_MISS                           = 0x4
1576
+	PERF_MEM_TLB_NA                             = 0x1
1577
+	PERF_MEM_TLB_OS                             = 0x40
1578
+	PERF_MEM_TLB_SHIFT                          = 0x1a
1579
+	PERF_MEM_TLB_WK                             = 0x20
1580
+	PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER        = 0x1
1581
+	PERF_RECORD_MISC_COMM_EXEC                  = 0x2000
1582
+	PERF_RECORD_MISC_CPUMODE_MASK               = 0x7
1583
+	PERF_RECORD_MISC_CPUMODE_UNKNOWN            = 0x0
1584
+	PERF_RECORD_MISC_EXACT_IP                   = 0x4000
1585
+	PERF_RECORD_MISC_EXT_RESERVED               = 0x8000
1586
+	PERF_RECORD_MISC_FORK_EXEC                  = 0x2000
1587
+	PERF_RECORD_MISC_GUEST_KERNEL               = 0x4
1588
+	PERF_RECORD_MISC_GUEST_USER                 = 0x5
1589
+	PERF_RECORD_MISC_HYPERVISOR                 = 0x3
1590
+	PERF_RECORD_MISC_KERNEL                     = 0x1
1591
+	PERF_RECORD_MISC_MMAP_DATA                  = 0x2000
1592
+	PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT     = 0x1000
1593
+	PERF_RECORD_MISC_SWITCH_OUT                 = 0x2000
1594
+	PERF_RECORD_MISC_SWITCH_OUT_PREEMPT         = 0x4000
1595
+	PERF_RECORD_MISC_USER                       = 0x2
1596
+	PERF_SAMPLE_BRANCH_PLM_ALL                  = 0x7
1511 1597
 	PIPEFS_MAGIC                                = 0x50495045
1512 1598
 	PPC_CMM_MAGIC                               = 0xc7571590
1513 1599
 	PPPIOCGNPMODE                               = 0xc008744c
... ...
@@ -1894,6 +1984,7 @@ const (
1894 1894
 	RTPROT_EIGRP                                = 0xc0
1895 1895
 	RTPROT_GATED                                = 0x8
1896 1896
 	RTPROT_ISIS                                 = 0xbb
1897
+	RTPROT_KEEPALIVED                           = 0x12
1897 1898
 	RTPROT_KERNEL                               = 0x2
1898 1899
 	RTPROT_MROUTED                              = 0x11
1899 1900
 	RTPROT_MRT                                  = 0xa
... ...
@@ -2084,6 +2175,7 @@ const (
2084 2084
 	SO_EE_ORIGIN_TXSTATUS                       = 0x4
2085 2085
 	SO_EE_ORIGIN_TXTIME                         = 0x6
2086 2086
 	SO_EE_ORIGIN_ZEROCOPY                       = 0x5
2087
+	SO_EE_RFC4884_FLAG_INVALID                  = 0x1
2087 2088
 	SO_GET_FILTER                               = 0x1a
2088 2089
 	SO_NO_CHECK                                 = 0xb
2089 2090
 	SO_PEERNAME                                 = 0x1c
... ...
@@ -2357,6 +2449,23 @@ const (
2357 2357
 	WCONTINUED                                  = 0x8
2358 2358
 	WDIOC_SETPRETIMEOUT                         = 0xc0045708
2359 2359
 	WDIOC_SETTIMEOUT                            = 0xc0045706
2360
+	WDIOF_ALARMONLY                             = 0x400
2361
+	WDIOF_CARDRESET                             = 0x20
2362
+	WDIOF_EXTERN1                               = 0x4
2363
+	WDIOF_EXTERN2                               = 0x8
2364
+	WDIOF_FANFAULT                              = 0x2
2365
+	WDIOF_KEEPALIVEPING                         = 0x8000
2366
+	WDIOF_MAGICCLOSE                            = 0x100
2367
+	WDIOF_OVERHEAT                              = 0x1
2368
+	WDIOF_POWEROVER                             = 0x40
2369
+	WDIOF_POWERUNDER                            = 0x10
2370
+	WDIOF_PRETIMEOUT                            = 0x200
2371
+	WDIOF_SETTIMEOUT                            = 0x80
2372
+	WDIOF_UNKNOWN                               = -0x1
2373
+	WDIOS_DISABLECARD                           = 0x1
2374
+	WDIOS_ENABLECARD                            = 0x2
2375
+	WDIOS_TEMPPANIC                             = 0x4
2376
+	WDIOS_UNKNOWN                               = -0x1
2360 2377
 	WEXITED                                     = 0x4
2361 2378
 	WIN_ACKMEDIACHANGE                          = 0xdb
2362 2379
 	WIN_CHECKPOWERMODE1                         = 0xe5
... ...
@@ -192,6 +192,12 @@ const (
192 192
 	CSTOPB                        = 0x40
193 193
 	CSUSP                         = 0x1a
194 194
 	CSWTCH                        = 0x1a
195
+	DIOC                          = 0x6400
196
+	DIOCGETB                      = 0x6402
197
+	DIOCGETC                      = 0x6401
198
+	DIOCGETP                      = 0x6408
199
+	DIOCSETE                      = 0x6403
200
+	DIOCSETP                      = 0x6409
195 201
 	DLT_AIRONET_HEADER            = 0x78
196 202
 	DLT_APPLE_IP_OVER_IEEE1394    = 0x8a
197 203
 	DLT_ARCNET                    = 0x7
... ...
@@ -290,6 +296,7 @@ const (
290 290
 	FF0                           = 0x0
291 291
 	FF1                           = 0x8000
292 292
 	FFDLY                         = 0x8000
293
+	FIORDCHK                      = 0x6603
293 294
 	FLUSHALL                      = 0x1
294 295
 	FLUSHDATA                     = 0x0
295 296
 	FLUSHO                        = 0x2000
... ...
@@ -645,6 +652,14 @@ const (
645 645
 	MAP_SHARED                    = 0x1
646 646
 	MAP_TEXT                      = 0x400
647 647
 	MAP_TYPE                      = 0xf
648
+	MCAST_BLOCK_SOURCE            = 0x2b
649
+	MCAST_EXCLUDE                 = 0x2
650
+	MCAST_INCLUDE                 = 0x1
651
+	MCAST_JOIN_GROUP              = 0x29
652
+	MCAST_JOIN_SOURCE_GROUP       = 0x2d
653
+	MCAST_LEAVE_GROUP             = 0x2a
654
+	MCAST_LEAVE_SOURCE_GROUP      = 0x2e
655
+	MCAST_UNBLOCK_SOURCE          = 0x2c
648 656
 	MCL_CURRENT                   = 0x1
649 657
 	MCL_FUTURE                    = 0x2
650 658
 	MSG_CTRUNC                    = 0x10
... ...
@@ -653,6 +668,7 @@ const (
653 653
 	MSG_DUPCTRL                   = 0x800
654 654
 	MSG_EOR                       = 0x8
655 655
 	MSG_MAXIOVLEN                 = 0x10
656
+	MSG_NOSIGNAL                  = 0x200
656 657
 	MSG_NOTIFICATION              = 0x100
657 658
 	MSG_OOB                       = 0x1
658 659
 	MSG_PEEK                      = 0x2
... ...
@@ -687,6 +703,7 @@ const (
687 687
 	O_APPEND                      = 0x8
688 688
 	O_CLOEXEC                     = 0x800000
689 689
 	O_CREAT                       = 0x100
690
+	O_DIRECTORY                   = 0x1000000
690 691
 	O_DSYNC                       = 0x40
691 692
 	O_EXCL                        = 0x400
692 693
 	O_EXEC                        = 0x400000
... ...
@@ -725,7 +742,7 @@ const (
725 725
 	RLIMIT_FSIZE                  = 0x1
726 726
 	RLIMIT_NOFILE                 = 0x5
727 727
 	RLIMIT_STACK                  = 0x3
728
-	RLIM_INFINITY                 = -0x3
728
+	RLIM_INFINITY                 = 0xfffffffffffffffd
729 729
 	RTAX_AUTHOR                   = 0x6
730 730
 	RTAX_BRD                      = 0x7
731 731
 	RTAX_DST                      = 0x0
... ...
@@ -1047,6 +1064,7 @@ const (
1047 1047
 	TCOON                         = 0x1
1048 1048
 	TCP_ABORT_THRESHOLD           = 0x11
1049 1049
 	TCP_ANONPRIVBIND              = 0x20
1050
+	TCP_CONGESTION                = 0x25
1050 1051
 	TCP_CONN_ABORT_THRESHOLD      = 0x13
1051 1052
 	TCP_CONN_NOTIFY_THRESHOLD     = 0x12
1052 1053
 	TCP_CORK                      = 0x18
... ...
@@ -1076,6 +1094,8 @@ const (
1076 1076
 	TCSETSF                       = 0x5410
1077 1077
 	TCSETSW                       = 0x540f
1078 1078
 	TCXONC                        = 0x5406
1079
+	TIMER_ABSTIME                 = 0x1
1080
+	TIMER_RELTIME                 = 0x0
1079 1081
 	TIOC                          = 0x5400
1080 1082
 	TIOCCBRK                      = 0x747a
1081 1083
 	TIOCCDTR                      = 0x7478
... ...
@@ -490,21 +490,6 @@ func libc_munlockall_trampoline()
490 490
 
491 491
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
492 492
 
493
-func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
494
-	_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
495
-	if e1 != 0 {
496
-		err = errnoErr(e1)
497
-	}
498
-	return
499
-}
500
-
501
-func libc_getattrlist_trampoline()
502
-
503
-//go:linkname libc_getattrlist libc_getattrlist
504
-//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib"
505
-
506
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
507
-
508 493
 func pipe() (r int, w int, err error) {
509 494
 	r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
510 495
 	r = int(r0)
... ...
@@ -1277,6 +1262,28 @@ func libc_ftruncate_trampoline()
1277 1277
 
1278 1278
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1279 1279
 
1280
+func Getcwd(buf []byte) (n int, err error) {
1281
+	var _p0 unsafe.Pointer
1282
+	if len(buf) > 0 {
1283
+		_p0 = unsafe.Pointer(&buf[0])
1284
+	} else {
1285
+		_p0 = unsafe.Pointer(&_zero)
1286
+	}
1287
+	r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0)
1288
+	n = int(r0)
1289
+	if e1 != 0 {
1290
+		err = errnoErr(e1)
1291
+	}
1292
+	return
1293
+}
1294
+
1295
+func libc_getcwd_trampoline()
1296
+
1297
+//go:linkname libc_getcwd libc_getcwd
1298
+//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
1299
+
1300
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1301
+
1280 1302
 func Getdtablesize() (size int) {
1281 1303
 	r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0)
1282 1304
 	size = int(r0)
... ...
@@ -2427,21 +2434,6 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
2427 2427
 
2428 2428
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2429 2429
 
2430
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
2431
-	_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
2432
-	if e1 != 0 {
2433
-		err = errnoErr(e1)
2434
-	}
2435
-	return
2436
-}
2437
-
2438
-func libc_ptrace_trampoline()
2439
-
2440
-//go:linkname libc_ptrace libc_ptrace
2441
-//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
2442
-
2443
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2444
-
2445 2430
 func Fstat(fd int, stat *Stat_t) (err error) {
2446 2431
 	_, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
2447 2432
 	if e1 != 0 {
... ...
@@ -2528,6 +2520,21 @@ func libc_lstat64_trampoline()
2528 2528
 
2529 2529
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2530 2530
 
2531
+func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
2532
+	_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
2533
+	if e1 != 0 {
2534
+		err = errnoErr(e1)
2535
+	}
2536
+	return
2537
+}
2538
+
2539
+func libc_ptrace_trampoline()
2540
+
2541
+//go:linkname libc_ptrace libc_ptrace
2542
+//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
2543
+
2544
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2545
+
2531 2546
 func Stat(path string, stat *Stat_t) (err error) {
2532 2547
 	var _p0 *byte
2533 2548
 	_p0, err = BytePtrFromString(path)
... ...
@@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
60 60
 	JMP	libc_munlock(SB)
61 61
 TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
62 62
 	JMP	libc_munlockall(SB)
63
-TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
64
-	JMP	libc_getattrlist(SB)
65 63
 TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
66 64
 	JMP	libc_pipe(SB)
67 65
 TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -146,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
146 146
 	JMP	libc_fsync(SB)
147 147
 TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
148 148
 	JMP	libc_ftruncate(SB)
149
+TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
150
+	JMP	libc_getcwd(SB)
149 151
 TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0
150 152
 	JMP	libc_getdtablesize(SB)
151 153
 TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -272,8 +272,6 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
272 272
 	JMP	libc_mmap(SB)
273 273
 TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
274 274
 	JMP	libc_munmap(SB)
275
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
276
-	JMP	libc_ptrace(SB)
277 275
 TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
278 276
 	JMP	libc_fstat64(SB)
279 277
 TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -284,6 +282,8 @@ TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0
284 284
 	JMP	libc_getfsstat64(SB)
285 285
 TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0
286 286
 	JMP	libc_lstat64(SB)
287
+TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
288
+	JMP	libc_ptrace(SB)
287 289
 TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0
288 290
 	JMP	libc_stat64(SB)
289 291
 TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -490,21 +490,6 @@ func libc_munlockall_trampoline()
490 490
 
491 491
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
492 492
 
493
-func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
494
-	_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
495
-	if e1 != 0 {
496
-		err = errnoErr(e1)
497
-	}
498
-	return
499
-}
500
-
501
-func libc_getattrlist_trampoline()
502
-
503
-//go:linkname libc_getattrlist libc_getattrlist
504
-//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib"
505
-
506
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
507
-
508 493
 func pipe() (r int, w int, err error) {
509 494
 	r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
510 495
 	r = int(r0)
... ...
@@ -1277,6 +1262,28 @@ func libc_ftruncate_trampoline()
1277 1277
 
1278 1278
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1279 1279
 
1280
+func Getcwd(buf []byte) (n int, err error) {
1281
+	var _p0 unsafe.Pointer
1282
+	if len(buf) > 0 {
1283
+		_p0 = unsafe.Pointer(&buf[0])
1284
+	} else {
1285
+		_p0 = unsafe.Pointer(&_zero)
1286
+	}
1287
+	r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0)
1288
+	n = int(r0)
1289
+	if e1 != 0 {
1290
+		err = errnoErr(e1)
1291
+	}
1292
+	return
1293
+}
1294
+
1295
+func libc_getcwd_trampoline()
1296
+
1297
+//go:linkname libc_getcwd libc_getcwd
1298
+//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
1299
+
1300
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1301
+
1280 1302
 func Getdtablesize() (size int) {
1281 1303
 	r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0)
1282 1304
 	size = int(r0)
... ...
@@ -2427,21 +2434,6 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
2427 2427
 
2428 2428
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2429 2429
 
2430
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
2431
-	_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
2432
-	if e1 != 0 {
2433
-		err = errnoErr(e1)
2434
-	}
2435
-	return
2436
-}
2437
-
2438
-func libc_ptrace_trampoline()
2439
-
2440
-//go:linkname libc_ptrace libc_ptrace
2441
-//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
2442
-
2443
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2444
-
2445 2430
 func Fstat(fd int, stat *Stat_t) (err error) {
2446 2431
 	_, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
2447 2432
 	if e1 != 0 {
... ...
@@ -2528,6 +2520,21 @@ func libc_lstat64_trampoline()
2528 2528
 
2529 2529
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2530 2530
 
2531
+func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
2532
+	_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
2533
+	if e1 != 0 {
2534
+		err = errnoErr(e1)
2535
+	}
2536
+	return
2537
+}
2538
+
2539
+func libc_ptrace_trampoline()
2540
+
2541
+//go:linkname libc_ptrace libc_ptrace
2542
+//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
2543
+
2544
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2545
+
2531 2546
 func Stat(path string, stat *Stat_t) (err error) {
2532 2547
 	var _p0 *byte
2533 2548
 	_p0, err = BytePtrFromString(path)
... ...
@@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
60 60
 	JMP	libc_munlock(SB)
61 61
 TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
62 62
 	JMP	libc_munlockall(SB)
63
-TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
64
-	JMP	libc_getattrlist(SB)
65 63
 TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
66 64
 	JMP	libc_pipe(SB)
67 65
 TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -146,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
146 146
 	JMP	libc_fsync(SB)
147 147
 TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
148 148
 	JMP	libc_ftruncate(SB)
149
+TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
150
+	JMP	libc_getcwd(SB)
149 151
 TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0
150 152
 	JMP	libc_getdtablesize(SB)
151 153
 TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -272,8 +272,6 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
272 272
 	JMP	libc_mmap(SB)
273 273
 TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
274 274
 	JMP	libc_munmap(SB)
275
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
276
-	JMP	libc_ptrace(SB)
277 275
 TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
278 276
 	JMP	libc_fstat64(SB)
279 277
 TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -284,6 +282,8 @@ TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0
284 284
 	JMP	libc_getfsstat64(SB)
285 285
 TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0
286 286
 	JMP	libc_lstat64(SB)
287
+TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
288
+	JMP	libc_ptrace(SB)
287 289
 TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0
288 290
 	JMP	libc_stat64(SB)
289 291
 TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -490,21 +490,6 @@ func libc_munlockall_trampoline()
490 490
 
491 491
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
492 492
 
493
-func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
494
-	_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
495
-	if e1 != 0 {
496
-		err = errnoErr(e1)
497
-	}
498
-	return
499
-}
500
-
501
-func libc_getattrlist_trampoline()
502
-
503
-//go:linkname libc_getattrlist libc_getattrlist
504
-//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib"
505
-
506
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
507
-
508 493
 func pipe() (r int, w int, err error) {
509 494
 	r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
510 495
 	r = int(r0)
... ...
@@ -1277,6 +1262,28 @@ func libc_ftruncate_trampoline()
1277 1277
 
1278 1278
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1279 1279
 
1280
+func Getcwd(buf []byte) (n int, err error) {
1281
+	var _p0 unsafe.Pointer
1282
+	if len(buf) > 0 {
1283
+		_p0 = unsafe.Pointer(&buf[0])
1284
+	} else {
1285
+		_p0 = unsafe.Pointer(&_zero)
1286
+	}
1287
+	r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0)
1288
+	n = int(r0)
1289
+	if e1 != 0 {
1290
+		err = errnoErr(e1)
1291
+	}
1292
+	return
1293
+}
1294
+
1295
+func libc_getcwd_trampoline()
1296
+
1297
+//go:linkname libc_getcwd libc_getcwd
1298
+//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
1299
+
1300
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1301
+
1280 1302
 func Getdtablesize() (size int) {
1281 1303
 	r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0)
1282 1304
 	size = int(r0)
... ...
@@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
60 60
 	JMP	libc_munlock(SB)
61 61
 TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
62 62
 	JMP	libc_munlockall(SB)
63
-TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
64
-	JMP	libc_getattrlist(SB)
65 63
 TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
66 64
 	JMP	libc_pipe(SB)
67 65
 TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -146,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
146 146
 	JMP	libc_fsync(SB)
147 147
 TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
148 148
 	JMP	libc_ftruncate(SB)
149
+TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
150
+	JMP	libc_getcwd(SB)
149 151
 TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0
150 152
 	JMP	libc_getdtablesize(SB)
151 153
 TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -490,21 +490,6 @@ func libc_munlockall_trampoline()
490 490
 
491 491
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
492 492
 
493
-func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
494
-	_, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
495
-	if e1 != 0 {
496
-		err = errnoErr(e1)
497
-	}
498
-	return
499
-}
500
-
501
-func libc_getattrlist_trampoline()
502
-
503
-//go:linkname libc_getattrlist libc_getattrlist
504
-//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib"
505
-
506
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
507
-
508 493
 func pipe() (r int, w int, err error) {
509 494
 	r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
510 495
 	r = int(r0)
... ...
@@ -1277,6 +1262,28 @@ func libc_ftruncate_trampoline()
1277 1277
 
1278 1278
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1279 1279
 
1280
+func Getcwd(buf []byte) (n int, err error) {
1281
+	var _p0 unsafe.Pointer
1282
+	if len(buf) > 0 {
1283
+		_p0 = unsafe.Pointer(&buf[0])
1284
+	} else {
1285
+		_p0 = unsafe.Pointer(&_zero)
1286
+	}
1287
+	r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0)
1288
+	n = int(r0)
1289
+	if e1 != 0 {
1290
+		err = errnoErr(e1)
1291
+	}
1292
+	return
1293
+}
1294
+
1295
+func libc_getcwd_trampoline()
1296
+
1297
+//go:linkname libc_getcwd libc_getcwd
1298
+//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
1299
+
1300
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
1301
+
1280 1302
 func Getdtablesize() (size int) {
1281 1303
 	r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0)
1282 1304
 	size = int(r0)
... ...
@@ -2513,6 +2520,21 @@ func libc_lstat_trampoline()
2513 2513
 
2514 2514
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2515 2515
 
2516
+func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
2517
+	_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
2518
+	if e1 != 0 {
2519
+		err = errnoErr(e1)
2520
+	}
2521
+	return
2522
+}
2523
+
2524
+func libc_ptrace_trampoline()
2525
+
2526
+//go:linkname libc_ptrace libc_ptrace
2527
+//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
2528
+
2529
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2530
+
2516 2531
 func Stat(path string, stat *Stat_t) (err error) {
2517 2532
 	var _p0 *byte
2518 2533
 	_p0, err = BytePtrFromString(path)
... ...
@@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
60 60
 	JMP	libc_munlock(SB)
61 61
 TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
62 62
 	JMP	libc_munlockall(SB)
63
-TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
64
-	JMP	libc_getattrlist(SB)
65 63
 TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
66 64
 	JMP	libc_pipe(SB)
67 65
 TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -146,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
146 146
 	JMP	libc_fsync(SB)
147 147
 TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
148 148
 	JMP	libc_ftruncate(SB)
149
+TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
150
+	JMP	libc_getcwd(SB)
149 151
 TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0
150 152
 	JMP	libc_getdtablesize(SB)
151 153
 TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -282,6 +282,8 @@ TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
282 282
 	JMP	libc_getfsstat(SB)
283 283
 TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0
284 284
 	JMP	libc_lstat(SB)
285
+TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
286
+	JMP	libc_ptrace(SB)
285 287
 TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0
286 288
 	JMP	libc_stat(SB)
287 289
 TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0
... ...
@@ -214,22 +214,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne
214 214
 
215 215
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
216 216
 
217
-func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
218
-	var _p0 unsafe.Pointer
219
-	if len(mib) > 0 {
220
-		_p0 = unsafe.Pointer(&mib[0])
221
-	} else {
222
-		_p0 = unsafe.Pointer(&_zero)
223
-	}
224
-	_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
225
-	if e1 != 0 {
226
-		err = errnoErr(e1)
227
-	}
228
-	return
229
-}
230
-
231
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
232
-
233 217
 func utimes(path string, timeval *[2]Timeval) (err error) {
234 218
 	var _p0 *byte
235 219
 	_p0, err = BytePtrFromString(path)
... ...
@@ -439,6 +423,22 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
439 439
 
440 440
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
441 441
 
442
+func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
443
+	var _p0 unsafe.Pointer
444
+	if len(mib) > 0 {
445
+		_p0 = unsafe.Pointer(&mib[0])
446
+	} else {
447
+		_p0 = unsafe.Pointer(&_zero)
448
+	}
449
+	_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
450
+	if e1 != 0 {
451
+		err = errnoErr(e1)
452
+	}
453
+	return
454
+}
455
+
456
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
457
+
442 458
 func Access(path string, mode uint32) (err error) {
443 459
 	var _p0 *byte
444 460
 	_p0, err = BytePtrFromString(path)
... ...
@@ -6,129 +6,125 @@
6 6
 package unix
7 7
 
8 8
 const (
9
-	// SYS_NOSYS = 0;  // { int nosys(void); } syscall nosys_args int
10
-	SYS_EXIT          = 1   // { void exit(int rval); }
11
-	SYS_FORK          = 2   // { int fork(void); }
12
-	SYS_READ          = 3   // { ssize_t read(int fd, void *buf, size_t nbyte); }
13
-	SYS_WRITE         = 4   // { ssize_t write(int fd, const void *buf, size_t nbyte); }
14
-	SYS_OPEN          = 5   // { int open(char *path, int flags, int mode); }
15
-	SYS_CLOSE         = 6   // { int close(int fd); }
16
-	SYS_WAIT4         = 7   // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int
17
-	SYS_LINK          = 9   // { int link(char *path, char *link); }
18
-	SYS_UNLINK        = 10  // { int unlink(char *path); }
19
-	SYS_CHDIR         = 12  // { int chdir(char *path); }
20
-	SYS_FCHDIR        = 13  // { int fchdir(int fd); }
21
-	SYS_MKNOD         = 14  // { int mknod(char *path, int mode, int dev); }
22
-	SYS_CHMOD         = 15  // { int chmod(char *path, int mode); }
23
-	SYS_CHOWN         = 16  // { int chown(char *path, int uid, int gid); }
24
-	SYS_OBREAK        = 17  // { int obreak(char *nsize); } break obreak_args int
25
-	SYS_GETFSSTAT     = 18  // { int getfsstat(struct statfs *buf, long bufsize, int flags); }
26
-	SYS_GETPID        = 20  // { pid_t getpid(void); }
27
-	SYS_MOUNT         = 21  // { int mount(char *type, char *path, int flags, caddr_t data); }
28
-	SYS_UNMOUNT       = 22  // { int unmount(char *path, int flags); }
29
-	SYS_SETUID        = 23  // { int setuid(uid_t uid); }
30
-	SYS_GETUID        = 24  // { uid_t getuid(void); }
31
-	SYS_GETEUID       = 25  // { uid_t geteuid(void); }
32
-	SYS_PTRACE        = 26  // { int ptrace(int req, pid_t pid, caddr_t addr, int data); }
33
-	SYS_RECVMSG       = 27  // { int recvmsg(int s, struct msghdr *msg, int flags); }
34
-	SYS_SENDMSG       = 28  // { int sendmsg(int s, caddr_t msg, int flags); }
35
-	SYS_RECVFROM      = 29  // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); }
36
-	SYS_ACCEPT        = 30  // { int accept(int s, caddr_t name, int *anamelen); }
37
-	SYS_GETPEERNAME   = 31  // { int getpeername(int fdes, caddr_t asa, int *alen); }
38
-	SYS_GETSOCKNAME   = 32  // { int getsockname(int fdes, caddr_t asa, int *alen); }
39
-	SYS_ACCESS        = 33  // { int access(char *path, int flags); }
40
-	SYS_CHFLAGS       = 34  // { int chflags(char *path, int flags); }
41
-	SYS_FCHFLAGS      = 35  // { int fchflags(int fd, int flags); }
42
-	SYS_SYNC          = 36  // { int sync(void); }
43
-	SYS_KILL          = 37  // { int kill(int pid, int signum); }
44
-	SYS_GETPPID       = 39  // { pid_t getppid(void); }
45
-	SYS_DUP           = 41  // { int dup(int fd); }
46
-	SYS_PIPE          = 42  // { int pipe(void); }
47
-	SYS_GETEGID       = 43  // { gid_t getegid(void); }
48
-	SYS_PROFIL        = 44  // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); }
49
-	SYS_KTRACE        = 45  // { int ktrace(const char *fname, int ops, int facs, int pid); }
50
-	SYS_GETGID        = 47  // { gid_t getgid(void); }
51
-	SYS_GETLOGIN      = 49  // { int getlogin(char *namebuf, u_int namelen); }
52
-	SYS_SETLOGIN      = 50  // { int setlogin(char *namebuf); }
53
-	SYS_ACCT          = 51  // { int acct(char *path); }
54
-	SYS_SIGALTSTACK   = 53  // { int sigaltstack(stack_t *ss, stack_t *oss); }
55
-	SYS_IOCTL         = 54  // { int ioctl(int fd, u_long com, caddr_t data); }
56
-	SYS_REBOOT        = 55  // { int reboot(int opt); }
57
-	SYS_REVOKE        = 56  // { int revoke(char *path); }
58
-	SYS_SYMLINK       = 57  // { int symlink(char *path, char *link); }
59
-	SYS_READLINK      = 58  // { int readlink(char *path, char *buf, int count); }
60
-	SYS_EXECVE        = 59  // { int execve(char *fname, char **argv, char **envv); }
61
-	SYS_UMASK         = 60  // { int umask(int newmask); } umask umask_args int
62
-	SYS_CHROOT        = 61  // { int chroot(char *path); }
63
-	SYS_MSYNC         = 65  // { int msync(void *addr, size_t len, int flags); }
64
-	SYS_VFORK         = 66  // { pid_t vfork(void); }
65
-	SYS_SBRK          = 69  // { int sbrk(int incr); }
66
-	SYS_SSTK          = 70  // { int sstk(int incr); }
67
-	SYS_MUNMAP        = 73  // { int munmap(void *addr, size_t len); }
68
-	SYS_MPROTECT      = 74  // { int mprotect(void *addr, size_t len, int prot); }
69
-	SYS_MADVISE       = 75  // { int madvise(void *addr, size_t len, int behav); }
70
-	SYS_MINCORE       = 78  // { int mincore(const void *addr, size_t len, char *vec); }
71
-	SYS_GETGROUPS     = 79  // { int getgroups(u_int gidsetsize, gid_t *gidset); }
72
-	SYS_SETGROUPS     = 80  // { int setgroups(u_int gidsetsize, gid_t *gidset); }
73
-	SYS_GETPGRP       = 81  // { int getpgrp(void); }
74
-	SYS_SETPGID       = 82  // { int setpgid(int pid, int pgid); }
75
-	SYS_SETITIMER     = 83  // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); }
76
-	SYS_SWAPON        = 85  // { int swapon(char *name); }
77
-	SYS_GETITIMER     = 86  // { int getitimer(u_int which, struct itimerval *itv); }
78
-	SYS_GETDTABLESIZE = 89  // { int getdtablesize(void); }
79
-	SYS_DUP2          = 90  // { int dup2(int from, int to); }
80
-	SYS_FCNTL         = 92  // { int fcntl(int fd, int cmd, long arg); }
81
-	SYS_SELECT        = 93  // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
82
-	SYS_FSYNC         = 95  // { int fsync(int fd); }
83
-	SYS_SETPRIORITY   = 96  // { int setpriority(int which, int who, int prio); }
84
-	SYS_SOCKET        = 97  // { int socket(int domain, int type, int protocol); }
85
-	SYS_CONNECT       = 98  // { int connect(int s, caddr_t name, int namelen); }
86
-	SYS_GETPRIORITY   = 100 // { int getpriority(int which, int who); }
87
-	SYS_BIND          = 104 // { int bind(int s, caddr_t name, int namelen); }
88
-	SYS_SETSOCKOPT    = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); }
89
-	SYS_LISTEN        = 106 // { int listen(int s, int backlog); }
90
-	SYS_GETTIMEOFDAY  = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); }
91
-	SYS_GETRUSAGE     = 117 // { int getrusage(int who, struct rusage *rusage); }
92
-	SYS_GETSOCKOPT    = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); }
93
-	SYS_READV         = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); }
94
-	SYS_WRITEV        = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); }
95
-	SYS_SETTIMEOFDAY  = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); }
96
-	SYS_FCHOWN        = 123 // { int fchown(int fd, int uid, int gid); }
97
-	SYS_FCHMOD        = 124 // { int fchmod(int fd, int mode); }
98
-	SYS_SETREUID      = 126 // { int setreuid(int ruid, int euid); }
99
-	SYS_SETREGID      = 127 // { int setregid(int rgid, int egid); }
100
-	SYS_RENAME        = 128 // { int rename(char *from, char *to); }
101
-	SYS_FLOCK         = 131 // { int flock(int fd, int how); }
102
-	SYS_MKFIFO        = 132 // { int mkfifo(char *path, int mode); }
103
-	SYS_SENDTO        = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); }
104
-	SYS_SHUTDOWN      = 134 // { int shutdown(int s, int how); }
105
-	SYS_SOCKETPAIR    = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); }
106
-	SYS_MKDIR         = 136 // { int mkdir(char *path, int mode); }
107
-	SYS_RMDIR         = 137 // { int rmdir(char *path); }
108
-	SYS_UTIMES        = 138 // { int utimes(char *path, struct timeval *tptr); }
109
-	SYS_ADJTIME       = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); }
110
-	SYS_SETSID        = 147 // { int setsid(void); }
111
-	SYS_QUOTACTL      = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); }
112
-	SYS_STATFS        = 157 // { int statfs(char *path, struct statfs *buf); }
113
-	SYS_FSTATFS       = 158 // { int fstatfs(int fd, struct statfs *buf); }
114
-	SYS_GETFH         = 161 // { int getfh(char *fname, struct fhandle *fhp); }
115
-	SYS_GETDOMAINNAME = 162 // { int getdomainname(char *domainname, int len); }
116
-	SYS_SETDOMAINNAME = 163 // { int setdomainname(char *domainname, int len); }
117
-	SYS_UNAME         = 164 // { int uname(struct utsname *name); }
118
-	SYS_SYSARCH       = 165 // { int sysarch(int op, char *parms); }
119
-	SYS_RTPRIO        = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); }
120
-	SYS_EXTPREAD      = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); }
121
-	SYS_EXTPWRITE     = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); }
122
-	SYS_NTP_ADJTIME   = 176 // { int ntp_adjtime(struct timex *tp); }
123
-	SYS_SETGID        = 181 // { int setgid(gid_t gid); }
124
-	SYS_SETEGID       = 182 // { int setegid(gid_t egid); }
125
-	SYS_SETEUID       = 183 // { int seteuid(uid_t euid); }
126
-	SYS_PATHCONF      = 191 // { int pathconf(char *path, int name); }
127
-	SYS_FPATHCONF     = 192 // { int fpathconf(int fd, int name); }
128
-	SYS_GETRLIMIT     = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int
129
-	SYS_SETRLIMIT     = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int
130
-	SYS_MMAP          = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); }
131
-	// SYS_NOSYS = 198;  // { int nosys(void); } __syscall __syscall_args int
9
+	SYS_EXIT  = 1 // { void exit(int rval); }
10
+	SYS_FORK  = 2 // { int fork(void); }
11
+	SYS_READ  = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); }
12
+	SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); }
13
+	SYS_OPEN  = 5 // { int open(char *path, int flags, int mode); }
14
+	SYS_CLOSE = 6 // { int close(int fd); }
15
+	SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int
16
+	// SYS_NOSYS = 8;  // { int nosys(void); } __nosys nosys_args int
17
+	SYS_LINK                   = 9   // { int link(char *path, char *link); }
18
+	SYS_UNLINK                 = 10  // { int unlink(char *path); }
19
+	SYS_CHDIR                  = 12  // { int chdir(char *path); }
20
+	SYS_FCHDIR                 = 13  // { int fchdir(int fd); }
21
+	SYS_MKNOD                  = 14  // { int mknod(char *path, int mode, int dev); }
22
+	SYS_CHMOD                  = 15  // { int chmod(char *path, int mode); }
23
+	SYS_CHOWN                  = 16  // { int chown(char *path, int uid, int gid); }
24
+	SYS_OBREAK                 = 17  // { int obreak(char *nsize); } break obreak_args int
25
+	SYS_GETFSSTAT              = 18  // { int getfsstat(struct statfs *buf, long bufsize, int flags); }
26
+	SYS_GETPID                 = 20  // { pid_t getpid(void); }
27
+	SYS_MOUNT                  = 21  // { int mount(char *type, char *path, int flags, caddr_t data); }
28
+	SYS_UNMOUNT                = 22  // { int unmount(char *path, int flags); }
29
+	SYS_SETUID                 = 23  // { int setuid(uid_t uid); }
30
+	SYS_GETUID                 = 24  // { uid_t getuid(void); }
31
+	SYS_GETEUID                = 25  // { uid_t geteuid(void); }
32
+	SYS_PTRACE                 = 26  // { int ptrace(int req, pid_t pid, caddr_t addr, int data); }
33
+	SYS_RECVMSG                = 27  // { int recvmsg(int s, struct msghdr *msg, int flags); }
34
+	SYS_SENDMSG                = 28  // { int sendmsg(int s, caddr_t msg, int flags); }
35
+	SYS_RECVFROM               = 29  // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); }
36
+	SYS_ACCEPT                 = 30  // { int accept(int s, caddr_t name, int *anamelen); }
37
+	SYS_GETPEERNAME            = 31  // { int getpeername(int fdes, caddr_t asa, int *alen); }
38
+	SYS_GETSOCKNAME            = 32  // { int getsockname(int fdes, caddr_t asa, int *alen); }
39
+	SYS_ACCESS                 = 33  // { int access(char *path, int flags); }
40
+	SYS_CHFLAGS                = 34  // { int chflags(const char *path, u_long flags); }
41
+	SYS_FCHFLAGS               = 35  // { int fchflags(int fd, u_long flags); }
42
+	SYS_SYNC                   = 36  // { int sync(void); }
43
+	SYS_KILL                   = 37  // { int kill(int pid, int signum); }
44
+	SYS_GETPPID                = 39  // { pid_t getppid(void); }
45
+	SYS_DUP                    = 41  // { int dup(int fd); }
46
+	SYS_PIPE                   = 42  // { int pipe(void); }
47
+	SYS_GETEGID                = 43  // { gid_t getegid(void); }
48
+	SYS_PROFIL                 = 44  // { int profil(caddr_t samples, size_t size, u_long offset, u_int scale); }
49
+	SYS_KTRACE                 = 45  // { int ktrace(const char *fname, int ops, int facs, int pid); }
50
+	SYS_GETGID                 = 47  // { gid_t getgid(void); }
51
+	SYS_GETLOGIN               = 49  // { int getlogin(char *namebuf, size_t namelen); }
52
+	SYS_SETLOGIN               = 50  // { int setlogin(char *namebuf); }
53
+	SYS_ACCT                   = 51  // { int acct(char *path); }
54
+	SYS_SIGALTSTACK            = 53  // { int sigaltstack(stack_t *ss, stack_t *oss); }
55
+	SYS_IOCTL                  = 54  // { int ioctl(int fd, u_long com, caddr_t data); }
56
+	SYS_REBOOT                 = 55  // { int reboot(int opt); }
57
+	SYS_REVOKE                 = 56  // { int revoke(char *path); }
58
+	SYS_SYMLINK                = 57  // { int symlink(char *path, char *link); }
59
+	SYS_READLINK               = 58  // { int readlink(char *path, char *buf, int count); }
60
+	SYS_EXECVE                 = 59  // { int execve(char *fname, char **argv, char **envv); }
61
+	SYS_UMASK                  = 60  // { int umask(int newmask); } umask umask_args int
62
+	SYS_CHROOT                 = 61  // { int chroot(char *path); }
63
+	SYS_MSYNC                  = 65  // { int msync(void *addr, size_t len, int flags); }
64
+	SYS_VFORK                  = 66  // { pid_t vfork(void); }
65
+	SYS_SBRK                   = 69  // { caddr_t sbrk(size_t incr); }
66
+	SYS_SSTK                   = 70  // { int sstk(size_t incr); }
67
+	SYS_MUNMAP                 = 73  // { int munmap(void *addr, size_t len); }
68
+	SYS_MPROTECT               = 74  // { int mprotect(void *addr, size_t len, int prot); }
69
+	SYS_MADVISE                = 75  // { int madvise(void *addr, size_t len, int behav); }
70
+	SYS_MINCORE                = 78  // { int mincore(const void *addr, size_t len, char *vec); }
71
+	SYS_GETGROUPS              = 79  // { int getgroups(u_int gidsetsize, gid_t *gidset); }
72
+	SYS_SETGROUPS              = 80  // { int setgroups(u_int gidsetsize, gid_t *gidset); }
73
+	SYS_GETPGRP                = 81  // { int getpgrp(void); }
74
+	SYS_SETPGID                = 82  // { int setpgid(int pid, int pgid); }
75
+	SYS_SETITIMER              = 83  // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); }
76
+	SYS_SWAPON                 = 85  // { int swapon(char *name); }
77
+	SYS_GETITIMER              = 86  // { int getitimer(u_int which, struct itimerval *itv); }
78
+	SYS_GETDTABLESIZE          = 89  // { int getdtablesize(void); }
79
+	SYS_DUP2                   = 90  // { int dup2(int from, int to); }
80
+	SYS_FCNTL                  = 92  // { int fcntl(int fd, int cmd, long arg); }
81
+	SYS_SELECT                 = 93  // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
82
+	SYS_FSYNC                  = 95  // { int fsync(int fd); }
83
+	SYS_SETPRIORITY            = 96  // { int setpriority(int which, int who, int prio); }
84
+	SYS_SOCKET                 = 97  // { int socket(int domain, int type, int protocol); }
85
+	SYS_CONNECT                = 98  // { int connect(int s, caddr_t name, int namelen); }
86
+	SYS_GETPRIORITY            = 100 // { int getpriority(int which, int who); }
87
+	SYS_BIND                   = 104 // { int bind(int s, caddr_t name, int namelen); }
88
+	SYS_SETSOCKOPT             = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); }
89
+	SYS_LISTEN                 = 106 // { int listen(int s, int backlog); }
90
+	SYS_GETTIMEOFDAY           = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); }
91
+	SYS_GETRUSAGE              = 117 // { int getrusage(int who, struct rusage *rusage); }
92
+	SYS_GETSOCKOPT             = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); }
93
+	SYS_READV                  = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); }
94
+	SYS_WRITEV                 = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); }
95
+	SYS_SETTIMEOFDAY           = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); }
96
+	SYS_FCHOWN                 = 123 // { int fchown(int fd, int uid, int gid); }
97
+	SYS_FCHMOD                 = 124 // { int fchmod(int fd, int mode); }
98
+	SYS_SETREUID               = 126 // { int setreuid(int ruid, int euid); }
99
+	SYS_SETREGID               = 127 // { int setregid(int rgid, int egid); }
100
+	SYS_RENAME                 = 128 // { int rename(char *from, char *to); }
101
+	SYS_FLOCK                  = 131 // { int flock(int fd, int how); }
102
+	SYS_MKFIFO                 = 132 // { int mkfifo(char *path, int mode); }
103
+	SYS_SENDTO                 = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); }
104
+	SYS_SHUTDOWN               = 134 // { int shutdown(int s, int how); }
105
+	SYS_SOCKETPAIR             = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); }
106
+	SYS_MKDIR                  = 136 // { int mkdir(char *path, int mode); }
107
+	SYS_RMDIR                  = 137 // { int rmdir(char *path); }
108
+	SYS_UTIMES                 = 138 // { int utimes(char *path, struct timeval *tptr); }
109
+	SYS_ADJTIME                = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); }
110
+	SYS_SETSID                 = 147 // { int setsid(void); }
111
+	SYS_QUOTACTL               = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); }
112
+	SYS_STATFS                 = 157 // { int statfs(char *path, struct statfs *buf); }
113
+	SYS_FSTATFS                = 158 // { int fstatfs(int fd, struct statfs *buf); }
114
+	SYS_GETFH                  = 161 // { int getfh(char *fname, struct fhandle *fhp); }
115
+	SYS_SYSARCH                = 165 // { int sysarch(int op, char *parms); }
116
+	SYS_RTPRIO                 = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); }
117
+	SYS_EXTPREAD               = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); }
118
+	SYS_EXTPWRITE              = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); }
119
+	SYS_NTP_ADJTIME            = 176 // { int ntp_adjtime(struct timex *tp); }
120
+	SYS_SETGID                 = 181 // { int setgid(gid_t gid); }
121
+	SYS_SETEGID                = 182 // { int setegid(gid_t egid); }
122
+	SYS_SETEUID                = 183 // { int seteuid(uid_t euid); }
123
+	SYS_PATHCONF               = 191 // { int pathconf(char *path, int name); }
124
+	SYS_FPATHCONF              = 192 // { int fpathconf(int fd, int name); }
125
+	SYS_GETRLIMIT              = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int
126
+	SYS_SETRLIMIT              = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int
127
+	SYS_MMAP                   = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); }
132 128
 	SYS_LSEEK                  = 199 // { off_t lseek(int fd, int pad, off_t offset, int whence); }
133 129
 	SYS_TRUNCATE               = 200 // { int truncate(char *path, int pad, off_t length); }
134 130
 	SYS_FTRUNCATE              = 201 // { int ftruncate(int fd, int pad, off_t length); }
... ...
@@ -161,8 +157,8 @@ const (
161 161
 	SYS_LCHOWN                 = 254 // { int lchown(char *path, int uid, int gid); }
162 162
 	SYS_LCHMOD                 = 274 // { int lchmod(char *path, mode_t mode); }
163 163
 	SYS_LUTIMES                = 276 // { int lutimes(char *path, struct timeval *tptr); }
164
-	SYS_EXTPREADV              = 289 // { ssize_t extpreadv(int fd, struct iovec *iovp, u_int iovcnt, int flags, off_t offset); }
165
-	SYS_EXTPWRITEV             = 290 // { ssize_t extpwritev(int fd, struct iovec *iovp,u_int iovcnt, int flags, off_t offset); }
164
+	SYS_EXTPREADV              = 289 // { ssize_t extpreadv(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); }
165
+	SYS_EXTPWRITEV             = 290 // { ssize_t extpwritev(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); }
166 166
 	SYS_FHSTATFS               = 297 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); }
167 167
 	SYS_FHOPEN                 = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); }
168 168
 	SYS_MODNEXT                = 300 // { int modnext(int modid); }
... ...
@@ -225,7 +221,7 @@ const (
225 225
 	SYS_KQUEUE                 = 362 // { int kqueue(void); }
226 226
 	SYS_KEVENT                 = 363 // { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
227 227
 	SYS_KENV                   = 390 // { int kenv(int what, const char *name, char *value, int len); }
228
-	SYS_LCHFLAGS               = 391 // { int lchflags(char *path, int flags); }
228
+	SYS_LCHFLAGS               = 391 // { int lchflags(const char *path, u_long flags); }
229 229
 	SYS_UUIDGEN                = 392 // { int uuidgen(struct uuid *store, int count); }
230 230
 	SYS_SENDFILE               = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
231 231
 	SYS_VARSYM_SET             = 450 // { int varsym_set(int level, const char *name, const char *data); }
... ...
@@ -302,7 +298,7 @@ const (
302 302
 	SYS_VMM_GUEST_CTL          = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); }
303 303
 	SYS_VMM_GUEST_SYNC_ADDR    = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); }
304 304
 	SYS_PROCCTL                = 536 // { int procctl(idtype_t idtype, id_t id, int cmd, void *data); }
305
-	SYS_CHFLAGSAT              = 537 // { int chflagsat(int fd, const char *path, int flags, int atflags);}
305
+	SYS_CHFLAGSAT              = 537 // { int chflagsat(int fd, const char *path, u_long flags, int atflags);}
306 306
 	SYS_PIPE2                  = 538 // { int pipe2(int *fildes, int flags); }
307 307
 	SYS_UTIMENSAT              = 539 // { int utimensat(int fd, const char *path, const struct timespec *ts, int flags); }
308 308
 	SYS_FUTIMENS               = 540 // { int futimens(int fd, const struct timespec *ts); }
... ...
@@ -312,4 +308,9 @@ const (
312 312
 	SYS_LWP_SETAFFINITY        = 544 // { int lwp_setaffinity(pid_t pid, lwpid_t tid, const cpumask_t *mask); }
313 313
 	SYS_LWP_GETAFFINITY        = 545 // { int lwp_getaffinity(pid_t pid, lwpid_t tid, cpumask_t *mask); }
314 314
 	SYS_LWP_CREATE2            = 546 // { int lwp_create2(struct lwp_params *params, const cpumask_t *mask); }
315
+	SYS_GETCPUCLOCKID          = 547 // { int getcpuclockid(pid_t pid, lwpid_t lwp_id, clockid_t *clock_id); }
316
+	SYS_WAIT6                  = 548 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); }
317
+	SYS_LWP_GETNAME            = 549 // { int lwp_getname(lwpid_t tid, char *name, size_t len); }
318
+	SYS_GETRANDOM              = 550 // { ssize_t getrandom(void *buf, size_t len, unsigned flags); }
319
+	SYS___REALPATH             = 551 // { ssize_t __realpath(const char *path, char *buf, size_t len); }
315 320
 )
... ...
@@ -431,6 +431,7 @@ const (
431 431
 	SYS_FSPICK                       = 433
432 432
 	SYS_PIDFD_OPEN                   = 434
433 433
 	SYS_CLONE3                       = 435
434
+	SYS_CLOSE_RANGE                  = 436
434 435
 	SYS_OPENAT2                      = 437
435 436
 	SYS_PIDFD_GETFD                  = 438
436 437
 	SYS_FACCESSAT2                   = 439
... ...
@@ -353,6 +353,7 @@ const (
353 353
 	SYS_FSPICK                 = 433
354 354
 	SYS_PIDFD_OPEN             = 434
355 355
 	SYS_CLONE3                 = 435
356
+	SYS_CLOSE_RANGE            = 436
356 357
 	SYS_OPENAT2                = 437
357 358
 	SYS_PIDFD_GETFD            = 438
358 359
 	SYS_FACCESSAT2             = 439
... ...
@@ -395,6 +395,7 @@ const (
395 395
 	SYS_FSPICK                       = 433
396 396
 	SYS_PIDFD_OPEN                   = 434
397 397
 	SYS_CLONE3                       = 435
398
+	SYS_CLOSE_RANGE                  = 436
398 399
 	SYS_OPENAT2                      = 437
399 400
 	SYS_PIDFD_GETFD                  = 438
400 401
 	SYS_FACCESSAT2                   = 439
... ...
@@ -298,6 +298,7 @@ const (
298 298
 	SYS_FSPICK                 = 433
299 299
 	SYS_PIDFD_OPEN             = 434
300 300
 	SYS_CLONE3                 = 435
301
+	SYS_CLOSE_RANGE            = 436
301 302
 	SYS_OPENAT2                = 437
302 303
 	SYS_PIDFD_GETFD            = 438
303 304
 	SYS_FACCESSAT2             = 439
... ...
@@ -416,6 +416,7 @@ const (
416 416
 	SYS_FSPICK                       = 4433
417 417
 	SYS_PIDFD_OPEN                   = 4434
418 418
 	SYS_CLONE3                       = 4435
419
+	SYS_CLOSE_RANGE                  = 4436
419 420
 	SYS_OPENAT2                      = 4437
420 421
 	SYS_PIDFD_GETFD                  = 4438
421 422
 	SYS_FACCESSAT2                   = 4439
... ...
@@ -346,6 +346,7 @@ const (
346 346
 	SYS_FSPICK                 = 5433
347 347
 	SYS_PIDFD_OPEN             = 5434
348 348
 	SYS_CLONE3                 = 5435
349
+	SYS_CLOSE_RANGE            = 5436
349 350
 	SYS_OPENAT2                = 5437
350 351
 	SYS_PIDFD_GETFD            = 5438
351 352
 	SYS_FACCESSAT2             = 5439
... ...
@@ -346,6 +346,7 @@ const (
346 346
 	SYS_FSPICK                 = 5433
347 347
 	SYS_PIDFD_OPEN             = 5434
348 348
 	SYS_CLONE3                 = 5435
349
+	SYS_CLOSE_RANGE            = 5436
349 350
 	SYS_OPENAT2                = 5437
350 351
 	SYS_PIDFD_GETFD            = 5438
351 352
 	SYS_FACCESSAT2             = 5439
... ...
@@ -416,6 +416,7 @@ const (
416 416
 	SYS_FSPICK                       = 4433
417 417
 	SYS_PIDFD_OPEN                   = 4434
418 418
 	SYS_CLONE3                       = 4435
419
+	SYS_CLOSE_RANGE                  = 4436
419 420
 	SYS_OPENAT2                      = 4437
420 421
 	SYS_PIDFD_GETFD                  = 4438
421 422
 	SYS_FACCESSAT2                   = 4439
... ...
@@ -395,6 +395,7 @@ const (
395 395
 	SYS_FSPICK                 = 433
396 396
 	SYS_PIDFD_OPEN             = 434
397 397
 	SYS_CLONE3                 = 435
398
+	SYS_CLOSE_RANGE            = 436
398 399
 	SYS_OPENAT2                = 437
399 400
 	SYS_PIDFD_GETFD            = 438
400 401
 	SYS_FACCESSAT2             = 439
... ...
@@ -395,6 +395,7 @@ const (
395 395
 	SYS_FSPICK                 = 433
396 396
 	SYS_PIDFD_OPEN             = 434
397 397
 	SYS_CLONE3                 = 435
398
+	SYS_CLOSE_RANGE            = 436
398 399
 	SYS_OPENAT2                = 437
399 400
 	SYS_PIDFD_GETFD            = 438
400 401
 	SYS_FACCESSAT2             = 439
... ...
@@ -297,6 +297,7 @@ const (
297 297
 	SYS_FSPICK                 = 433
298 298
 	SYS_PIDFD_OPEN             = 434
299 299
 	SYS_CLONE3                 = 435
300
+	SYS_CLOSE_RANGE            = 436
300 301
 	SYS_OPENAT2                = 437
301 302
 	SYS_PIDFD_GETFD            = 438
302 303
 	SYS_FACCESSAT2             = 439
... ...
@@ -360,6 +360,7 @@ const (
360 360
 	SYS_FSPICK                 = 433
361 361
 	SYS_PIDFD_OPEN             = 434
362 362
 	SYS_CLONE3                 = 435
363
+	SYS_CLOSE_RANGE            = 436
363 364
 	SYS_OPENAT2                = 437
364 365
 	SYS_PIDFD_GETFD            = 438
365 366
 	SYS_FACCESSAT2             = 439
... ...
@@ -374,6 +374,7 @@ const (
374 374
 	SYS_FSMOUNT                = 432
375 375
 	SYS_FSPICK                 = 433
376 376
 	SYS_PIDFD_OPEN             = 434
377
+	SYS_CLOSE_RANGE            = 436
377 378
 	SYS_OPENAT2                = 437
378 379
 	SYS_PIDFD_GETFD            = 438
379 380
 	SYS_FACCESSAT2             = 439
... ...
@@ -92,9 +92,9 @@ type Statfs_t struct {
92 92
 	Type        uint32
93 93
 	Flags       uint32
94 94
 	Fssubtype   uint32
95
-	Fstypename  [16]int8
96
-	Mntonname   [1024]int8
97
-	Mntfromname [1024]int8
95
+	Fstypename  [16]byte
96
+	Mntonname   [1024]byte
97
+	Mntfromname [1024]byte
98 98
 	Reserved    [8]uint32
99 99
 }
100 100
 
... ...
@@ -145,6 +145,10 @@ type Dirent struct {
145 145
 	_       [3]byte
146 146
 }
147 147
 
148
+const (
149
+	PathMax = 0x400
150
+)
151
+
148 152
 type RawSockaddrInet4 struct {
149 153
 	Len    uint8
150 154
 	Family uint8
... ...
@@ -301,7 +305,6 @@ type IfMsghdr struct {
301 301
 	Addrs   int32
302 302
 	Flags   int32
303 303
 	Index   uint16
304
-	_       [2]byte
305 304
 	Data    IfData
306 305
 }
307 306
 
... ...
@@ -344,7 +347,6 @@ type IfaMsghdr struct {
344 344
 	Addrs   int32
345 345
 	Flags   int32
346 346
 	Index   uint16
347
-	_       [2]byte
348 347
 	Metric  int32
349 348
 }
350 349
 
... ...
@@ -365,7 +367,6 @@ type IfmaMsghdr2 struct {
365 365
 	Addrs    int32
366 366
 	Flags    int32
367 367
 	Index    uint16
368
-	_        [2]byte
369 368
 	Refcount int32
370 369
 }
371 370
 
... ...
@@ -374,7 +375,6 @@ type RtMsghdr struct {
374 374
 	Version uint8
375 375
 	Type    uint8
376 376
 	Index   uint16
377
-	_       [2]byte
378 377
 	Flags   int32
379 378
 	Addrs   int32
380 379
 	Pid     int32
... ...
@@ -396,7 +396,8 @@ type RtMetrics struct {
396 396
 	Rtt      uint32
397 397
 	Rttvar   uint32
398 398
 	Pksent   uint32
399
-	Filler   [4]uint32
399
+	State    uint32
400
+	Filler   [3]uint32
400 401
 }
401 402
 
402 403
 const (
... ...
@@ -497,3 +498,8 @@ type Clockinfo struct {
497 497
 	Stathz  int32
498 498
 	Profhz  int32
499 499
 }
500
+
501
+type CtlInfo struct {
502
+	Id   uint32
503
+	Name [96]byte
504
+}
... ...
@@ -70,7 +70,6 @@ type Stat_t struct {
70 70
 	Uid     uint32
71 71
 	Gid     uint32
72 72
 	Rdev    int32
73
-	_       [4]byte
74 73
 	Atim    Timespec
75 74
 	Mtim    Timespec
76 75
 	Ctim    Timespec
... ...
@@ -97,10 +96,11 @@ type Statfs_t struct {
97 97
 	Type        uint32
98 98
 	Flags       uint32
99 99
 	Fssubtype   uint32
100
-	Fstypename  [16]int8
101
-	Mntonname   [1024]int8
102
-	Mntfromname [1024]int8
103
-	Reserved    [8]uint32
100
+	Fstypename  [16]byte
101
+	Mntonname   [1024]byte
102
+	Mntfromname [1024]byte
103
+	Flags_ext   uint32
104
+	Reserved    [7]uint32
104 105
 }
105 106
 
106 107
 type Flock_t struct {
... ...
@@ -133,8 +133,7 @@ type Fbootstraptransfer_t struct {
133 133
 
134 134
 type Log2phys_t struct {
135 135
 	Flags uint32
136
-	_     [8]byte
137
-	_     [8]byte
136
+	_     [16]byte
138 137
 }
139 138
 
140 139
 type Fsid struct {
... ...
@@ -151,6 +150,10 @@ type Dirent struct {
151 151
 	_       [3]byte
152 152
 }
153 153
 
154
+const (
155
+	PathMax = 0x400
156
+)
157
+
154 158
 type RawSockaddrInet4 struct {
155 159
 	Len    uint8
156 160
 	Family uint8
... ...
@@ -221,10 +224,8 @@ type IPv6Mreq struct {
221 221
 type Msghdr struct {
222 222
 	Name       *byte
223 223
 	Namelen    uint32
224
-	_          [4]byte
225 224
 	Iov        *Iovec
226 225
 	Iovlen     int32
227
-	_          [4]byte
228 226
 	Control    *byte
229 227
 	Controllen uint32
230 228
 	Flags      int32
... ...
@@ -309,7 +310,6 @@ type IfMsghdr struct {
309 309
 	Addrs   int32
310 310
 	Flags   int32
311 311
 	Index   uint16
312
-	_       [2]byte
313 312
 	Data    IfData
314 313
 }
315 314
 
... ...
@@ -352,7 +352,6 @@ type IfaMsghdr struct {
352 352
 	Addrs   int32
353 353
 	Flags   int32
354 354
 	Index   uint16
355
-	_       [2]byte
356 355
 	Metric  int32
357 356
 }
358 357
 
... ...
@@ -373,7 +372,6 @@ type IfmaMsghdr2 struct {
373 373
 	Addrs    int32
374 374
 	Flags    int32
375 375
 	Index    uint16
376
-	_        [2]byte
377 376
 	Refcount int32
378 377
 }
379 378
 
... ...
@@ -382,7 +380,6 @@ type RtMsghdr struct {
382 382
 	Version uint8
383 383
 	Type    uint8
384 384
 	Index   uint16
385
-	_       [2]byte
386 385
 	Flags   int32
387 386
 	Addrs   int32
388 387
 	Pid     int32
... ...
@@ -404,7 +401,8 @@ type RtMetrics struct {
404 404
 	Rtt      uint32
405 405
 	Rttvar   uint32
406 406
 	Pksent   uint32
407
-	Filler   [4]uint32
407
+	State    uint32
408
+	Filler   [3]uint32
408 409
 }
409 410
 
410 411
 const (
... ...
@@ -427,7 +425,6 @@ type BpfStat struct {
427 427
 
428 428
 type BpfProgram struct {
429 429
 	Len   uint32
430
-	_     [4]byte
431 430
 	Insns *BpfInsn
432 431
 }
433 432
 
... ...
@@ -452,7 +449,6 @@ type Termios struct {
452 452
 	Cflag  uint64
453 453
 	Lflag  uint64
454 454
 	Cc     [20]uint8
455
-	_      [4]byte
456 455
 	Ispeed uint64
457 456
 	Ospeed uint64
458 457
 }
... ...
@@ -507,3 +503,8 @@ type Clockinfo struct {
507 507
 	Stathz  int32
508 508
 	Profhz  int32
509 509
 }
510
+
511
+type CtlInfo struct {
512
+	Id   uint32
513
+	Name [96]byte
514
+}
... ...
@@ -1,6 +1,5 @@
1
-// NOTE: cgo can't generate struct Stat_t and struct Statfs_t yet
2
-// Created by cgo -godefs - DO NOT EDIT
3
-// cgo -godefs types_darwin.go
1
+// cgo -godefs types_darwin.go | go run mkpost.go
2
+// Code generated by the command above; see README.md. DO NOT EDIT.
4 3
 
5 4
 // +build arm,darwin
6 5
 
... ...
@@ -31,7 +30,7 @@ type Timeval struct {
31 31
 	Usec int32
32 32
 }
33 33
 
34
-type Timeval32 [0]byte
34
+type Timeval32 struct{}
35 35
 
36 36
 type Rusage struct {
37 37
 	Utime    Timeval
... ...
@@ -93,9 +92,9 @@ type Statfs_t struct {
93 93
 	Type        uint32
94 94
 	Flags       uint32
95 95
 	Fssubtype   uint32
96
-	Fstypename  [16]int8
97
-	Mntonname   [1024]int8
98
-	Mntfromname [1024]int8
96
+	Fstypename  [16]byte
97
+	Mntonname   [1024]byte
98
+	Mntfromname [1024]byte
99 99
 	Reserved    [8]uint32
100 100
 }
101 101
 
... ...
@@ -146,6 +145,10 @@ type Dirent struct {
146 146
 	_       [3]byte
147 147
 }
148 148
 
149
+const (
150
+	PathMax = 0x400
151
+)
152
+
149 153
 type RawSockaddrInet4 struct {
150 154
 	Len    uint8
151 155
 	Family uint8
... ...
@@ -302,7 +305,6 @@ type IfMsghdr struct {
302 302
 	Addrs   int32
303 303
 	Flags   int32
304 304
 	Index   uint16
305
-	_       [2]byte
306 305
 	Data    IfData
307 306
 }
308 307
 
... ...
@@ -345,7 +347,6 @@ type IfaMsghdr struct {
345 345
 	Addrs   int32
346 346
 	Flags   int32
347 347
 	Index   uint16
348
-	_       [2]byte
349 348
 	Metric  int32
350 349
 }
351 350
 
... ...
@@ -366,7 +367,6 @@ type IfmaMsghdr2 struct {
366 366
 	Addrs    int32
367 367
 	Flags    int32
368 368
 	Index    uint16
369
-	_        [2]byte
370 369
 	Refcount int32
371 370
 }
372 371
 
... ...
@@ -375,7 +375,6 @@ type RtMsghdr struct {
375 375
 	Version uint8
376 376
 	Type    uint8
377 377
 	Index   uint16
378
-	_       [2]byte
379 378
 	Flags   int32
380 379
 	Addrs   int32
381 380
 	Pid     int32
... ...
@@ -397,7 +396,8 @@ type RtMetrics struct {
397 397
 	Rtt      uint32
398 398
 	Rttvar   uint32
399 399
 	Pksent   uint32
400
-	Filler   [4]uint32
400
+	State    uint32
401
+	Filler   [3]uint32
401 402
 }
402 403
 
403 404
 const (
... ...
@@ -498,3 +498,8 @@ type Clockinfo struct {
498 498
 	Stathz  int32
499 499
 	Profhz  int32
500 500
 }
501
+
502
+type CtlInfo struct {
503
+	Id   uint32
504
+	Name [96]byte
505
+}
... ...
@@ -70,7 +70,6 @@ type Stat_t struct {
70 70
 	Uid     uint32
71 71
 	Gid     uint32
72 72
 	Rdev    int32
73
-	_       [4]byte
74 73
 	Atim    Timespec
75 74
 	Mtim    Timespec
76 75
 	Ctim    Timespec
... ...
@@ -97,10 +96,11 @@ type Statfs_t struct {
97 97
 	Type        uint32
98 98
 	Flags       uint32
99 99
 	Fssubtype   uint32
100
-	Fstypename  [16]int8
101
-	Mntonname   [1024]int8
102
-	Mntfromname [1024]int8
103
-	Reserved    [8]uint32
100
+	Fstypename  [16]byte
101
+	Mntonname   [1024]byte
102
+	Mntfromname [1024]byte
103
+	Flags_ext   uint32
104
+	Reserved    [7]uint32
104 105
 }
105 106
 
106 107
 type Flock_t struct {
... ...
@@ -133,8 +133,7 @@ type Fbootstraptransfer_t struct {
133 133
 
134 134
 type Log2phys_t struct {
135 135
 	Flags uint32
136
-	_     [8]byte
137
-	_     [8]byte
136
+	_     [16]byte
138 137
 }
139 138
 
140 139
 type Fsid struct {
... ...
@@ -151,6 +150,10 @@ type Dirent struct {
151 151
 	_       [3]byte
152 152
 }
153 153
 
154
+const (
155
+	PathMax = 0x400
156
+)
157
+
154 158
 type RawSockaddrInet4 struct {
155 159
 	Len    uint8
156 160
 	Family uint8
... ...
@@ -221,10 +224,8 @@ type IPv6Mreq struct {
221 221
 type Msghdr struct {
222 222
 	Name       *byte
223 223
 	Namelen    uint32
224
-	_          [4]byte
225 224
 	Iov        *Iovec
226 225
 	Iovlen     int32
227
-	_          [4]byte
228 226
 	Control    *byte
229 227
 	Controllen uint32
230 228
 	Flags      int32
... ...
@@ -309,7 +310,6 @@ type IfMsghdr struct {
309 309
 	Addrs   int32
310 310
 	Flags   int32
311 311
 	Index   uint16
312
-	_       [2]byte
313 312
 	Data    IfData
314 313
 }
315 314
 
... ...
@@ -352,7 +352,6 @@ type IfaMsghdr struct {
352 352
 	Addrs   int32
353 353
 	Flags   int32
354 354
 	Index   uint16
355
-	_       [2]byte
356 355
 	Metric  int32
357 356
 }
358 357
 
... ...
@@ -373,7 +372,6 @@ type IfmaMsghdr2 struct {
373 373
 	Addrs    int32
374 374
 	Flags    int32
375 375
 	Index    uint16
376
-	_        [2]byte
377 376
 	Refcount int32
378 377
 }
379 378
 
... ...
@@ -382,7 +380,6 @@ type RtMsghdr struct {
382 382
 	Version uint8
383 383
 	Type    uint8
384 384
 	Index   uint16
385
-	_       [2]byte
386 385
 	Flags   int32
387 386
 	Addrs   int32
388 387
 	Pid     int32
... ...
@@ -404,7 +401,8 @@ type RtMetrics struct {
404 404
 	Rtt      uint32
405 405
 	Rttvar   uint32
406 406
 	Pksent   uint32
407
-	Filler   [4]uint32
407
+	State    uint32
408
+	Filler   [3]uint32
408 409
 }
409 410
 
410 411
 const (
... ...
@@ -427,7 +425,6 @@ type BpfStat struct {
427 427
 
428 428
 type BpfProgram struct {
429 429
 	Len   uint32
430
-	_     [4]byte
431 430
 	Insns *BpfInsn
432 431
 }
433 432
 
... ...
@@ -452,7 +449,6 @@ type Termios struct {
452 452
 	Cflag  uint64
453 453
 	Lflag  uint64
454 454
 	Cc     [20]uint8
455
-	_      [4]byte
456 455
 	Ispeed uint64
457 456
 	Ospeed uint64
458 457
 }
... ...
@@ -507,3 +503,8 @@ type Clockinfo struct {
507 507
 	Stathz  int32
508 508
 	Profhz  int32
509 509
 }
510
+
511
+type CtlInfo struct {
512
+	Id   uint32
513
+	Name [96]byte
514
+}
... ...
@@ -70,11 +70,11 @@ type Stat_t struct {
70 70
 	Ctim    Timespec
71 71
 	Size    int64
72 72
 	Blocks  int64
73
-	Blksize uint32
73
+	_       uint32
74 74
 	Flags   uint32
75 75
 	Gen     uint32
76 76
 	Lspare  int32
77
-	Qspare1 int64
77
+	Blksize int64
78 78
 	Qspare2 int64
79 79
 }
80 80
 
... ...
@@ -91,17 +91,15 @@ type Statfs_t struct {
91 91
 	Owner       uint32
92 92
 	Type        int32
93 93
 	Flags       int32
94
-	_           [4]byte
95 94
 	Syncwrites  int64
96 95
 	Asyncwrites int64
97
-	Fstypename  [16]int8
98
-	Mntonname   [80]int8
96
+	Fstypename  [16]byte
97
+	Mntonname   [80]byte
99 98
 	Syncreads   int64
100 99
 	Asyncreads  int64
101 100
 	Spares1     int16
102
-	Mntfromname [80]int8
101
+	Mntfromname [80]byte
103 102
 	Spares2     int16
104
-	_           [4]byte
105 103
 	Spare       [2]int64
106 104
 }
107 105
 
... ...
@@ -202,10 +200,8 @@ type IPv6Mreq struct {
202 202
 type Msghdr struct {
203 203
 	Name       *byte
204 204
 	Namelen    uint32
205
-	_          [4]byte
206 205
 	Iov        *Iovec
207 206
 	Iovlen     int32
208
-	_          [4]byte
209 207
 	Control    *byte
210 208
 	Controllen uint32
211 209
 	Flags      int32
... ...
@@ -269,7 +265,7 @@ type FdSet struct {
269 269
 const (
270 270
 	SizeofIfMsghdr         = 0xb0
271 271
 	SizeofIfData           = 0xa0
272
-	SizeofIfaMsghdr        = 0x14
272
+	SizeofIfaMsghdr        = 0x18
273 273
 	SizeofIfmaMsghdr       = 0x10
274 274
 	SizeofIfAnnounceMsghdr = 0x18
275 275
 	SizeofRtMsghdr         = 0x98
... ...
@@ -280,10 +276,9 @@ type IfMsghdr struct {
280 280
 	Msglen  uint16
281 281
 	Version uint8
282 282
 	Type    uint8
283
-	Addrs   int32
284
-	Flags   int32
285 283
 	Index   uint16
286
-	_       [2]byte
284
+	Flags   int32
285
+	Addrs   int32
287 286
 	Data    IfData
288 287
 }
289 288
 
... ...
@@ -294,7 +289,6 @@ type IfData struct {
294 294
 	Hdrlen     uint8
295 295
 	Recvquota  uint8
296 296
 	Xmitquota  uint8
297
-	_          [2]byte
298 297
 	Mtu        uint64
299 298
 	Metric     uint64
300 299
 	Link_state uint64
... ...
@@ -316,24 +310,23 @@ type IfData struct {
316 316
 }
317 317
 
318 318
 type IfaMsghdr struct {
319
-	Msglen  uint16
320
-	Version uint8
321
-	Type    uint8
322
-	Addrs   int32
323
-	Flags   int32
324
-	Index   uint16
325
-	_       [2]byte
326
-	Metric  int32
319
+	Msglen    uint16
320
+	Version   uint8
321
+	Type      uint8
322
+	Index     uint16
323
+	Flags     int32
324
+	Addrs     int32
325
+	Addrflags int32
326
+	Metric    int32
327 327
 }
328 328
 
329 329
 type IfmaMsghdr struct {
330 330
 	Msglen  uint16
331 331
 	Version uint8
332 332
 	Type    uint8
333
-	Addrs   int32
334
-	Flags   int32
335 333
 	Index   uint16
336
-	_       [2]byte
334
+	Flags   int32
335
+	Addrs   int32
337 336
 }
338 337
 
339 338
 type IfAnnounceMsghdr struct {
... ...
@@ -350,7 +343,6 @@ type RtMsghdr struct {
350 350
 	Version uint8
351 351
 	Type    uint8
352 352
 	Index   uint16
353
-	_       [2]byte
354 353
 	Flags   int32
355 354
 	Addrs   int32
356 355
 	Pid     int32
... ...
@@ -374,7 +366,6 @@ type RtMetrics struct {
374 374
 	Hopcount  uint64
375 375
 	Mssopt    uint16
376 376
 	Pad       uint16
377
-	_         [4]byte
378 377
 	Msl       uint64
379 378
 	Iwmaxsegs uint64
380 379
 	Iwcapsegs uint64
... ...
@@ -400,7 +391,6 @@ type BpfStat struct {
400 400
 
401 401
 type BpfProgram struct {
402 402
 	Len   uint32
403
-	_     [4]byte
404 403
 	Insns *BpfInsn
405 404
 }
406 405
 
... ...
@@ -554,7 +554,11 @@ const (
554 554
 	IFLA_NEW_IFINDEX        = 0x31
555 555
 	IFLA_MIN_MTU            = 0x32
556 556
 	IFLA_MAX_MTU            = 0x33
557
-	IFLA_MAX                = 0x36
557
+	IFLA_PROP_LIST          = 0x34
558
+	IFLA_ALT_IFNAME         = 0x35
559
+	IFLA_PERM_ADDRESS       = 0x36
560
+	IFLA_PROTO_DOWN_REASON  = 0x37
561
+	IFLA_MAX                = 0x37
558 562
 	IFLA_INFO_KIND          = 0x1
559 563
 	IFLA_INFO_DATA          = 0x2
560 564
 	IFLA_INFO_XSTATS        = 0x3
... ...
@@ -823,8 +827,6 @@ type SignalfdSiginfo struct {
823 823
 	_         [28]uint8
824 824
 }
825 825
 
826
-const PERF_IOC_FLAG_GROUP = 0x1
827
-
828 826
 type Winsize struct {
829 827
 	Row    uint16
830 828
 	Col    uint16
... ...
@@ -948,7 +950,10 @@ type PerfEventMmapPage struct {
948 948
 	Time_offset    uint64
949 949
 	Time_zero      uint64
950 950
 	Size           uint32
951
-	_              [948]uint8
951
+	_              uint32
952
+	Time_cycles    uint64
953
+	Time_mask      uint64
954
+	_              [928]uint8
952 955
 	Data_head      uint64
953 956
 	Data_tail      uint64
954 957
 	Data_offset    uint64
... ...
@@ -990,13 +995,13 @@ const (
990 990
 )
991 991
 
992 992
 const (
993
-	PERF_TYPE_HARDWARE   = 0x0
994
-	PERF_TYPE_SOFTWARE   = 0x1
995
-	PERF_TYPE_TRACEPOINT = 0x2
996
-	PERF_TYPE_HW_CACHE   = 0x3
997
-	PERF_TYPE_RAW        = 0x4
998
-	PERF_TYPE_BREAKPOINT = 0x5
999
-
993
+	PERF_TYPE_HARDWARE                    = 0x0
994
+	PERF_TYPE_SOFTWARE                    = 0x1
995
+	PERF_TYPE_TRACEPOINT                  = 0x2
996
+	PERF_TYPE_HW_CACHE                    = 0x3
997
+	PERF_TYPE_RAW                         = 0x4
998
+	PERF_TYPE_BREAKPOINT                  = 0x5
999
+	PERF_TYPE_MAX                         = 0x6
1000 1000
 	PERF_COUNT_HW_CPU_CYCLES              = 0x0
1001 1001
 	PERF_COUNT_HW_INSTRUCTIONS            = 0x1
1002 1002
 	PERF_COUNT_HW_CACHE_REFERENCES        = 0x2
... ...
@@ -1007,106 +1012,163 @@ const (
1007 1007
 	PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7
1008 1008
 	PERF_COUNT_HW_STALLED_CYCLES_BACKEND  = 0x8
1009 1009
 	PERF_COUNT_HW_REF_CPU_CYCLES          = 0x9
1010
-
1011
-	PERF_COUNT_HW_CACHE_L1D  = 0x0
1012
-	PERF_COUNT_HW_CACHE_L1I  = 0x1
1013
-	PERF_COUNT_HW_CACHE_LL   = 0x2
1014
-	PERF_COUNT_HW_CACHE_DTLB = 0x3
1015
-	PERF_COUNT_HW_CACHE_ITLB = 0x4
1016
-	PERF_COUNT_HW_CACHE_BPU  = 0x5
1017
-	PERF_COUNT_HW_CACHE_NODE = 0x6
1018
-
1019
-	PERF_COUNT_HW_CACHE_OP_READ     = 0x0
1020
-	PERF_COUNT_HW_CACHE_OP_WRITE    = 0x1
1021
-	PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2
1022
-
1023
-	PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0
1024
-	PERF_COUNT_HW_CACHE_RESULT_MISS   = 0x1
1025
-
1026
-	PERF_COUNT_SW_CPU_CLOCK        = 0x0
1027
-	PERF_COUNT_SW_TASK_CLOCK       = 0x1
1028
-	PERF_COUNT_SW_PAGE_FAULTS      = 0x2
1029
-	PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3
1030
-	PERF_COUNT_SW_CPU_MIGRATIONS   = 0x4
1031
-	PERF_COUNT_SW_PAGE_FAULTS_MIN  = 0x5
1032
-	PERF_COUNT_SW_PAGE_FAULTS_MAJ  = 0x6
1033
-	PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7
1034
-	PERF_COUNT_SW_EMULATION_FAULTS = 0x8
1035
-	PERF_COUNT_SW_DUMMY            = 0x9
1036
-	PERF_COUNT_SW_BPF_OUTPUT       = 0xa
1037
-
1038
-	PERF_SAMPLE_IP           = 0x1
1039
-	PERF_SAMPLE_TID          = 0x2
1040
-	PERF_SAMPLE_TIME         = 0x4
1041
-	PERF_SAMPLE_ADDR         = 0x8
1042
-	PERF_SAMPLE_READ         = 0x10
1043
-	PERF_SAMPLE_CALLCHAIN    = 0x20
1044
-	PERF_SAMPLE_ID           = 0x40
1045
-	PERF_SAMPLE_CPU          = 0x80
1046
-	PERF_SAMPLE_PERIOD       = 0x100
1047
-	PERF_SAMPLE_STREAM_ID    = 0x200
1048
-	PERF_SAMPLE_RAW          = 0x400
1049
-	PERF_SAMPLE_BRANCH_STACK = 0x800
1050
-	PERF_SAMPLE_REGS_USER    = 0x1000
1051
-	PERF_SAMPLE_STACK_USER   = 0x2000
1052
-	PERF_SAMPLE_WEIGHT       = 0x4000
1053
-	PERF_SAMPLE_DATA_SRC     = 0x8000
1054
-	PERF_SAMPLE_IDENTIFIER   = 0x10000
1055
-	PERF_SAMPLE_TRANSACTION  = 0x20000
1056
-	PERF_SAMPLE_REGS_INTR    = 0x40000
1057
-
1058
-	PERF_SAMPLE_BRANCH_USER       = 0x1
1059
-	PERF_SAMPLE_BRANCH_KERNEL     = 0x2
1060
-	PERF_SAMPLE_BRANCH_HV         = 0x4
1061
-	PERF_SAMPLE_BRANCH_ANY        = 0x8
1062
-	PERF_SAMPLE_BRANCH_ANY_CALL   = 0x10
1063
-	PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20
1064
-	PERF_SAMPLE_BRANCH_IND_CALL   = 0x40
1065
-	PERF_SAMPLE_BRANCH_ABORT_TX   = 0x80
1066
-	PERF_SAMPLE_BRANCH_IN_TX      = 0x100
1067
-	PERF_SAMPLE_BRANCH_NO_TX      = 0x200
1068
-	PERF_SAMPLE_BRANCH_COND       = 0x400
1069
-	PERF_SAMPLE_BRANCH_CALL_STACK = 0x800
1070
-	PERF_SAMPLE_BRANCH_IND_JUMP   = 0x1000
1071
-	PERF_SAMPLE_BRANCH_CALL       = 0x2000
1072
-	PERF_SAMPLE_BRANCH_NO_FLAGS   = 0x4000
1073
-	PERF_SAMPLE_BRANCH_NO_CYCLES  = 0x8000
1074
-	PERF_SAMPLE_BRANCH_TYPE_SAVE  = 0x10000
1075
-
1076
-	PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1
1077
-	PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2
1078
-	PERF_FORMAT_ID                 = 0x4
1079
-	PERF_FORMAT_GROUP              = 0x8
1080
-
1081
-	PERF_RECORD_MMAP            = 0x1
1082
-	PERF_RECORD_LOST            = 0x2
1083
-	PERF_RECORD_COMM            = 0x3
1084
-	PERF_RECORD_EXIT            = 0x4
1085
-	PERF_RECORD_THROTTLE        = 0x5
1086
-	PERF_RECORD_UNTHROTTLE      = 0x6
1087
-	PERF_RECORD_FORK            = 0x7
1088
-	PERF_RECORD_READ            = 0x8
1089
-	PERF_RECORD_SAMPLE          = 0x9
1090
-	PERF_RECORD_MMAP2           = 0xa
1091
-	PERF_RECORD_AUX             = 0xb
1092
-	PERF_RECORD_ITRACE_START    = 0xc
1093
-	PERF_RECORD_LOST_SAMPLES    = 0xd
1094
-	PERF_RECORD_SWITCH          = 0xe
1095
-	PERF_RECORD_SWITCH_CPU_WIDE = 0xf
1096
-	PERF_RECORD_NAMESPACES      = 0x10
1097
-
1098
-	PERF_CONTEXT_HV     = -0x20
1099
-	PERF_CONTEXT_KERNEL = -0x80
1100
-	PERF_CONTEXT_USER   = -0x200
1101
-
1102
-	PERF_CONTEXT_GUEST        = -0x800
1103
-	PERF_CONTEXT_GUEST_KERNEL = -0x880
1104
-	PERF_CONTEXT_GUEST_USER   = -0xa00
1105
-
1106
-	PERF_FLAG_FD_NO_GROUP = 0x1
1107
-	PERF_FLAG_FD_OUTPUT   = 0x2
1108
-	PERF_FLAG_PID_CGROUP  = 0x4
1109
-	PERF_FLAG_FD_CLOEXEC  = 0x8
1010
+	PERF_COUNT_HW_MAX                     = 0xa
1011
+	PERF_COUNT_HW_CACHE_L1D               = 0x0
1012
+	PERF_COUNT_HW_CACHE_L1I               = 0x1
1013
+	PERF_COUNT_HW_CACHE_LL                = 0x2
1014
+	PERF_COUNT_HW_CACHE_DTLB              = 0x3
1015
+	PERF_COUNT_HW_CACHE_ITLB              = 0x4
1016
+	PERF_COUNT_HW_CACHE_BPU               = 0x5
1017
+	PERF_COUNT_HW_CACHE_NODE              = 0x6
1018
+	PERF_COUNT_HW_CACHE_MAX               = 0x7
1019
+	PERF_COUNT_HW_CACHE_OP_READ           = 0x0
1020
+	PERF_COUNT_HW_CACHE_OP_WRITE          = 0x1
1021
+	PERF_COUNT_HW_CACHE_OP_PREFETCH       = 0x2
1022
+	PERF_COUNT_HW_CACHE_OP_MAX            = 0x3
1023
+	PERF_COUNT_HW_CACHE_RESULT_ACCESS     = 0x0
1024
+	PERF_COUNT_HW_CACHE_RESULT_MISS       = 0x1
1025
+	PERF_COUNT_HW_CACHE_RESULT_MAX        = 0x2
1026
+	PERF_COUNT_SW_CPU_CLOCK               = 0x0
1027
+	PERF_COUNT_SW_TASK_CLOCK              = 0x1
1028
+	PERF_COUNT_SW_PAGE_FAULTS             = 0x2
1029
+	PERF_COUNT_SW_CONTEXT_SWITCHES        = 0x3
1030
+	PERF_COUNT_SW_CPU_MIGRATIONS          = 0x4
1031
+	PERF_COUNT_SW_PAGE_FAULTS_MIN         = 0x5
1032
+	PERF_COUNT_SW_PAGE_FAULTS_MAJ         = 0x6
1033
+	PERF_COUNT_SW_ALIGNMENT_FAULTS        = 0x7
1034
+	PERF_COUNT_SW_EMULATION_FAULTS        = 0x8
1035
+	PERF_COUNT_SW_DUMMY                   = 0x9
1036
+	PERF_COUNT_SW_BPF_OUTPUT              = 0xa
1037
+	PERF_COUNT_SW_MAX                     = 0xb
1038
+	PERF_SAMPLE_IP                        = 0x1
1039
+	PERF_SAMPLE_TID                       = 0x2
1040
+	PERF_SAMPLE_TIME                      = 0x4
1041
+	PERF_SAMPLE_ADDR                      = 0x8
1042
+	PERF_SAMPLE_READ                      = 0x10
1043
+	PERF_SAMPLE_CALLCHAIN                 = 0x20
1044
+	PERF_SAMPLE_ID                        = 0x40
1045
+	PERF_SAMPLE_CPU                       = 0x80
1046
+	PERF_SAMPLE_PERIOD                    = 0x100
1047
+	PERF_SAMPLE_STREAM_ID                 = 0x200
1048
+	PERF_SAMPLE_RAW                       = 0x400
1049
+	PERF_SAMPLE_BRANCH_STACK              = 0x800
1050
+	PERF_SAMPLE_REGS_USER                 = 0x1000
1051
+	PERF_SAMPLE_STACK_USER                = 0x2000
1052
+	PERF_SAMPLE_WEIGHT                    = 0x4000
1053
+	PERF_SAMPLE_DATA_SRC                  = 0x8000
1054
+	PERF_SAMPLE_IDENTIFIER                = 0x10000
1055
+	PERF_SAMPLE_TRANSACTION               = 0x20000
1056
+	PERF_SAMPLE_REGS_INTR                 = 0x40000
1057
+	PERF_SAMPLE_PHYS_ADDR                 = 0x80000
1058
+	PERF_SAMPLE_AUX                       = 0x100000
1059
+	PERF_SAMPLE_CGROUP                    = 0x200000
1060
+	PERF_SAMPLE_MAX                       = 0x400000
1061
+	PERF_SAMPLE_BRANCH_USER_SHIFT         = 0x0
1062
+	PERF_SAMPLE_BRANCH_KERNEL_SHIFT       = 0x1
1063
+	PERF_SAMPLE_BRANCH_HV_SHIFT           = 0x2
1064
+	PERF_SAMPLE_BRANCH_ANY_SHIFT          = 0x3
1065
+	PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT     = 0x4
1066
+	PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT   = 0x5
1067
+	PERF_SAMPLE_BRANCH_IND_CALL_SHIFT     = 0x6
1068
+	PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT     = 0x7
1069
+	PERF_SAMPLE_BRANCH_IN_TX_SHIFT        = 0x8
1070
+	PERF_SAMPLE_BRANCH_NO_TX_SHIFT        = 0x9
1071
+	PERF_SAMPLE_BRANCH_COND_SHIFT         = 0xa
1072
+	PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT   = 0xb
1073
+	PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT     = 0xc
1074
+	PERF_SAMPLE_BRANCH_CALL_SHIFT         = 0xd
1075
+	PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT     = 0xe
1076
+	PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT    = 0xf
1077
+	PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT    = 0x10
1078
+	PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT     = 0x11
1079
+	PERF_SAMPLE_BRANCH_MAX_SHIFT          = 0x12
1080
+	PERF_SAMPLE_BRANCH_USER               = 0x1
1081
+	PERF_SAMPLE_BRANCH_KERNEL             = 0x2
1082
+	PERF_SAMPLE_BRANCH_HV                 = 0x4
1083
+	PERF_SAMPLE_BRANCH_ANY                = 0x8
1084
+	PERF_SAMPLE_BRANCH_ANY_CALL           = 0x10
1085
+	PERF_SAMPLE_BRANCH_ANY_RETURN         = 0x20
1086
+	PERF_SAMPLE_BRANCH_IND_CALL           = 0x40
1087
+	PERF_SAMPLE_BRANCH_ABORT_TX           = 0x80
1088
+	PERF_SAMPLE_BRANCH_IN_TX              = 0x100
1089
+	PERF_SAMPLE_BRANCH_NO_TX              = 0x200
1090
+	PERF_SAMPLE_BRANCH_COND               = 0x400
1091
+	PERF_SAMPLE_BRANCH_CALL_STACK         = 0x800
1092
+	PERF_SAMPLE_BRANCH_IND_JUMP           = 0x1000
1093
+	PERF_SAMPLE_BRANCH_CALL               = 0x2000
1094
+	PERF_SAMPLE_BRANCH_NO_FLAGS           = 0x4000
1095
+	PERF_SAMPLE_BRANCH_NO_CYCLES          = 0x8000
1096
+	PERF_SAMPLE_BRANCH_TYPE_SAVE          = 0x10000
1097
+	PERF_SAMPLE_BRANCH_HW_INDEX           = 0x20000
1098
+	PERF_SAMPLE_BRANCH_MAX                = 0x40000
1099
+	PERF_BR_UNKNOWN                       = 0x0
1100
+	PERF_BR_COND                          = 0x1
1101
+	PERF_BR_UNCOND                        = 0x2
1102
+	PERF_BR_IND                           = 0x3
1103
+	PERF_BR_CALL                          = 0x4
1104
+	PERF_BR_IND_CALL                      = 0x5
1105
+	PERF_BR_RET                           = 0x6
1106
+	PERF_BR_SYSCALL                       = 0x7
1107
+	PERF_BR_SYSRET                        = 0x8
1108
+	PERF_BR_COND_CALL                     = 0x9
1109
+	PERF_BR_COND_RET                      = 0xa
1110
+	PERF_BR_MAX                           = 0xb
1111
+	PERF_SAMPLE_REGS_ABI_NONE             = 0x0
1112
+	PERF_SAMPLE_REGS_ABI_32               = 0x1
1113
+	PERF_SAMPLE_REGS_ABI_64               = 0x2
1114
+	PERF_TXN_ELISION                      = 0x1
1115
+	PERF_TXN_TRANSACTION                  = 0x2
1116
+	PERF_TXN_SYNC                         = 0x4
1117
+	PERF_TXN_ASYNC                        = 0x8
1118
+	PERF_TXN_RETRY                        = 0x10
1119
+	PERF_TXN_CONFLICT                     = 0x20
1120
+	PERF_TXN_CAPACITY_WRITE               = 0x40
1121
+	PERF_TXN_CAPACITY_READ                = 0x80
1122
+	PERF_TXN_MAX                          = 0x100
1123
+	PERF_TXN_ABORT_MASK                   = -0x100000000
1124
+	PERF_TXN_ABORT_SHIFT                  = 0x20
1125
+	PERF_FORMAT_TOTAL_TIME_ENABLED        = 0x1
1126
+	PERF_FORMAT_TOTAL_TIME_RUNNING        = 0x2
1127
+	PERF_FORMAT_ID                        = 0x4
1128
+	PERF_FORMAT_GROUP                     = 0x8
1129
+	PERF_FORMAT_MAX                       = 0x10
1130
+	PERF_IOC_FLAG_GROUP                   = 0x1
1131
+	PERF_RECORD_MMAP                      = 0x1
1132
+	PERF_RECORD_LOST                      = 0x2
1133
+	PERF_RECORD_COMM                      = 0x3
1134
+	PERF_RECORD_EXIT                      = 0x4
1135
+	PERF_RECORD_THROTTLE                  = 0x5
1136
+	PERF_RECORD_UNTHROTTLE                = 0x6
1137
+	PERF_RECORD_FORK                      = 0x7
1138
+	PERF_RECORD_READ                      = 0x8
1139
+	PERF_RECORD_SAMPLE                    = 0x9
1140
+	PERF_RECORD_MMAP2                     = 0xa
1141
+	PERF_RECORD_AUX                       = 0xb
1142
+	PERF_RECORD_ITRACE_START              = 0xc
1143
+	PERF_RECORD_LOST_SAMPLES              = 0xd
1144
+	PERF_RECORD_SWITCH                    = 0xe
1145
+	PERF_RECORD_SWITCH_CPU_WIDE           = 0xf
1146
+	PERF_RECORD_NAMESPACES                = 0x10
1147
+	PERF_RECORD_KSYMBOL                   = 0x11
1148
+	PERF_RECORD_BPF_EVENT                 = 0x12
1149
+	PERF_RECORD_CGROUP                    = 0x13
1150
+	PERF_RECORD_TEXT_POKE                 = 0x14
1151
+	PERF_RECORD_MAX                       = 0x15
1152
+	PERF_RECORD_KSYMBOL_TYPE_UNKNOWN      = 0x0
1153
+	PERF_RECORD_KSYMBOL_TYPE_BPF          = 0x1
1154
+	PERF_RECORD_KSYMBOL_TYPE_OOL          = 0x2
1155
+	PERF_RECORD_KSYMBOL_TYPE_MAX          = 0x3
1156
+	PERF_BPF_EVENT_UNKNOWN                = 0x0
1157
+	PERF_BPF_EVENT_PROG_LOAD              = 0x1
1158
+	PERF_BPF_EVENT_PROG_UNLOAD            = 0x2
1159
+	PERF_BPF_EVENT_MAX                    = 0x3
1160
+	PERF_CONTEXT_HV                       = -0x20
1161
+	PERF_CONTEXT_KERNEL                   = -0x80
1162
+	PERF_CONTEXT_USER                     = -0x200
1163
+	PERF_CONTEXT_GUEST                    = -0x800
1164
+	PERF_CONTEXT_GUEST_KERNEL             = -0x880
1165
+	PERF_CONTEXT_GUEST_USER               = -0xa00
1166
+	PERF_CONTEXT_MAX                      = -0xfff
1110 1167
 )
1111 1168
 
1112 1169
 type TCPMD5Sig struct {
... ...
@@ -1412,7 +1474,7 @@ const (
1412 1412
 	NFT_MSG_DELOBJ                    = 0x14
1413 1413
 	NFT_MSG_GETOBJ_RESET              = 0x15
1414 1414
 	NFT_MSG_MAX                       = 0x19
1415
-	NFTA_LIST_UNPEC                   = 0x0
1415
+	NFTA_LIST_UNSPEC                  = 0x0
1416 1416
 	NFTA_LIST_ELEM                    = 0x1
1417 1417
 	NFTA_HOOK_UNSPEC                  = 0x0
1418 1418
 	NFTA_HOOK_HOOKNUM                 = 0x1
... ...
@@ -1851,9 +1913,12 @@ type XDPMmapOffsets struct {
1851 1851
 }
1852 1852
 
1853 1853
 type XDPStatistics struct {
1854
-	Rx_dropped       uint64
1855
-	Rx_invalid_descs uint64
1856
-	Tx_invalid_descs uint64
1854
+	Rx_dropped               uint64
1855
+	Rx_invalid_descs         uint64
1856
+	Tx_invalid_descs         uint64
1857
+	Rx_ring_full             uint64
1858
+	Rx_fill_ring_empty_descs uint64
1859
+	Tx_ring_empty_descs      uint64
1857 1860
 }
1858 1861
 
1859 1862
 type XDPDesc struct {
... ...
@@ -2500,7 +2565,7 @@ const (
2500 2500
 	DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE     = 0x3c
2501 2501
 	DEVLINK_ATTR_PAD                          = 0x3d
2502 2502
 	DEVLINK_ATTR_ESWITCH_ENCAP_MODE           = 0x3e
2503
-	DEVLINK_ATTR_MAX                          = 0x90
2503
+	DEVLINK_ATTR_MAX                          = 0x94
2504 2504
 	DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE     = 0x0
2505 2505
 	DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX  = 0x1
2506 2506
 	DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT      = 0x0
... ...
@@ -2567,3 +2632,9 @@ const (
2567 2567
 	CAN_RAW_FD_FRAMES     = 0x5
2568 2568
 	CAN_RAW_JOIN_FILTERS  = 0x6
2569 2569
 )
2570
+
2571
+type WatchdogInfo struct {
2572
+	Options  uint32
2573
+	Version  uint32
2574
+	Identity [32]uint8
2575
+}
... ...
@@ -88,7 +88,6 @@ type Stat_t struct {
88 88
 	Mtim    Timespec
89 89
 	Ctim    Timespec
90 90
 	Blksize int32
91
-	_       [4]byte
92 91
 	Blocks  int64
93 92
 	Fstype  [16]int8
94 93
 }
... ...
@@ -96,7 +95,6 @@ type Stat_t struct {
96 96
 type Flock_t struct {
97 97
 	Type   int16
98 98
 	Whence int16
99
-	_      [4]byte
100 99
 	Start  int64
101 100
 	Len    int64
102 101
 	Sysid  int32
... ...
@@ -138,12 +136,12 @@ type RawSockaddrInet4 struct {
138 138
 }
139 139
 
140 140
 type RawSockaddrInet6 struct {
141
-	Family         uint16
142
-	Port           uint16
143
-	Flowinfo       uint32
144
-	Addr           [16]byte /* in6_addr */
145
-	Scope_id       uint32
146
-	X__sin6_src_id uint32
141
+	Family   uint16
142
+	Port     uint16
143
+	Flowinfo uint32
144
+	Addr     [16]byte /* in6_addr */
145
+	Scope_id uint32
146
+	_        uint32
147 147
 }
148 148
 
149 149
 type RawSockaddrUnix struct {
... ...
@@ -196,10 +194,8 @@ type IPv6Mreq struct {
196 196
 type Msghdr struct {
197 197
 	Name         *byte
198 198
 	Namelen      uint32
199
-	_            [4]byte
200 199
 	Iov          *Iovec
201 200
 	Iovlen       int32
202
-	_            [4]byte
203 201
 	Accrights    *int8
204 202
 	Accrightslen int32
205 203
 	_            [4]byte
... ...
@@ -228,7 +224,7 @@ type IPv6MTUInfo struct {
228 228
 }
229 229
 
230 230
 type ICMPv6Filter struct {
231
-	X__icmp6_filt [8]uint32
231
+	Filt [8]uint32
232 232
 }
233 233
 
234 234
 const (
... ...
@@ -291,7 +287,6 @@ type IfMsghdr struct {
291 291
 	Addrs   int32
292 292
 	Flags   int32
293 293
 	Index   uint16
294
-	_       [2]byte
295 294
 	Data    IfData
296 295
 }
297 296
 
... ...
@@ -299,7 +294,6 @@ type IfData struct {
299 299
 	Type       uint8
300 300
 	Addrlen    uint8
301 301
 	Hdrlen     uint8
302
-	_          [1]byte
303 302
 	Mtu        uint32
304 303
 	Metric     uint32
305 304
 	Baudrate   uint32
... ...
@@ -324,7 +318,6 @@ type IfaMsghdr struct {
324 324
 	Addrs   int32
325 325
 	Flags   int32
326 326
 	Index   uint16
327
-	_       [2]byte
328 327
 	Metric  int32
329 328
 }
330 329
 
... ...
@@ -333,7 +326,6 @@ type RtMsghdr struct {
333 333
 	Version uint8
334 334
 	Type    uint8
335 335
 	Index   uint16
336
-	_       [2]byte
337 336
 	Flags   int32
338 337
 	Addrs   int32
339 338
 	Pid     int32
... ...
@@ -371,15 +363,14 @@ type BpfVersion struct {
371 371
 }
372 372
 
373 373
 type BpfStat struct {
374
-	Recv    uint64
375
-	Drop    uint64
376
-	Capt    uint64
377
-	Padding [13]uint64
374
+	Recv uint64
375
+	Drop uint64
376
+	Capt uint64
377
+	_    [13]uint64
378 378
 }
379 379
 
380 380
 type BpfProgram struct {
381 381
 	Len   uint32
382
-	_     [4]byte
383 382
 	Insns *BpfInsn
384 383
 }
385 384
 
... ...
@@ -26,7 +26,7 @@ var (
26 26
 func errnoErr(e syscall.Errno) error {
27 27
 	switch e {
28 28
 	case 0:
29
-		return nil
29
+		return syscall.EINVAL
30 30
 	case errnoERROR_IO_PENDING:
31 31
 		return errERROR_IO_PENDING
32 32
 	}
... ...
@@ -40,50 +40,50 @@ var (
40 40
 	modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
41 41
 	modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
42 42
 
43
+	procRegConnectRegistryW       = modadvapi32.NewProc("RegConnectRegistryW")
43 44
 	procRegCreateKeyExW           = modadvapi32.NewProc("RegCreateKeyExW")
44 45
 	procRegDeleteKeyW             = modadvapi32.NewProc("RegDeleteKeyW")
45
-	procRegSetValueExW            = modadvapi32.NewProc("RegSetValueExW")
46
-	procRegEnumValueW             = modadvapi32.NewProc("RegEnumValueW")
47 46
 	procRegDeleteValueW           = modadvapi32.NewProc("RegDeleteValueW")
47
+	procRegEnumValueW             = modadvapi32.NewProc("RegEnumValueW")
48 48
 	procRegLoadMUIStringW         = modadvapi32.NewProc("RegLoadMUIStringW")
49
-	procRegConnectRegistryW       = modadvapi32.NewProc("RegConnectRegistryW")
49
+	procRegSetValueExW            = modadvapi32.NewProc("RegSetValueExW")
50 50
 	procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW")
51 51
 )
52 52
 
53
-func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) {
54
-	r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition)))
53
+func regConnectRegistry(machinename *uint16, key syscall.Handle, result *syscall.Handle) (regerrno error) {
54
+	r0, _, _ := syscall.Syscall(procRegConnectRegistryW.Addr(), 3, uintptr(unsafe.Pointer(machinename)), uintptr(key), uintptr(unsafe.Pointer(result)))
55 55
 	if r0 != 0 {
56 56
 		regerrno = syscall.Errno(r0)
57 57
 	}
58 58
 	return
59 59
 }
60 60
 
61
-func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) {
62
-	r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0)
61
+func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) {
62
+	r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition)))
63 63
 	if r0 != 0 {
64 64
 		regerrno = syscall.Errno(r0)
65 65
 	}
66 66
 	return
67 67
 }
68 68
 
69
-func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) {
70
-	r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize))
69
+func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) {
70
+	r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0)
71 71
 	if r0 != 0 {
72 72
 		regerrno = syscall.Errno(r0)
73 73
 	}
74 74
 	return
75 75
 }
76 76
 
77
-func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
78
-	r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0)
77
+func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) {
78
+	r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0)
79 79
 	if r0 != 0 {
80 80
 		regerrno = syscall.Errno(r0)
81 81
 	}
82 82
 	return
83 83
 }
84 84
 
85
-func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) {
86
-	r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0)
85
+func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
86
+	r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0)
87 87
 	if r0 != 0 {
88 88
 		regerrno = syscall.Errno(r0)
89 89
 	}
... ...
@@ -98,8 +98,8 @@ func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint
98 98
 	return
99 99
 }
100 100
 
101
-func regConnectRegistry(machinename *uint16, key syscall.Handle, result *syscall.Handle) (regerrno error) {
102
-	r0, _, _ := syscall.Syscall(procRegConnectRegistryW.Addr(), 3, uintptr(unsafe.Pointer(machinename)), uintptr(key), uintptr(unsafe.Pointer(result)))
101
+func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) {
102
+	r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize))
103 103
 	if r0 != 0 {
104 104
 		regerrno = syscall.Errno(r0)
105 105
 	}
... ...
@@ -110,11 +110,7 @@ func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32,
110 110
 	r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size))
111 111
 	n = uint32(r0)
112 112
 	if n == 0 {
113
-		if e1 != 0 {
114
-			err = errnoErr(e1)
115
-		} else {
116
-			err = syscall.EINVAL
117
-		}
113
+		err = errnoErr(e1)
118 114
 	}
119 115
 	return
120 116
 }
... ...
@@ -7,6 +7,10 @@
7 7
 package svc
8 8
 
9 9
 import (
10
+	"errors"
11
+	"syscall"
12
+	"unsafe"
13
+
10 14
 	"golang.org/x/sys/windows"
11 15
 )
12 16
 
... ...
@@ -23,6 +27,8 @@ func allocSid(subAuth0 uint32) (*windows.SID, error) {
23 23
 // IsAnInteractiveSession determines if calling process is running interactively.
24 24
 // It queries the process token for membership in the Interactive group.
25 25
 // http://stackoverflow.com/questions/2668851/how-do-i-detect-that-my-application-is-running-as-service-or-in-an-interactive-s
26
+//
27
+// Deprecated: Use IsWindowsService instead.
26 28
 func IsAnInteractiveSession() (bool, error) {
27 29
 	interSid, err := allocSid(windows.SECURITY_INTERACTIVE_RID)
28 30
 	if err != nil {
... ...
@@ -57,3 +63,95 @@ func IsAnInteractiveSession() (bool, error) {
57 57
 	}
58 58
 	return false, nil
59 59
 }
60
+
61
+var (
62
+	ntdll                      = windows.NewLazySystemDLL("ntdll.dll")
63
+	_NtQueryInformationProcess = ntdll.NewProc("NtQueryInformationProcess")
64
+
65
+	kernel32                    = windows.NewLazySystemDLL("kernel32.dll")
66
+	_QueryFullProcessImageNameA = kernel32.NewProc("QueryFullProcessImageNameA")
67
+)
68
+
69
+// IsWindowsService reports whether the process is currently executing
70
+// as a Windows service.
71
+func IsWindowsService() (bool, error) {
72
+	// This code was copied from runtime.isWindowsService function.
73
+
74
+	// The below technique looks a bit hairy, but it's actually
75
+	// exactly what the .NET framework does for the similarly named function:
76
+	// https://github.com/dotnet/extensions/blob/f4066026ca06984b07e90e61a6390ac38152ba93/src/Hosting/WindowsServices/src/WindowsServiceHelpers.cs#L26-L31
77
+	// Specifically, it looks up whether the parent process has session ID zero
78
+	// and is called "services".
79
+	const _CURRENT_PROCESS = ^uintptr(0)
80
+	// pbi is a PROCESS_BASIC_INFORMATION struct, where we just care about
81
+	// the 6th pointer inside of it, which contains the pid of the process
82
+	// parent:
83
+	// https://github.com/wine-mirror/wine/blob/42cb7d2ad1caba08de235e6319b9967296b5d554/include/winternl.h#L1294
84
+	var pbi [6]uintptr
85
+	var pbiLen uint32
86
+	r0, _, _ := syscall.Syscall6(_NtQueryInformationProcess.Addr(), 5, _CURRENT_PROCESS, 0, uintptr(unsafe.Pointer(&pbi[0])), uintptr(unsafe.Sizeof(pbi)), uintptr(unsafe.Pointer(&pbiLen)), 0)
87
+	if r0 != 0 {
88
+		return false, errors.New("NtQueryInformationProcess failed: error=" + itoa(int(r0)))
89
+	}
90
+	var psid uint32
91
+	err := windows.ProcessIdToSessionId(uint32(pbi[5]), &psid)
92
+	if err != nil {
93
+		return false, err
94
+	}
95
+	if psid != 0 {
96
+		// parent session id should be 0 for service process
97
+		return false, nil
98
+	}
99
+
100
+	pproc, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pbi[5]))
101
+	if err != nil {
102
+		return false, err
103
+	}
104
+	defer windows.CloseHandle(pproc)
105
+
106
+	// exeName gets the path to the executable image of the parent process
107
+	var exeName [261]byte
108
+	exeNameLen := uint32(len(exeName) - 1)
109
+	r0, _, e0 := syscall.Syscall6(_QueryFullProcessImageNameA.Addr(), 4, uintptr(pproc), 0, uintptr(unsafe.Pointer(&exeName[0])), uintptr(unsafe.Pointer(&exeNameLen)), 0, 0)
110
+	if r0 == 0 {
111
+		if e0 != 0 {
112
+			return false, e0
113
+		} else {
114
+			return false, syscall.EINVAL
115
+		}
116
+	}
117
+	const (
118
+		servicesLower = "services.exe"
119
+		servicesUpper = "SERVICES.EXE"
120
+	)
121
+	i := int(exeNameLen) - 1
122
+	j := len(servicesLower) - 1
123
+	if i < j {
124
+		return false, nil
125
+	}
126
+	for {
127
+		if j == -1 {
128
+			return i == -1 || exeName[i] == '\\', nil
129
+		}
130
+		if exeName[i] != servicesLower[j] && exeName[i] != servicesUpper[j] {
131
+			return false, nil
132
+		}
133
+		i--
134
+		j--
135
+	}
136
+}
137
+
138
+func itoa(val int) string { // do it here rather than with fmt to avoid dependency
139
+	if val < 0 {
140
+		return "-" + itoa(-val)
141
+	}
142
+	var buf [32]byte // big enough for int64
143
+	i := len(buf) - 1
144
+	for val >= 10 {
145
+		buf[i] = byte(val%10 + '0')
146
+		i--
147
+		val /= 10
148
+	}
149
+	buf[i] = byte(val + '0')
150
+	return string(buf[i:])
151
+}
... ...
@@ -270,9 +270,11 @@ func NewCallbackCDecl(fn interface{}) uintptr {
270 270
 //sys	RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW
271 271
 //sys	RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW
272 272
 //sys	GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
273
+//sys	ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId
273 274
 //sys	GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode
274 275
 //sys	SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
275 276
 //sys	GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
277
+//sys	SetConsoleCursorPosition(console Handle, position Coord) (err error) = kernel32.SetConsoleCursorPosition
276 278
 //sys	WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW
277 279
 //sys	ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW
278 280
 //sys	CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot
... ...
@@ -388,11 +390,7 @@ func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err
388 388
 	r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), ordinal, 0)
389 389
 	proc = uintptr(r0)
390 390
 	if proc == 0 {
391
-		if e1 != 0 {
392
-			err = errnoErr(e1)
393
-		} else {
394
-			err = syscall.EINVAL
395
-		}
391
+		err = errnoErr(e1)
396 392
 	}
397 393
 	return
398 394
 }
... ...
@@ -1089,11 +1087,7 @@ func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlap
1089 1089
 	}
1090 1090
 	r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
1091 1091
 	if r1 == socket_error {
1092
-		if e1 != 0 {
1093
-			err = errnoErr(e1)
1094
-		} else {
1095
-			err = syscall.EINVAL
1096
-		}
1092
+		err = errnoErr(e1)
1097 1093
 	}
1098 1094
 	return err
1099 1095
 }
... ...
@@ -1105,11 +1099,7 @@ func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overl
1105 1105
 	}
1106 1106
 	r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0)
1107 1107
 	if r1 == socket_error {
1108
-		if e1 != 0 {
1109
-			err = errnoErr(e1)
1110
-		} else {
1111
-			err = syscall.EINVAL
1112
-		}
1108
+		err = errnoErr(e1)
1113 1109
 	}
1114 1110
 	return err
1115 1111
 }
... ...
@@ -24,7 +24,7 @@ var (
24 24
 func errnoErr(e syscall.Errno) error {
25 25
 	switch e {
26 26
 	case 0:
27
-		return nil
27
+		return syscall.EINVAL
28 28
 	case errnoERROR_IO_PENDING:
29 29
 		return errERROR_IO_PENDING
30 30
 	}
... ...
@@ -36,2066 +36,1595 @@ func errnoErr(e syscall.Errno) error {
36 36
 
37 37
 var (
38 38
 	modadvapi32 = NewLazySystemDLL("advapi32.dll")
39
+	modcrypt32  = NewLazySystemDLL("crypt32.dll")
40
+	moddnsapi   = NewLazySystemDLL("dnsapi.dll")
41
+	modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
39 42
 	modkernel32 = NewLazySystemDLL("kernel32.dll")
40
-	modshell32  = NewLazySystemDLL("shell32.dll")
41
-	moduserenv  = NewLazySystemDLL("userenv.dll")
42 43
 	modmswsock  = NewLazySystemDLL("mswsock.dll")
43
-	modcrypt32  = NewLazySystemDLL("crypt32.dll")
44
-	moduser32   = NewLazySystemDLL("user32.dll")
45
-	modole32    = NewLazySystemDLL("ole32.dll")
44
+	modnetapi32 = NewLazySystemDLL("netapi32.dll")
46 45
 	modntdll    = NewLazySystemDLL("ntdll.dll")
46
+	modole32    = NewLazySystemDLL("ole32.dll")
47 47
 	modpsapi    = NewLazySystemDLL("psapi.dll")
48
-	modws2_32   = NewLazySystemDLL("ws2_32.dll")
49
-	moddnsapi   = NewLazySystemDLL("dnsapi.dll")
50
-	modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
51 48
 	modsecur32  = NewLazySystemDLL("secur32.dll")
52
-	modnetapi32 = NewLazySystemDLL("netapi32.dll")
49
+	modshell32  = NewLazySystemDLL("shell32.dll")
50
+	moduser32   = NewLazySystemDLL("user32.dll")
51
+	moduserenv  = NewLazySystemDLL("userenv.dll")
52
+	modws2_32   = NewLazySystemDLL("ws2_32.dll")
53 53
 	modwtsapi32 = NewLazySystemDLL("wtsapi32.dll")
54 54
 
55
-	procRegisterEventSourceW                                 = modadvapi32.NewProc("RegisterEventSourceW")
56
-	procDeregisterEventSource                                = modadvapi32.NewProc("DeregisterEventSource")
57
-	procReportEventW                                         = modadvapi32.NewProc("ReportEventW")
58
-	procOpenSCManagerW                                       = modadvapi32.NewProc("OpenSCManagerW")
55
+	procAdjustTokenGroups                                    = modadvapi32.NewProc("AdjustTokenGroups")
56
+	procAdjustTokenPrivileges                                = modadvapi32.NewProc("AdjustTokenPrivileges")
57
+	procAllocateAndInitializeSid                             = modadvapi32.NewProc("AllocateAndInitializeSid")
58
+	procBuildSecurityDescriptorW                             = modadvapi32.NewProc("BuildSecurityDescriptorW")
59
+	procChangeServiceConfig2W                                = modadvapi32.NewProc("ChangeServiceConfig2W")
60
+	procChangeServiceConfigW                                 = modadvapi32.NewProc("ChangeServiceConfigW")
61
+	procCheckTokenMembership                                 = modadvapi32.NewProc("CheckTokenMembership")
59 62
 	procCloseServiceHandle                                   = modadvapi32.NewProc("CloseServiceHandle")
63
+	procControlService                                       = modadvapi32.NewProc("ControlService")
64
+	procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
65
+	procConvertSidToStringSidW                               = modadvapi32.NewProc("ConvertSidToStringSidW")
66
+	procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
67
+	procConvertStringSidToSidW                               = modadvapi32.NewProc("ConvertStringSidToSidW")
68
+	procCopySid                                              = modadvapi32.NewProc("CopySid")
60 69
 	procCreateServiceW                                       = modadvapi32.NewProc("CreateServiceW")
61
-	procOpenServiceW                                         = modadvapi32.NewProc("OpenServiceW")
70
+	procCreateWellKnownSid                                   = modadvapi32.NewProc("CreateWellKnownSid")
71
+	procCryptAcquireContextW                                 = modadvapi32.NewProc("CryptAcquireContextW")
72
+	procCryptGenRandom                                       = modadvapi32.NewProc("CryptGenRandom")
73
+	procCryptReleaseContext                                  = modadvapi32.NewProc("CryptReleaseContext")
62 74
 	procDeleteService                                        = modadvapi32.NewProc("DeleteService")
63
-	procStartServiceW                                        = modadvapi32.NewProc("StartServiceW")
64
-	procQueryServiceStatus                                   = modadvapi32.NewProc("QueryServiceStatus")
65
-	procQueryServiceLockStatusW                              = modadvapi32.NewProc("QueryServiceLockStatusW")
66
-	procControlService                                       = modadvapi32.NewProc("ControlService")
67
-	procStartServiceCtrlDispatcherW                          = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
68
-	procSetServiceStatus                                     = modadvapi32.NewProc("SetServiceStatus")
69
-	procChangeServiceConfigW                                 = modadvapi32.NewProc("ChangeServiceConfigW")
70
-	procQueryServiceConfigW                                  = modadvapi32.NewProc("QueryServiceConfigW")
71
-	procChangeServiceConfig2W                                = modadvapi32.NewProc("ChangeServiceConfig2W")
72
-	procQueryServiceConfig2W                                 = modadvapi32.NewProc("QueryServiceConfig2W")
75
+	procDeregisterEventSource                                = modadvapi32.NewProc("DeregisterEventSource")
76
+	procDuplicateTokenEx                                     = modadvapi32.NewProc("DuplicateTokenEx")
73 77
 	procEnumServicesStatusExW                                = modadvapi32.NewProc("EnumServicesStatusExW")
74
-	procQueryServiceStatusEx                                 = modadvapi32.NewProc("QueryServiceStatusEx")
78
+	procEqualSid                                             = modadvapi32.NewProc("EqualSid")
79
+	procFreeSid                                              = modadvapi32.NewProc("FreeSid")
80
+	procGetLengthSid                                         = modadvapi32.NewProc("GetLengthSid")
81
+	procGetNamedSecurityInfoW                                = modadvapi32.NewProc("GetNamedSecurityInfoW")
82
+	procGetSecurityDescriptorControl                         = modadvapi32.NewProc("GetSecurityDescriptorControl")
83
+	procGetSecurityDescriptorDacl                            = modadvapi32.NewProc("GetSecurityDescriptorDacl")
84
+	procGetSecurityDescriptorGroup                           = modadvapi32.NewProc("GetSecurityDescriptorGroup")
85
+	procGetSecurityDescriptorLength                          = modadvapi32.NewProc("GetSecurityDescriptorLength")
86
+	procGetSecurityDescriptorOwner                           = modadvapi32.NewProc("GetSecurityDescriptorOwner")
87
+	procGetSecurityDescriptorRMControl                       = modadvapi32.NewProc("GetSecurityDescriptorRMControl")
88
+	procGetSecurityDescriptorSacl                            = modadvapi32.NewProc("GetSecurityDescriptorSacl")
89
+	procGetSecurityInfo                                      = modadvapi32.NewProc("GetSecurityInfo")
90
+	procGetSidIdentifierAuthority                            = modadvapi32.NewProc("GetSidIdentifierAuthority")
91
+	procGetSidSubAuthority                                   = modadvapi32.NewProc("GetSidSubAuthority")
92
+	procGetSidSubAuthorityCount                              = modadvapi32.NewProc("GetSidSubAuthorityCount")
93
+	procGetTokenInformation                                  = modadvapi32.NewProc("GetTokenInformation")
94
+	procImpersonateSelf                                      = modadvapi32.NewProc("ImpersonateSelf")
95
+	procInitializeSecurityDescriptor                         = modadvapi32.NewProc("InitializeSecurityDescriptor")
96
+	procInitiateSystemShutdownExW                            = modadvapi32.NewProc("InitiateSystemShutdownExW")
97
+	procIsValidSecurityDescriptor                            = modadvapi32.NewProc("IsValidSecurityDescriptor")
98
+	procIsValidSid                                           = modadvapi32.NewProc("IsValidSid")
99
+	procIsWellKnownSid                                       = modadvapi32.NewProc("IsWellKnownSid")
100
+	procLookupAccountNameW                                   = modadvapi32.NewProc("LookupAccountNameW")
101
+	procLookupAccountSidW                                    = modadvapi32.NewProc("LookupAccountSidW")
102
+	procLookupPrivilegeValueW                                = modadvapi32.NewProc("LookupPrivilegeValueW")
103
+	procMakeAbsoluteSD                                       = modadvapi32.NewProc("MakeAbsoluteSD")
104
+	procMakeSelfRelativeSD                                   = modadvapi32.NewProc("MakeSelfRelativeSD")
75 105
 	procNotifyServiceStatusChangeW                           = modadvapi32.NewProc("NotifyServiceStatusChangeW")
76
-	procGetLastError                                         = modkernel32.NewProc("GetLastError")
77
-	procLoadLibraryW                                         = modkernel32.NewProc("LoadLibraryW")
78
-	procLoadLibraryExW                                       = modkernel32.NewProc("LoadLibraryExW")
79
-	procFreeLibrary                                          = modkernel32.NewProc("FreeLibrary")
80
-	procGetProcAddress                                       = modkernel32.NewProc("GetProcAddress")
81
-	procGetModuleFileNameW                                   = modkernel32.NewProc("GetModuleFileNameW")
82
-	procGetModuleHandleExW                                   = modkernel32.NewProc("GetModuleHandleExW")
83
-	procGetVersion                                           = modkernel32.NewProc("GetVersion")
84
-	procFormatMessageW                                       = modkernel32.NewProc("FormatMessageW")
85
-	procExitProcess                                          = modkernel32.NewProc("ExitProcess")
86
-	procIsWow64Process                                       = modkernel32.NewProc("IsWow64Process")
87
-	procCreateFileW                                          = modkernel32.NewProc("CreateFileW")
88
-	procReadFile                                             = modkernel32.NewProc("ReadFile")
89
-	procWriteFile                                            = modkernel32.NewProc("WriteFile")
90
-	procGetOverlappedResult                                  = modkernel32.NewProc("GetOverlappedResult")
91
-	procSetFilePointer                                       = modkernel32.NewProc("SetFilePointer")
92
-	procCloseHandle                                          = modkernel32.NewProc("CloseHandle")
93
-	procGetStdHandle                                         = modkernel32.NewProc("GetStdHandle")
94
-	procSetStdHandle                                         = modkernel32.NewProc("SetStdHandle")
95
-	procFindFirstFileW                                       = modkernel32.NewProc("FindFirstFileW")
96
-	procFindNextFileW                                        = modkernel32.NewProc("FindNextFileW")
97
-	procFindClose                                            = modkernel32.NewProc("FindClose")
98
-	procGetFileInformationByHandle                           = modkernel32.NewProc("GetFileInformationByHandle")
99
-	procGetFileInformationByHandleEx                         = modkernel32.NewProc("GetFileInformationByHandleEx")
100
-	procGetCurrentDirectoryW                                 = modkernel32.NewProc("GetCurrentDirectoryW")
101
-	procSetCurrentDirectoryW                                 = modkernel32.NewProc("SetCurrentDirectoryW")
102
-	procCreateDirectoryW                                     = modkernel32.NewProc("CreateDirectoryW")
103
-	procRemoveDirectoryW                                     = modkernel32.NewProc("RemoveDirectoryW")
104
-	procDeleteFileW                                          = modkernel32.NewProc("DeleteFileW")
105
-	procMoveFileW                                            = modkernel32.NewProc("MoveFileW")
106
-	procMoveFileExW                                          = modkernel32.NewProc("MoveFileExW")
107
-	procLockFileEx                                           = modkernel32.NewProc("LockFileEx")
108
-	procUnlockFileEx                                         = modkernel32.NewProc("UnlockFileEx")
109
-	procGetComputerNameW                                     = modkernel32.NewProc("GetComputerNameW")
110
-	procGetComputerNameExW                                   = modkernel32.NewProc("GetComputerNameExW")
111
-	procSetEndOfFile                                         = modkernel32.NewProc("SetEndOfFile")
112
-	procGetSystemTimeAsFileTime                              = modkernel32.NewProc("GetSystemTimeAsFileTime")
113
-	procGetSystemTimePreciseAsFileTime                       = modkernel32.NewProc("GetSystemTimePreciseAsFileTime")
114
-	procGetTimeZoneInformation                               = modkernel32.NewProc("GetTimeZoneInformation")
115
-	procCreateIoCompletionPort                               = modkernel32.NewProc("CreateIoCompletionPort")
116
-	procGetQueuedCompletionStatus                            = modkernel32.NewProc("GetQueuedCompletionStatus")
117
-	procPostQueuedCompletionStatus                           = modkernel32.NewProc("PostQueuedCompletionStatus")
118
-	procCancelIo                                             = modkernel32.NewProc("CancelIo")
119
-	procCancelIoEx                                           = modkernel32.NewProc("CancelIoEx")
120
-	procCreateProcessW                                       = modkernel32.NewProc("CreateProcessW")
121
-	procOpenProcess                                          = modkernel32.NewProc("OpenProcess")
122
-	procShellExecuteW                                        = modshell32.NewProc("ShellExecuteW")
123
-	procSHGetKnownFolderPath                                 = modshell32.NewProc("SHGetKnownFolderPath")
124
-	procTerminateProcess                                     = modkernel32.NewProc("TerminateProcess")
125
-	procGetExitCodeProcess                                   = modkernel32.NewProc("GetExitCodeProcess")
126
-	procGetStartupInfoW                                      = modkernel32.NewProc("GetStartupInfoW")
127
-	procGetProcessTimes                                      = modkernel32.NewProc("GetProcessTimes")
128
-	procDuplicateHandle                                      = modkernel32.NewProc("DuplicateHandle")
129
-	procWaitForSingleObject                                  = modkernel32.NewProc("WaitForSingleObject")
130
-	procWaitForMultipleObjects                               = modkernel32.NewProc("WaitForMultipleObjects")
131
-	procGetTempPathW                                         = modkernel32.NewProc("GetTempPathW")
132
-	procCreatePipe                                           = modkernel32.NewProc("CreatePipe")
133
-	procGetFileType                                          = modkernel32.NewProc("GetFileType")
134
-	procCryptAcquireContextW                                 = modadvapi32.NewProc("CryptAcquireContextW")
135
-	procCryptReleaseContext                                  = modadvapi32.NewProc("CryptReleaseContext")
136
-	procCryptGenRandom                                       = modadvapi32.NewProc("CryptGenRandom")
137
-	procGetEnvironmentStringsW                               = modkernel32.NewProc("GetEnvironmentStringsW")
138
-	procFreeEnvironmentStringsW                              = modkernel32.NewProc("FreeEnvironmentStringsW")
139
-	procGetEnvironmentVariableW                              = modkernel32.NewProc("GetEnvironmentVariableW")
140
-	procSetEnvironmentVariableW                              = modkernel32.NewProc("SetEnvironmentVariableW")
141
-	procCreateEnvironmentBlock                               = moduserenv.NewProc("CreateEnvironmentBlock")
142
-	procDestroyEnvironmentBlock                              = moduserenv.NewProc("DestroyEnvironmentBlock")
143
-	procGetTickCount64                                       = modkernel32.NewProc("GetTickCount64")
144
-	procSetFileTime                                          = modkernel32.NewProc("SetFileTime")
145
-	procGetFileAttributesW                                   = modkernel32.NewProc("GetFileAttributesW")
146
-	procSetFileAttributesW                                   = modkernel32.NewProc("SetFileAttributesW")
147
-	procGetFileAttributesExW                                 = modkernel32.NewProc("GetFileAttributesExW")
148
-	procGetCommandLineW                                      = modkernel32.NewProc("GetCommandLineW")
149
-	procCommandLineToArgvW                                   = modshell32.NewProc("CommandLineToArgvW")
150
-	procLocalFree                                            = modkernel32.NewProc("LocalFree")
151
-	procSetHandleInformation                                 = modkernel32.NewProc("SetHandleInformation")
152
-	procFlushFileBuffers                                     = modkernel32.NewProc("FlushFileBuffers")
153
-	procGetFullPathNameW                                     = modkernel32.NewProc("GetFullPathNameW")
154
-	procGetLongPathNameW                                     = modkernel32.NewProc("GetLongPathNameW")
155
-	procGetShortPathNameW                                    = modkernel32.NewProc("GetShortPathNameW")
156
-	procCreateFileMappingW                                   = modkernel32.NewProc("CreateFileMappingW")
157
-	procMapViewOfFile                                        = modkernel32.NewProc("MapViewOfFile")
158
-	procUnmapViewOfFile                                      = modkernel32.NewProc("UnmapViewOfFile")
159
-	procFlushViewOfFile                                      = modkernel32.NewProc("FlushViewOfFile")
160
-	procVirtualLock                                          = modkernel32.NewProc("VirtualLock")
161
-	procVirtualUnlock                                        = modkernel32.NewProc("VirtualUnlock")
162
-	procVirtualAlloc                                         = modkernel32.NewProc("VirtualAlloc")
163
-	procVirtualFree                                          = modkernel32.NewProc("VirtualFree")
164
-	procVirtualProtect                                       = modkernel32.NewProc("VirtualProtect")
165
-	procTransmitFile                                         = modmswsock.NewProc("TransmitFile")
166
-	procReadDirectoryChangesW                                = modkernel32.NewProc("ReadDirectoryChangesW")
167
-	procCertOpenSystemStoreW                                 = modcrypt32.NewProc("CertOpenSystemStoreW")
168
-	procCertOpenStore                                        = modcrypt32.NewProc("CertOpenStore")
169
-	procCertEnumCertificatesInStore                          = modcrypt32.NewProc("CertEnumCertificatesInStore")
106
+	procOpenProcessToken                                     = modadvapi32.NewProc("OpenProcessToken")
107
+	procOpenSCManagerW                                       = modadvapi32.NewProc("OpenSCManagerW")
108
+	procOpenServiceW                                         = modadvapi32.NewProc("OpenServiceW")
109
+	procOpenThreadToken                                      = modadvapi32.NewProc("OpenThreadToken")
110
+	procQueryServiceConfig2W                                 = modadvapi32.NewProc("QueryServiceConfig2W")
111
+	procQueryServiceConfigW                                  = modadvapi32.NewProc("QueryServiceConfigW")
112
+	procQueryServiceLockStatusW                              = modadvapi32.NewProc("QueryServiceLockStatusW")
113
+	procQueryServiceStatus                                   = modadvapi32.NewProc("QueryServiceStatus")
114
+	procQueryServiceStatusEx                                 = modadvapi32.NewProc("QueryServiceStatusEx")
115
+	procRegCloseKey                                          = modadvapi32.NewProc("RegCloseKey")
116
+	procRegEnumKeyExW                                        = modadvapi32.NewProc("RegEnumKeyExW")
117
+	procRegOpenKeyExW                                        = modadvapi32.NewProc("RegOpenKeyExW")
118
+	procRegQueryInfoKeyW                                     = modadvapi32.NewProc("RegQueryInfoKeyW")
119
+	procRegQueryValueExW                                     = modadvapi32.NewProc("RegQueryValueExW")
120
+	procRegisterEventSourceW                                 = modadvapi32.NewProc("RegisterEventSourceW")
121
+	procReportEventW                                         = modadvapi32.NewProc("ReportEventW")
122
+	procRevertToSelf                                         = modadvapi32.NewProc("RevertToSelf")
123
+	procSetEntriesInAclW                                     = modadvapi32.NewProc("SetEntriesInAclW")
124
+	procSetNamedSecurityInfoW                                = modadvapi32.NewProc("SetNamedSecurityInfoW")
125
+	procSetSecurityDescriptorControl                         = modadvapi32.NewProc("SetSecurityDescriptorControl")
126
+	procSetSecurityDescriptorDacl                            = modadvapi32.NewProc("SetSecurityDescriptorDacl")
127
+	procSetSecurityDescriptorGroup                           = modadvapi32.NewProc("SetSecurityDescriptorGroup")
128
+	procSetSecurityDescriptorOwner                           = modadvapi32.NewProc("SetSecurityDescriptorOwner")
129
+	procSetSecurityDescriptorRMControl                       = modadvapi32.NewProc("SetSecurityDescriptorRMControl")
130
+	procSetSecurityDescriptorSacl                            = modadvapi32.NewProc("SetSecurityDescriptorSacl")
131
+	procSetSecurityInfo                                      = modadvapi32.NewProc("SetSecurityInfo")
132
+	procSetServiceStatus                                     = modadvapi32.NewProc("SetServiceStatus")
133
+	procSetThreadToken                                       = modadvapi32.NewProc("SetThreadToken")
134
+	procSetTokenInformation                                  = modadvapi32.NewProc("SetTokenInformation")
135
+	procStartServiceCtrlDispatcherW                          = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
136
+	procStartServiceW                                        = modadvapi32.NewProc("StartServiceW")
170 137
 	procCertAddCertificateContextToStore                     = modcrypt32.NewProc("CertAddCertificateContextToStore")
171 138
 	procCertCloseStore                                       = modcrypt32.NewProc("CertCloseStore")
172
-	procCertGetCertificateChain                              = modcrypt32.NewProc("CertGetCertificateChain")
173
-	procCertFreeCertificateChain                             = modcrypt32.NewProc("CertFreeCertificateChain")
174 139
 	procCertCreateCertificateContext                         = modcrypt32.NewProc("CertCreateCertificateContext")
140
+	procCertEnumCertificatesInStore                          = modcrypt32.NewProc("CertEnumCertificatesInStore")
141
+	procCertFreeCertificateChain                             = modcrypt32.NewProc("CertFreeCertificateChain")
175 142
 	procCertFreeCertificateContext                           = modcrypt32.NewProc("CertFreeCertificateContext")
143
+	procCertGetCertificateChain                              = modcrypt32.NewProc("CertGetCertificateChain")
144
+	procCertOpenStore                                        = modcrypt32.NewProc("CertOpenStore")
145
+	procCertOpenSystemStoreW                                 = modcrypt32.NewProc("CertOpenSystemStoreW")
176 146
 	procCertVerifyCertificateChainPolicy                     = modcrypt32.NewProc("CertVerifyCertificateChainPolicy")
177
-	procRegOpenKeyExW                                        = modadvapi32.NewProc("RegOpenKeyExW")
178
-	procRegCloseKey                                          = modadvapi32.NewProc("RegCloseKey")
179
-	procRegQueryInfoKeyW                                     = modadvapi32.NewProc("RegQueryInfoKeyW")
180
-	procRegEnumKeyExW                                        = modadvapi32.NewProc("RegEnumKeyExW")
181
-	procRegQueryValueExW                                     = modadvapi32.NewProc("RegQueryValueExW")
182
-	procGetCurrentProcessId                                  = modkernel32.NewProc("GetCurrentProcessId")
183
-	procGetConsoleMode                                       = modkernel32.NewProc("GetConsoleMode")
184
-	procSetConsoleMode                                       = modkernel32.NewProc("SetConsoleMode")
185
-	procGetConsoleScreenBufferInfo                           = modkernel32.NewProc("GetConsoleScreenBufferInfo")
186
-	procWriteConsoleW                                        = modkernel32.NewProc("WriteConsoleW")
187
-	procReadConsoleW                                         = modkernel32.NewProc("ReadConsoleW")
188
-	procCreateToolhelp32Snapshot                             = modkernel32.NewProc("CreateToolhelp32Snapshot")
189
-	procProcess32FirstW                                      = modkernel32.NewProc("Process32FirstW")
190
-	procProcess32NextW                                       = modkernel32.NewProc("Process32NextW")
191
-	procThread32First                                        = modkernel32.NewProc("Thread32First")
192
-	procThread32Next                                         = modkernel32.NewProc("Thread32Next")
193
-	procDeviceIoControl                                      = modkernel32.NewProc("DeviceIoControl")
194
-	procCreateSymbolicLinkW                                  = modkernel32.NewProc("CreateSymbolicLinkW")
195
-	procCreateHardLinkW                                      = modkernel32.NewProc("CreateHardLinkW")
196
-	procGetCurrentThreadId                                   = modkernel32.NewProc("GetCurrentThreadId")
197
-	procCreateEventW                                         = modkernel32.NewProc("CreateEventW")
147
+	procDnsNameCompare_W                                     = moddnsapi.NewProc("DnsNameCompare_W")
148
+	procDnsQuery_W                                           = moddnsapi.NewProc("DnsQuery_W")
149
+	procDnsRecordListFree                                    = moddnsapi.NewProc("DnsRecordListFree")
150
+	procGetAdaptersAddresses                                 = modiphlpapi.NewProc("GetAdaptersAddresses")
151
+	procGetAdaptersInfo                                      = modiphlpapi.NewProc("GetAdaptersInfo")
152
+	procGetIfEntry                                           = modiphlpapi.NewProc("GetIfEntry")
153
+	procAssignProcessToJobObject                             = modkernel32.NewProc("AssignProcessToJobObject")
154
+	procCancelIo                                             = modkernel32.NewProc("CancelIo")
155
+	procCancelIoEx                                           = modkernel32.NewProc("CancelIoEx")
156
+	procCloseHandle                                          = modkernel32.NewProc("CloseHandle")
157
+	procCreateDirectoryW                                     = modkernel32.NewProc("CreateDirectoryW")
198 158
 	procCreateEventExW                                       = modkernel32.NewProc("CreateEventExW")
199
-	procOpenEventW                                           = modkernel32.NewProc("OpenEventW")
200
-	procSetEvent                                             = modkernel32.NewProc("SetEvent")
201
-	procResetEvent                                           = modkernel32.NewProc("ResetEvent")
202
-	procPulseEvent                                           = modkernel32.NewProc("PulseEvent")
203
-	procCreateMutexW                                         = modkernel32.NewProc("CreateMutexW")
204
-	procCreateMutexExW                                       = modkernel32.NewProc("CreateMutexExW")
205
-	procOpenMutexW                                           = modkernel32.NewProc("OpenMutexW")
206
-	procReleaseMutex                                         = modkernel32.NewProc("ReleaseMutex")
207
-	procSleepEx                                              = modkernel32.NewProc("SleepEx")
159
+	procCreateEventW                                         = modkernel32.NewProc("CreateEventW")
160
+	procCreateFileMappingW                                   = modkernel32.NewProc("CreateFileMappingW")
161
+	procCreateFileW                                          = modkernel32.NewProc("CreateFileW")
162
+	procCreateHardLinkW                                      = modkernel32.NewProc("CreateHardLinkW")
163
+	procCreateIoCompletionPort                               = modkernel32.NewProc("CreateIoCompletionPort")
208 164
 	procCreateJobObjectW                                     = modkernel32.NewProc("CreateJobObjectW")
209
-	procAssignProcessToJobObject                             = modkernel32.NewProc("AssignProcessToJobObject")
210
-	procTerminateJobObject                                   = modkernel32.NewProc("TerminateJobObject")
211
-	procSetErrorMode                                         = modkernel32.NewProc("SetErrorMode")
212
-	procResumeThread                                         = modkernel32.NewProc("ResumeThread")
213
-	procSetPriorityClass                                     = modkernel32.NewProc("SetPriorityClass")
214
-	procGetPriorityClass                                     = modkernel32.NewProc("GetPriorityClass")
215
-	procQueryInformationJobObject                            = modkernel32.NewProc("QueryInformationJobObject")
216
-	procSetInformationJobObject                              = modkernel32.NewProc("SetInformationJobObject")
217
-	procGenerateConsoleCtrlEvent                             = modkernel32.NewProc("GenerateConsoleCtrlEvent")
218
-	procGetProcessId                                         = modkernel32.NewProc("GetProcessId")
219
-	procOpenThread                                           = modkernel32.NewProc("OpenThread")
220
-	procSetProcessPriorityBoost                              = modkernel32.NewProc("SetProcessPriorityBoost")
221
-	procGetProcessWorkingSetSizeEx                           = modkernel32.NewProc("GetProcessWorkingSetSizeEx")
222
-	procSetProcessWorkingSetSizeEx                           = modkernel32.NewProc("SetProcessWorkingSetSizeEx")
165
+	procCreateMutexExW                                       = modkernel32.NewProc("CreateMutexExW")
166
+	procCreateMutexW                                         = modkernel32.NewProc("CreateMutexW")
167
+	procCreatePipe                                           = modkernel32.NewProc("CreatePipe")
168
+	procCreateProcessW                                       = modkernel32.NewProc("CreateProcessW")
169
+	procCreateSymbolicLinkW                                  = modkernel32.NewProc("CreateSymbolicLinkW")
170
+	procCreateToolhelp32Snapshot                             = modkernel32.NewProc("CreateToolhelp32Snapshot")
223 171
 	procDefineDosDeviceW                                     = modkernel32.NewProc("DefineDosDeviceW")
172
+	procDeleteFileW                                          = modkernel32.NewProc("DeleteFileW")
224 173
 	procDeleteVolumeMountPointW                              = modkernel32.NewProc("DeleteVolumeMountPointW")
225
-	procFindFirstVolumeW                                     = modkernel32.NewProc("FindFirstVolumeW")
174
+	procDeviceIoControl                                      = modkernel32.NewProc("DeviceIoControl")
175
+	procDuplicateHandle                                      = modkernel32.NewProc("DuplicateHandle")
176
+	procExitProcess                                          = modkernel32.NewProc("ExitProcess")
177
+	procFindClose                                            = modkernel32.NewProc("FindClose")
178
+	procFindFirstFileW                                       = modkernel32.NewProc("FindFirstFileW")
226 179
 	procFindFirstVolumeMountPointW                           = modkernel32.NewProc("FindFirstVolumeMountPointW")
227
-	procFindNextVolumeW                                      = modkernel32.NewProc("FindNextVolumeW")
180
+	procFindFirstVolumeW                                     = modkernel32.NewProc("FindFirstVolumeW")
181
+	procFindNextFileW                                        = modkernel32.NewProc("FindNextFileW")
228 182
 	procFindNextVolumeMountPointW                            = modkernel32.NewProc("FindNextVolumeMountPointW")
183
+	procFindNextVolumeW                                      = modkernel32.NewProc("FindNextVolumeW")
229 184
 	procFindVolumeClose                                      = modkernel32.NewProc("FindVolumeClose")
230 185
 	procFindVolumeMountPointClose                            = modkernel32.NewProc("FindVolumeMountPointClose")
186
+	procFlushFileBuffers                                     = modkernel32.NewProc("FlushFileBuffers")
187
+	procFlushViewOfFile                                      = modkernel32.NewProc("FlushViewOfFile")
188
+	procFormatMessageW                                       = modkernel32.NewProc("FormatMessageW")
189
+	procFreeEnvironmentStringsW                              = modkernel32.NewProc("FreeEnvironmentStringsW")
190
+	procFreeLibrary                                          = modkernel32.NewProc("FreeLibrary")
191
+	procGenerateConsoleCtrlEvent                             = modkernel32.NewProc("GenerateConsoleCtrlEvent")
192
+	procGetACP                                               = modkernel32.NewProc("GetACP")
193
+	procGetCommandLineW                                      = modkernel32.NewProc("GetCommandLineW")
194
+	procGetComputerNameExW                                   = modkernel32.NewProc("GetComputerNameExW")
195
+	procGetComputerNameW                                     = modkernel32.NewProc("GetComputerNameW")
196
+	procGetConsoleMode                                       = modkernel32.NewProc("GetConsoleMode")
197
+	procGetConsoleScreenBufferInfo                           = modkernel32.NewProc("GetConsoleScreenBufferInfo")
198
+	procGetCurrentDirectoryW                                 = modkernel32.NewProc("GetCurrentDirectoryW")
199
+	procGetCurrentProcessId                                  = modkernel32.NewProc("GetCurrentProcessId")
200
+	procGetCurrentThreadId                                   = modkernel32.NewProc("GetCurrentThreadId")
231 201
 	procGetDiskFreeSpaceExW                                  = modkernel32.NewProc("GetDiskFreeSpaceExW")
232 202
 	procGetDriveTypeW                                        = modkernel32.NewProc("GetDriveTypeW")
233
-	procGetLogicalDrives                                     = modkernel32.NewProc("GetLogicalDrives")
203
+	procGetEnvironmentStringsW                               = modkernel32.NewProc("GetEnvironmentStringsW")
204
+	procGetEnvironmentVariableW                              = modkernel32.NewProc("GetEnvironmentVariableW")
205
+	procGetExitCodeProcess                                   = modkernel32.NewProc("GetExitCodeProcess")
206
+	procGetFileAttributesExW                                 = modkernel32.NewProc("GetFileAttributesExW")
207
+	procGetFileAttributesW                                   = modkernel32.NewProc("GetFileAttributesW")
208
+	procGetFileInformationByHandle                           = modkernel32.NewProc("GetFileInformationByHandle")
209
+	procGetFileInformationByHandleEx                         = modkernel32.NewProc("GetFileInformationByHandleEx")
210
+	procGetFileType                                          = modkernel32.NewProc("GetFileType")
211
+	procGetFullPathNameW                                     = modkernel32.NewProc("GetFullPathNameW")
212
+	procGetLastError                                         = modkernel32.NewProc("GetLastError")
234 213
 	procGetLogicalDriveStringsW                              = modkernel32.NewProc("GetLogicalDriveStringsW")
235
-	procGetVolumeInformationW                                = modkernel32.NewProc("GetVolumeInformationW")
214
+	procGetLogicalDrives                                     = modkernel32.NewProc("GetLogicalDrives")
215
+	procGetLongPathNameW                                     = modkernel32.NewProc("GetLongPathNameW")
216
+	procGetModuleFileNameW                                   = modkernel32.NewProc("GetModuleFileNameW")
217
+	procGetModuleHandleExW                                   = modkernel32.NewProc("GetModuleHandleExW")
218
+	procGetOverlappedResult                                  = modkernel32.NewProc("GetOverlappedResult")
219
+	procGetPriorityClass                                     = modkernel32.NewProc("GetPriorityClass")
220
+	procGetProcAddress                                       = modkernel32.NewProc("GetProcAddress")
221
+	procGetProcessId                                         = modkernel32.NewProc("GetProcessId")
222
+	procGetProcessPreferredUILanguages                       = modkernel32.NewProc("GetProcessPreferredUILanguages")
223
+	procGetProcessShutdownParameters                         = modkernel32.NewProc("GetProcessShutdownParameters")
224
+	procGetProcessTimes                                      = modkernel32.NewProc("GetProcessTimes")
225
+	procGetProcessWorkingSetSizeEx                           = modkernel32.NewProc("GetProcessWorkingSetSizeEx")
226
+	procGetQueuedCompletionStatus                            = modkernel32.NewProc("GetQueuedCompletionStatus")
227
+	procGetShortPathNameW                                    = modkernel32.NewProc("GetShortPathNameW")
228
+	procGetStartupInfoW                                      = modkernel32.NewProc("GetStartupInfoW")
229
+	procGetStdHandle                                         = modkernel32.NewProc("GetStdHandle")
230
+	procGetSystemDirectoryW                                  = modkernel32.NewProc("GetSystemDirectoryW")
231
+	procGetSystemPreferredUILanguages                        = modkernel32.NewProc("GetSystemPreferredUILanguages")
232
+	procGetSystemTimeAsFileTime                              = modkernel32.NewProc("GetSystemTimeAsFileTime")
233
+	procGetSystemTimePreciseAsFileTime                       = modkernel32.NewProc("GetSystemTimePreciseAsFileTime")
234
+	procGetSystemWindowsDirectoryW                           = modkernel32.NewProc("GetSystemWindowsDirectoryW")
235
+	procGetTempPathW                                         = modkernel32.NewProc("GetTempPathW")
236
+	procGetThreadPreferredUILanguages                        = modkernel32.NewProc("GetThreadPreferredUILanguages")
237
+	procGetTickCount64                                       = modkernel32.NewProc("GetTickCount64")
238
+	procGetTimeZoneInformation                               = modkernel32.NewProc("GetTimeZoneInformation")
239
+	procGetUserPreferredUILanguages                          = modkernel32.NewProc("GetUserPreferredUILanguages")
240
+	procGetVersion                                           = modkernel32.NewProc("GetVersion")
236 241
 	procGetVolumeInformationByHandleW                        = modkernel32.NewProc("GetVolumeInformationByHandleW")
242
+	procGetVolumeInformationW                                = modkernel32.NewProc("GetVolumeInformationW")
237 243
 	procGetVolumeNameForVolumeMountPointW                    = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW")
238 244
 	procGetVolumePathNameW                                   = modkernel32.NewProc("GetVolumePathNameW")
239 245
 	procGetVolumePathNamesForVolumeNameW                     = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW")
246
+	procGetWindowsDirectoryW                                 = modkernel32.NewProc("GetWindowsDirectoryW")
247
+	procIsWow64Process                                       = modkernel32.NewProc("IsWow64Process")
248
+	procLoadLibraryExW                                       = modkernel32.NewProc("LoadLibraryExW")
249
+	procLoadLibraryW                                         = modkernel32.NewProc("LoadLibraryW")
250
+	procLocalFree                                            = modkernel32.NewProc("LocalFree")
251
+	procLockFileEx                                           = modkernel32.NewProc("LockFileEx")
252
+	procMapViewOfFile                                        = modkernel32.NewProc("MapViewOfFile")
253
+	procMoveFileExW                                          = modkernel32.NewProc("MoveFileExW")
254
+	procMoveFileW                                            = modkernel32.NewProc("MoveFileW")
255
+	procMultiByteToWideChar                                  = modkernel32.NewProc("MultiByteToWideChar")
256
+	procOpenEventW                                           = modkernel32.NewProc("OpenEventW")
257
+	procOpenMutexW                                           = modkernel32.NewProc("OpenMutexW")
258
+	procOpenProcess                                          = modkernel32.NewProc("OpenProcess")
259
+	procOpenThread                                           = modkernel32.NewProc("OpenThread")
260
+	procPostQueuedCompletionStatus                           = modkernel32.NewProc("PostQueuedCompletionStatus")
261
+	procProcess32FirstW                                      = modkernel32.NewProc("Process32FirstW")
262
+	procProcess32NextW                                       = modkernel32.NewProc("Process32NextW")
263
+	procProcessIdToSessionId                                 = modkernel32.NewProc("ProcessIdToSessionId")
264
+	procPulseEvent                                           = modkernel32.NewProc("PulseEvent")
240 265
 	procQueryDosDeviceW                                      = modkernel32.NewProc("QueryDosDeviceW")
266
+	procQueryInformationJobObject                            = modkernel32.NewProc("QueryInformationJobObject")
267
+	procReadConsoleW                                         = modkernel32.NewProc("ReadConsoleW")
268
+	procReadDirectoryChangesW                                = modkernel32.NewProc("ReadDirectoryChangesW")
269
+	procReadFile                                             = modkernel32.NewProc("ReadFile")
270
+	procReleaseMutex                                         = modkernel32.NewProc("ReleaseMutex")
271
+	procRemoveDirectoryW                                     = modkernel32.NewProc("RemoveDirectoryW")
272
+	procResetEvent                                           = modkernel32.NewProc("ResetEvent")
273
+	procResumeThread                                         = modkernel32.NewProc("ResumeThread")
274
+	procSetConsoleCursorPosition                             = modkernel32.NewProc("SetConsoleCursorPosition")
275
+	procSetConsoleMode                                       = modkernel32.NewProc("SetConsoleMode")
276
+	procSetCurrentDirectoryW                                 = modkernel32.NewProc("SetCurrentDirectoryW")
277
+	procSetEndOfFile                                         = modkernel32.NewProc("SetEndOfFile")
278
+	procSetEnvironmentVariableW                              = modkernel32.NewProc("SetEnvironmentVariableW")
279
+	procSetErrorMode                                         = modkernel32.NewProc("SetErrorMode")
280
+	procSetEvent                                             = modkernel32.NewProc("SetEvent")
281
+	procSetFileAttributesW                                   = modkernel32.NewProc("SetFileAttributesW")
282
+	procSetFileCompletionNotificationModes                   = modkernel32.NewProc("SetFileCompletionNotificationModes")
283
+	procSetFilePointer                                       = modkernel32.NewProc("SetFilePointer")
284
+	procSetFileTime                                          = modkernel32.NewProc("SetFileTime")
285
+	procSetHandleInformation                                 = modkernel32.NewProc("SetHandleInformation")
286
+	procSetInformationJobObject                              = modkernel32.NewProc("SetInformationJobObject")
287
+	procSetPriorityClass                                     = modkernel32.NewProc("SetPriorityClass")
288
+	procSetProcessPriorityBoost                              = modkernel32.NewProc("SetProcessPriorityBoost")
289
+	procSetProcessShutdownParameters                         = modkernel32.NewProc("SetProcessShutdownParameters")
290
+	procSetProcessWorkingSetSizeEx                           = modkernel32.NewProc("SetProcessWorkingSetSizeEx")
291
+	procSetStdHandle                                         = modkernel32.NewProc("SetStdHandle")
241 292
 	procSetVolumeLabelW                                      = modkernel32.NewProc("SetVolumeLabelW")
242 293
 	procSetVolumeMountPointW                                 = modkernel32.NewProc("SetVolumeMountPointW")
243
-	procMessageBoxW                                          = moduser32.NewProc("MessageBoxW")
244
-	procExitWindowsEx                                        = moduser32.NewProc("ExitWindowsEx")
245
-	procInitiateSystemShutdownExW                            = modadvapi32.NewProc("InitiateSystemShutdownExW")
246
-	procSetProcessShutdownParameters                         = modkernel32.NewProc("SetProcessShutdownParameters")
247
-	procGetProcessShutdownParameters                         = modkernel32.NewProc("GetProcessShutdownParameters")
294
+	procSleepEx                                              = modkernel32.NewProc("SleepEx")
295
+	procTerminateJobObject                                   = modkernel32.NewProc("TerminateJobObject")
296
+	procTerminateProcess                                     = modkernel32.NewProc("TerminateProcess")
297
+	procThread32First                                        = modkernel32.NewProc("Thread32First")
298
+	procThread32Next                                         = modkernel32.NewProc("Thread32Next")
299
+	procUnlockFileEx                                         = modkernel32.NewProc("UnlockFileEx")
300
+	procUnmapViewOfFile                                      = modkernel32.NewProc("UnmapViewOfFile")
301
+	procVirtualAlloc                                         = modkernel32.NewProc("VirtualAlloc")
302
+	procVirtualFree                                          = modkernel32.NewProc("VirtualFree")
303
+	procVirtualLock                                          = modkernel32.NewProc("VirtualLock")
304
+	procVirtualProtect                                       = modkernel32.NewProc("VirtualProtect")
305
+	procVirtualUnlock                                        = modkernel32.NewProc("VirtualUnlock")
306
+	procWaitForMultipleObjects                               = modkernel32.NewProc("WaitForMultipleObjects")
307
+	procWaitForSingleObject                                  = modkernel32.NewProc("WaitForSingleObject")
308
+	procWriteConsoleW                                        = modkernel32.NewProc("WriteConsoleW")
309
+	procWriteFile                                            = modkernel32.NewProc("WriteFile")
310
+	procAcceptEx                                             = modmswsock.NewProc("AcceptEx")
311
+	procGetAcceptExSockaddrs                                 = modmswsock.NewProc("GetAcceptExSockaddrs")
312
+	procTransmitFile                                         = modmswsock.NewProc("TransmitFile")
313
+	procNetApiBufferFree                                     = modnetapi32.NewProc("NetApiBufferFree")
314
+	procNetGetJoinInformation                                = modnetapi32.NewProc("NetGetJoinInformation")
315
+	procNetUserGetInfo                                       = modnetapi32.NewProc("NetUserGetInfo")
316
+	procRtlGetNtVersionNumbers                               = modntdll.NewProc("RtlGetNtVersionNumbers")
317
+	procRtlGetVersion                                        = modntdll.NewProc("RtlGetVersion")
248 318
 	procCLSIDFromString                                      = modole32.NewProc("CLSIDFromString")
249
-	procStringFromGUID2                                      = modole32.NewProc("StringFromGUID2")
250 319
 	procCoCreateGuid                                         = modole32.NewProc("CoCreateGuid")
251 320
 	procCoTaskMemFree                                        = modole32.NewProc("CoTaskMemFree")
252
-	procRtlGetVersion                                        = modntdll.NewProc("RtlGetVersion")
253
-	procRtlGetNtVersionNumbers                               = modntdll.NewProc("RtlGetNtVersionNumbers")
254
-	procGetProcessPreferredUILanguages                       = modkernel32.NewProc("GetProcessPreferredUILanguages")
255
-	procGetThreadPreferredUILanguages                        = modkernel32.NewProc("GetThreadPreferredUILanguages")
256
-	procGetUserPreferredUILanguages                          = modkernel32.NewProc("GetUserPreferredUILanguages")
257
-	procGetSystemPreferredUILanguages                        = modkernel32.NewProc("GetSystemPreferredUILanguages")
321
+	procStringFromGUID2                                      = modole32.NewProc("StringFromGUID2")
258 322
 	procEnumProcesses                                        = modpsapi.NewProc("EnumProcesses")
259
-	procWSAStartup                                           = modws2_32.NewProc("WSAStartup")
323
+	procGetUserNameExW                                       = modsecur32.NewProc("GetUserNameExW")
324
+	procTranslateNameW                                       = modsecur32.NewProc("TranslateNameW")
325
+	procCommandLineToArgvW                                   = modshell32.NewProc("CommandLineToArgvW")
326
+	procSHGetKnownFolderPath                                 = modshell32.NewProc("SHGetKnownFolderPath")
327
+	procShellExecuteW                                        = modshell32.NewProc("ShellExecuteW")
328
+	procExitWindowsEx                                        = moduser32.NewProc("ExitWindowsEx")
329
+	procMessageBoxW                                          = moduser32.NewProc("MessageBoxW")
330
+	procCreateEnvironmentBlock                               = moduserenv.NewProc("CreateEnvironmentBlock")
331
+	procDestroyEnvironmentBlock                              = moduserenv.NewProc("DestroyEnvironmentBlock")
332
+	procGetUserProfileDirectoryW                             = moduserenv.NewProc("GetUserProfileDirectoryW")
333
+	procFreeAddrInfoW                                        = modws2_32.NewProc("FreeAddrInfoW")
334
+	procGetAddrInfoW                                         = modws2_32.NewProc("GetAddrInfoW")
260 335
 	procWSACleanup                                           = modws2_32.NewProc("WSACleanup")
336
+	procWSAEnumProtocolsW                                    = modws2_32.NewProc("WSAEnumProtocolsW")
261 337
 	procWSAIoctl                                             = modws2_32.NewProc("WSAIoctl")
262
-	procsocket                                               = modws2_32.NewProc("socket")
263
-	procsendto                                               = modws2_32.NewProc("sendto")
264
-	procrecvfrom                                             = modws2_32.NewProc("recvfrom")
265
-	procsetsockopt                                           = modws2_32.NewProc("setsockopt")
266
-	procgetsockopt                                           = modws2_32.NewProc("getsockopt")
267
-	procbind                                                 = modws2_32.NewProc("bind")
268
-	procconnect                                              = modws2_32.NewProc("connect")
269
-	procgetsockname                                          = modws2_32.NewProc("getsockname")
270
-	procgetpeername                                          = modws2_32.NewProc("getpeername")
271
-	proclisten                                               = modws2_32.NewProc("listen")
272
-	procshutdown                                             = modws2_32.NewProc("shutdown")
273
-	procclosesocket                                          = modws2_32.NewProc("closesocket")
274
-	procAcceptEx                                             = modmswsock.NewProc("AcceptEx")
275
-	procGetAcceptExSockaddrs                                 = modmswsock.NewProc("GetAcceptExSockaddrs")
276 338
 	procWSARecv                                              = modws2_32.NewProc("WSARecv")
277
-	procWSASend                                              = modws2_32.NewProc("WSASend")
278 339
 	procWSARecvFrom                                          = modws2_32.NewProc("WSARecvFrom")
340
+	procWSASend                                              = modws2_32.NewProc("WSASend")
279 341
 	procWSASendTo                                            = modws2_32.NewProc("WSASendTo")
342
+	procWSAStartup                                           = modws2_32.NewProc("WSAStartup")
343
+	procbind                                                 = modws2_32.NewProc("bind")
344
+	procclosesocket                                          = modws2_32.NewProc("closesocket")
345
+	procconnect                                              = modws2_32.NewProc("connect")
280 346
 	procgethostbyname                                        = modws2_32.NewProc("gethostbyname")
347
+	procgetpeername                                          = modws2_32.NewProc("getpeername")
348
+	procgetprotobyname                                       = modws2_32.NewProc("getprotobyname")
281 349
 	procgetservbyname                                        = modws2_32.NewProc("getservbyname")
350
+	procgetsockname                                          = modws2_32.NewProc("getsockname")
351
+	procgetsockopt                                           = modws2_32.NewProc("getsockopt")
352
+	proclisten                                               = modws2_32.NewProc("listen")
282 353
 	procntohs                                                = modws2_32.NewProc("ntohs")
283
-	procgetprotobyname                                       = modws2_32.NewProc("getprotobyname")
284
-	procDnsQuery_W                                           = moddnsapi.NewProc("DnsQuery_W")
285
-	procDnsRecordListFree                                    = moddnsapi.NewProc("DnsRecordListFree")
286
-	procDnsNameCompare_W                                     = moddnsapi.NewProc("DnsNameCompare_W")
287
-	procGetAddrInfoW                                         = modws2_32.NewProc("GetAddrInfoW")
288
-	procFreeAddrInfoW                                        = modws2_32.NewProc("FreeAddrInfoW")
289
-	procGetIfEntry                                           = modiphlpapi.NewProc("GetIfEntry")
290
-	procGetAdaptersInfo                                      = modiphlpapi.NewProc("GetAdaptersInfo")
291
-	procSetFileCompletionNotificationModes                   = modkernel32.NewProc("SetFileCompletionNotificationModes")
292
-	procWSAEnumProtocolsW                                    = modws2_32.NewProc("WSAEnumProtocolsW")
293
-	procGetAdaptersAddresses                                 = modiphlpapi.NewProc("GetAdaptersAddresses")
294
-	procGetACP                                               = modkernel32.NewProc("GetACP")
295
-	procMultiByteToWideChar                                  = modkernel32.NewProc("MultiByteToWideChar")
296
-	procTranslateNameW                                       = modsecur32.NewProc("TranslateNameW")
297
-	procGetUserNameExW                                       = modsecur32.NewProc("GetUserNameExW")
298
-	procNetUserGetInfo                                       = modnetapi32.NewProc("NetUserGetInfo")
299
-	procNetGetJoinInformation                                = modnetapi32.NewProc("NetGetJoinInformation")
300
-	procNetApiBufferFree                                     = modnetapi32.NewProc("NetApiBufferFree")
301
-	procLookupAccountSidW                                    = modadvapi32.NewProc("LookupAccountSidW")
302
-	procLookupAccountNameW                                   = modadvapi32.NewProc("LookupAccountNameW")
303
-	procConvertSidToStringSidW                               = modadvapi32.NewProc("ConvertSidToStringSidW")
304
-	procConvertStringSidToSidW                               = modadvapi32.NewProc("ConvertStringSidToSidW")
305
-	procGetLengthSid                                         = modadvapi32.NewProc("GetLengthSid")
306
-	procCopySid                                              = modadvapi32.NewProc("CopySid")
307
-	procAllocateAndInitializeSid                             = modadvapi32.NewProc("AllocateAndInitializeSid")
308
-	procCreateWellKnownSid                                   = modadvapi32.NewProc("CreateWellKnownSid")
309
-	procIsWellKnownSid                                       = modadvapi32.NewProc("IsWellKnownSid")
310
-	procFreeSid                                              = modadvapi32.NewProc("FreeSid")
311
-	procEqualSid                                             = modadvapi32.NewProc("EqualSid")
312
-	procGetSidIdentifierAuthority                            = modadvapi32.NewProc("GetSidIdentifierAuthority")
313
-	procGetSidSubAuthorityCount                              = modadvapi32.NewProc("GetSidSubAuthorityCount")
314
-	procGetSidSubAuthority                                   = modadvapi32.NewProc("GetSidSubAuthority")
315
-	procIsValidSid                                           = modadvapi32.NewProc("IsValidSid")
316
-	procCheckTokenMembership                                 = modadvapi32.NewProc("CheckTokenMembership")
317
-	procOpenProcessToken                                     = modadvapi32.NewProc("OpenProcessToken")
318
-	procOpenThreadToken                                      = modadvapi32.NewProc("OpenThreadToken")
319
-	procImpersonateSelf                                      = modadvapi32.NewProc("ImpersonateSelf")
320
-	procRevertToSelf                                         = modadvapi32.NewProc("RevertToSelf")
321
-	procSetThreadToken                                       = modadvapi32.NewProc("SetThreadToken")
322
-	procLookupPrivilegeValueW                                = modadvapi32.NewProc("LookupPrivilegeValueW")
323
-	procAdjustTokenPrivileges                                = modadvapi32.NewProc("AdjustTokenPrivileges")
324
-	procAdjustTokenGroups                                    = modadvapi32.NewProc("AdjustTokenGroups")
325
-	procGetTokenInformation                                  = modadvapi32.NewProc("GetTokenInformation")
326
-	procSetTokenInformation                                  = modadvapi32.NewProc("SetTokenInformation")
327
-	procDuplicateTokenEx                                     = modadvapi32.NewProc("DuplicateTokenEx")
328
-	procGetUserProfileDirectoryW                             = moduserenv.NewProc("GetUserProfileDirectoryW")
329
-	procGetSystemDirectoryW                                  = modkernel32.NewProc("GetSystemDirectoryW")
330
-	procGetWindowsDirectoryW                                 = modkernel32.NewProc("GetWindowsDirectoryW")
331
-	procGetSystemWindowsDirectoryW                           = modkernel32.NewProc("GetSystemWindowsDirectoryW")
332
-	procWTSQueryUserToken                                    = modwtsapi32.NewProc("WTSQueryUserToken")
354
+	procrecvfrom                                             = modws2_32.NewProc("recvfrom")
355
+	procsendto                                               = modws2_32.NewProc("sendto")
356
+	procsetsockopt                                           = modws2_32.NewProc("setsockopt")
357
+	procshutdown                                             = modws2_32.NewProc("shutdown")
358
+	procsocket                                               = modws2_32.NewProc("socket")
333 359
 	procWTSEnumerateSessionsW                                = modwtsapi32.NewProc("WTSEnumerateSessionsW")
334 360
 	procWTSFreeMemory                                        = modwtsapi32.NewProc("WTSFreeMemory")
335
-	procGetSecurityInfo                                      = modadvapi32.NewProc("GetSecurityInfo")
336
-	procSetSecurityInfo                                      = modadvapi32.NewProc("SetSecurityInfo")
337
-	procGetNamedSecurityInfoW                                = modadvapi32.NewProc("GetNamedSecurityInfoW")
338
-	procSetNamedSecurityInfoW                                = modadvapi32.NewProc("SetNamedSecurityInfoW")
339
-	procBuildSecurityDescriptorW                             = modadvapi32.NewProc("BuildSecurityDescriptorW")
340
-	procInitializeSecurityDescriptor                         = modadvapi32.NewProc("InitializeSecurityDescriptor")
341
-	procGetSecurityDescriptorControl                         = modadvapi32.NewProc("GetSecurityDescriptorControl")
342
-	procGetSecurityDescriptorDacl                            = modadvapi32.NewProc("GetSecurityDescriptorDacl")
343
-	procGetSecurityDescriptorSacl                            = modadvapi32.NewProc("GetSecurityDescriptorSacl")
344
-	procGetSecurityDescriptorOwner                           = modadvapi32.NewProc("GetSecurityDescriptorOwner")
345
-	procGetSecurityDescriptorGroup                           = modadvapi32.NewProc("GetSecurityDescriptorGroup")
346
-	procGetSecurityDescriptorLength                          = modadvapi32.NewProc("GetSecurityDescriptorLength")
347
-	procGetSecurityDescriptorRMControl                       = modadvapi32.NewProc("GetSecurityDescriptorRMControl")
348
-	procIsValidSecurityDescriptor                            = modadvapi32.NewProc("IsValidSecurityDescriptor")
349
-	procSetSecurityDescriptorControl                         = modadvapi32.NewProc("SetSecurityDescriptorControl")
350
-	procSetSecurityDescriptorDacl                            = modadvapi32.NewProc("SetSecurityDescriptorDacl")
351
-	procSetSecurityDescriptorSacl                            = modadvapi32.NewProc("SetSecurityDescriptorSacl")
352
-	procSetSecurityDescriptorOwner                           = modadvapi32.NewProc("SetSecurityDescriptorOwner")
353
-	procSetSecurityDescriptorGroup                           = modadvapi32.NewProc("SetSecurityDescriptorGroup")
354
-	procSetSecurityDescriptorRMControl                       = modadvapi32.NewProc("SetSecurityDescriptorRMControl")
355
-	procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
356
-	procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
357
-	procMakeAbsoluteSD                                       = modadvapi32.NewProc("MakeAbsoluteSD")
358
-	procMakeSelfRelativeSD                                   = modadvapi32.NewProc("MakeSelfRelativeSD")
359
-	procSetEntriesInAclW                                     = modadvapi32.NewProc("SetEntriesInAclW")
361
+	procWTSQueryUserToken                                    = modwtsapi32.NewProc("WTSQueryUserToken")
360 362
 )
361 363
 
362
-func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
363
-	r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0)
364
-	handle = Handle(r0)
365
-	if handle == 0 {
366
-		if e1 != 0 {
367
-			err = errnoErr(e1)
368
-		} else {
369
-			err = syscall.EINVAL
370
-		}
364
+func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) {
365
+	var _p0 uint32
366
+	if resetToDefault {
367
+		_p0 = 1
368
+	}
369
+	r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
370
+	if r1 == 0 {
371
+		err = errnoErr(e1)
371 372
 	}
372 373
 	return
373 374
 }
374 375
 
375
-func DeregisterEventSource(handle Handle) (err error) {
376
-	r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0)
376
+func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) {
377
+	var _p0 uint32
378
+	if disableAllPrivileges {
379
+		_p0 = 1
380
+	}
381
+	r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
377 382
 	if r1 == 0 {
378
-		if e1 != 0 {
379
-			err = errnoErr(e1)
380
-		} else {
381
-			err = syscall.EINVAL
382
-		}
383
+		err = errnoErr(e1)
383 384
 	}
384 385
 	return
385 386
 }
386 387
 
387
-func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) {
388
-	r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData)))
388
+func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) {
389
+	r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0)
389 390
 	if r1 == 0 {
390
-		if e1 != 0 {
391
-			err = errnoErr(e1)
392
-		} else {
393
-			err = syscall.EINVAL
394
-		}
391
+		err = errnoErr(e1)
395 392
 	}
396 393
 	return
397 394
 }
398 395
 
399
-func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) {
400
-	r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
401
-	handle = Handle(r0)
402
-	if handle == 0 {
403
-		if e1 != 0 {
404
-			err = errnoErr(e1)
405
-		} else {
406
-			err = syscall.EINVAL
407
-		}
396
+func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) {
397
+	r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor)))
398
+	if r0 != 0 {
399
+		ret = syscall.Errno(r0)
408 400
 	}
409 401
 	return
410 402
 }
411 403
 
412
-func CloseServiceHandle(handle Handle) (err error) {
413
-	r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0)
404
+func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) {
405
+	r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info)))
414 406
 	if r1 == 0 {
415
-		if e1 != 0 {
416
-			err = errnoErr(e1)
417
-		} else {
418
-			err = syscall.EINVAL
419
-		}
407
+		err = errnoErr(e1)
420 408
 	}
421 409
 	return
422 410
 }
423 411
 
424
-func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) {
425
-	r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0)
426
-	handle = Handle(r0)
427
-	if handle == 0 {
428
-		if e1 != 0 {
429
-			err = errnoErr(e1)
430
-		} else {
431
-			err = syscall.EINVAL
432
-		}
412
+func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) {
413
+	r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0)
414
+	if r1 == 0 {
415
+		err = errnoErr(e1)
433 416
 	}
434 417
 	return
435 418
 }
436 419
 
437
-func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) {
438
-	r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
439
-	handle = Handle(r0)
440
-	if handle == 0 {
441
-		if e1 != 0 {
442
-			err = errnoErr(e1)
443
-		} else {
444
-			err = syscall.EINVAL
445
-		}
420
+func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) {
421
+	r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember)))
422
+	if r1 == 0 {
423
+		err = errnoErr(e1)
446 424
 	}
447 425
 	return
448 426
 }
449 427
 
450
-func DeleteService(service Handle) (err error) {
451
-	r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0)
428
+func CloseServiceHandle(handle Handle) (err error) {
429
+	r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0)
452 430
 	if r1 == 0 {
453
-		if e1 != 0 {
454
-			err = errnoErr(e1)
455
-		} else {
456
-			err = syscall.EINVAL
457
-		}
431
+		err = errnoErr(e1)
458 432
 	}
459 433
 	return
460 434
 }
461 435
 
462
-func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) {
463
-	r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors)))
436
+func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
437
+	r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
464 438
 	if r1 == 0 {
465
-		if e1 != 0 {
466
-			err = errnoErr(e1)
467
-		} else {
468
-			err = syscall.EINVAL
469
-		}
439
+		err = errnoErr(e1)
470 440
 	}
471 441
 	return
472 442
 }
473 443
 
474
-func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) {
475
-	r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0)
444
+func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) {
445
+	r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0)
476 446
 	if r1 == 0 {
477
-		if e1 != 0 {
478
-			err = errnoErr(e1)
479
-		} else {
480
-			err = syscall.EINVAL
481
-		}
447
+		err = errnoErr(e1)
482 448
 	}
483 449
 	return
484 450
 }
485 451
 
486
-func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) {
487
-	r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
452
+func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
453
+	r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
488 454
 	if r1 == 0 {
489
-		if e1 != 0 {
490
-			err = errnoErr(e1)
491
-		} else {
492
-			err = syscall.EINVAL
493
-		}
455
+		err = errnoErr(e1)
494 456
 	}
495 457
 	return
496 458
 }
497 459
 
498
-func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
499
-	r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
500
-	if r1 == 0 {
501
-		if e1 != 0 {
502
-			err = errnoErr(e1)
503
-		} else {
504
-			err = syscall.EINVAL
505
-		}
460
+func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
461
+	var _p0 *uint16
462
+	_p0, err = syscall.UTF16PtrFromString(str)
463
+	if err != nil {
464
+		return
506 465
 	}
507
-	return
466
+	return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
508 467
 }
509 468
 
510
-func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) {
511
-	r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0)
469
+func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
470
+	r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
512 471
 	if r1 == 0 {
513
-		if e1 != 0 {
514
-			err = errnoErr(e1)
515
-		} else {
516
-			err = syscall.EINVAL
517
-		}
472
+		err = errnoErr(e1)
518 473
 	}
519 474
 	return
520 475
 }
521 476
 
522
-func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) {
523
-	r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0)
477
+func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
478
+	r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
524 479
 	if r1 == 0 {
525
-		if e1 != 0 {
526
-			err = errnoErr(e1)
527
-		} else {
528
-			err = syscall.EINVAL
529
-		}
480
+		err = errnoErr(e1)
530 481
 	}
531 482
 	return
532 483
 }
533 484
 
534
-func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) {
535
-	r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0)
485
+func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
486
+	r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
536 487
 	if r1 == 0 {
537
-		if e1 != 0 {
538
-			err = errnoErr(e1)
539
-		} else {
540
-			err = syscall.EINVAL
541
-		}
488
+		err = errnoErr(e1)
542 489
 	}
543 490
 	return
544 491
 }
545 492
 
546
-func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) {
547
-	r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
548
-	if r1 == 0 {
549
-		if e1 != 0 {
550
-			err = errnoErr(e1)
551
-		} else {
552
-			err = syscall.EINVAL
553
-		}
493
+func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) {
494
+	r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0)
495
+	handle = Handle(r0)
496
+	if handle == 0 {
497
+		err = errnoErr(e1)
554 498
 	}
555 499
 	return
556 500
 }
557 501
 
558
-func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) {
559
-	r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info)))
502
+func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) {
503
+	r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0)
560 504
 	if r1 == 0 {
561
-		if e1 != 0 {
562
-			err = errnoErr(e1)
563
-		} else {
564
-			err = syscall.EINVAL
565
-		}
505
+		err = errnoErr(e1)
566 506
 	}
567 507
 	return
568 508
 }
569 509
 
570
-func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
571
-	r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
510
+func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
511
+	r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
572 512
 	if r1 == 0 {
573
-		if e1 != 0 {
574
-			err = errnoErr(e1)
575
-		} else {
576
-			err = syscall.EINVAL
577
-		}
513
+		err = errnoErr(e1)
578 514
 	}
579 515
 	return
580 516
 }
581 517
 
582
-func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) {
583
-	r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0)
518
+func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
519
+	r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
584 520
 	if r1 == 0 {
585
-		if e1 != 0 {
586
-			err = errnoErr(e1)
587
-		} else {
588
-			err = syscall.EINVAL
589
-		}
521
+		err = errnoErr(e1)
590 522
 	}
591 523
 	return
592 524
 }
593 525
 
594
-func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
595
-	r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
526
+func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
527
+	r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
596 528
 	if r1 == 0 {
597
-		if e1 != 0 {
598
-			err = errnoErr(e1)
599
-		} else {
600
-			err = syscall.EINVAL
601
-		}
529
+		err = errnoErr(e1)
602 530
 	}
603 531
 	return
604 532
 }
605 533
 
606
-func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) {
607
-	r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier)))
608
-	if r0 != 0 {
609
-		ret = syscall.Errno(r0)
534
+func DeleteService(service Handle) (err error) {
535
+	r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0)
536
+	if r1 == 0 {
537
+		err = errnoErr(e1)
610 538
 	}
611 539
 	return
612 540
 }
613 541
 
614
-func GetLastError() (lasterr error) {
615
-	r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
616
-	if r0 != 0 {
617
-		lasterr = syscall.Errno(r0)
542
+func DeregisterEventSource(handle Handle) (err error) {
543
+	r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0)
544
+	if r1 == 0 {
545
+		err = errnoErr(e1)
618 546
 	}
619 547
 	return
620 548
 }
621 549
 
622
-func LoadLibrary(libname string) (handle Handle, err error) {
623
-	var _p0 *uint16
624
-	_p0, err = syscall.UTF16PtrFromString(libname)
625
-	if err != nil {
626
-		return
550
+func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) {
551
+	r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken)))
552
+	if r1 == 0 {
553
+		err = errnoErr(e1)
627 554
 	}
628
-	return _LoadLibrary(_p0)
555
+	return
629 556
 }
630 557
 
631
-func _LoadLibrary(libname *uint16) (handle Handle, err error) {
632
-	r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0)
633
-	handle = Handle(r0)
634
-	if handle == 0 {
635
-		if e1 != 0 {
636
-			err = errnoErr(e1)
637
-		} else {
638
-			err = syscall.EINVAL
639
-		}
558
+func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) {
559
+	r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0)
560
+	if r1 == 0 {
561
+		err = errnoErr(e1)
640 562
 	}
641 563
 	return
642 564
 }
643 565
 
644
-func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) {
645
-	var _p0 *uint16
646
-	_p0, err = syscall.UTF16PtrFromString(libname)
647
-	if err != nil {
648
-		return
649
-	}
650
-	return _LoadLibraryEx(_p0, zero, flags)
566
+func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) {
567
+	r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0)
568
+	isEqual = r0 != 0
569
+	return
651 570
 }
652 571
 
653
-func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) {
654
-	r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags))
655
-	handle = Handle(r0)
656
-	if handle == 0 {
657
-		if e1 != 0 {
658
-			err = errnoErr(e1)
659
-		} else {
660
-			err = syscall.EINVAL
661
-		}
572
+func FreeSid(sid *SID) (err error) {
573
+	r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
574
+	if r1 != 0 {
575
+		err = errnoErr(e1)
662 576
 	}
663 577
 	return
664 578
 }
665 579
 
666
-func FreeLibrary(handle Handle) (err error) {
667
-	r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
668
-	if r1 == 0 {
669
-		if e1 != 0 {
670
-			err = errnoErr(e1)
671
-		} else {
672
-			err = syscall.EINVAL
673
-		}
674
-	}
580
+func GetLengthSid(sid *SID) (len uint32) {
581
+	r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
582
+	len = uint32(r0)
675 583
 	return
676 584
 }
677 585
 
678
-func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
679
-	var _p0 *byte
680
-	_p0, err = syscall.BytePtrFromString(procname)
681
-	if err != nil {
586
+func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
587
+	var _p0 *uint16
588
+	_p0, ret = syscall.UTF16PtrFromString(objectName)
589
+	if ret != nil {
682 590
 		return
683 591
 	}
684
-	return _GetProcAddress(module, _p0)
685
-}
686
-
687
-func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) {
688
-	r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0)
689
-	proc = uintptr(r0)
690
-	if proc == 0 {
691
-		if e1 != 0 {
692
-			err = errnoErr(e1)
693
-		} else {
694
-			err = syscall.EINVAL
695
-		}
696
-	}
697
-	return
592
+	return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd)
698 593
 }
699 594
 
700
-func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) {
701
-	r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size))
702
-	n = uint32(r0)
703
-	if n == 0 {
704
-		if e1 != 0 {
705
-			err = errnoErr(e1)
706
-		} else {
707
-			err = syscall.EINVAL
708
-		}
595
+func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
596
+	r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
597
+	if r0 != 0 {
598
+		ret = syscall.Errno(r0)
709 599
 	}
710 600
 	return
711 601
 }
712 602
 
713
-func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) {
714
-	r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module)))
603
+func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) {
604
+	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision)))
715 605
 	if r1 == 0 {
716
-		if e1 != 0 {
717
-			err = errnoErr(e1)
718
-		} else {
719
-			err = syscall.EINVAL
720
-		}
606
+		err = errnoErr(e1)
721 607
 	}
722 608
 	return
723 609
 }
724 610
 
725
-func GetVersion() (ver uint32, err error) {
726
-	r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0)
727
-	ver = uint32(r0)
728
-	if ver == 0 {
729
-		if e1 != 0 {
730
-			err = errnoErr(e1)
731
-		} else {
732
-			err = syscall.EINVAL
733
-		}
611
+func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) {
612
+	var _p0 uint32
613
+	if *daclPresent {
614
+		_p0 = 1
734 615
 	}
735
-	return
736
-}
737
-
738
-func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) {
739
-	var _p0 *uint16
740
-	if len(buf) > 0 {
741
-		_p0 = &buf[0]
616
+	var _p1 uint32
617
+	if *daclDefaulted {
618
+		_p1 = 1
742 619
 	}
743
-	r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0)
744
-	n = uint32(r0)
745
-	if n == 0 {
746
-		if e1 != 0 {
747
-			err = errnoErr(e1)
748
-		} else {
749
-			err = syscall.EINVAL
750
-		}
620
+	r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
621
+	*daclPresent = _p0 != 0
622
+	*daclDefaulted = _p1 != 0
623
+	if r1 == 0 {
624
+		err = errnoErr(e1)
751 625
 	}
752 626
 	return
753 627
 }
754 628
 
755
-func ExitProcess(exitcode uint32) {
756
-	syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
757
-	return
758
-}
759
-
760
-func IsWow64Process(handle Handle, isWow64 *bool) (err error) {
629
+func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) {
761 630
 	var _p0 uint32
762
-	if *isWow64 {
631
+	if *groupDefaulted {
763 632
 		_p0 = 1
764
-	} else {
765
-		_p0 = 0
766 633
 	}
767
-	r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0)
768
-	*isWow64 = _p0 != 0
634
+	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0)))
635
+	*groupDefaulted = _p0 != 0
769 636
 	if r1 == 0 {
770
-		if e1 != 0 {
771
-			err = errnoErr(e1)
772
-		} else {
773
-			err = syscall.EINVAL
774
-		}
637
+		err = errnoErr(e1)
775 638
 	}
776 639
 	return
777 640
 }
778 641
 
779
-func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
780
-	r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
781
-	handle = Handle(r0)
782
-	if handle == InvalidHandle {
783
-		if e1 != 0 {
784
-			err = errnoErr(e1)
785
-		} else {
786
-			err = syscall.EINVAL
787
-		}
788
-	}
642
+func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) {
643
+	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
644
+	len = uint32(r0)
789 645
 	return
790 646
 }
791 647
 
792
-func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
793
-	var _p0 *byte
794
-	if len(buf) > 0 {
795
-		_p0 = &buf[0]
648
+func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) {
649
+	var _p0 uint32
650
+	if *ownerDefaulted {
651
+		_p0 = 1
796 652
 	}
797
-	r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
653
+	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0)))
654
+	*ownerDefaulted = _p0 != 0
798 655
 	if r1 == 0 {
799
-		if e1 != 0 {
800
-			err = errnoErr(e1)
801
-		} else {
802
-			err = syscall.EINVAL
803
-		}
656
+		err = errnoErr(e1)
804 657
 	}
805 658
 	return
806 659
 }
807 660
 
808
-func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
809
-	var _p0 *byte
810
-	if len(buf) > 0 {
811
-		_p0 = &buf[0]
812
-	}
813
-	r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
814
-	if r1 == 0 {
815
-		if e1 != 0 {
816
-			err = errnoErr(e1)
817
-		} else {
818
-			err = syscall.EINVAL
819
-		}
661
+func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) {
662
+	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
663
+	if r0 != 0 {
664
+		ret = syscall.Errno(r0)
820 665
 	}
821 666
 	return
822 667
 }
823 668
 
824
-func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
669
+func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) {
825 670
 	var _p0 uint32
826
-	if wait {
671
+	if *saclPresent {
827 672
 		_p0 = 1
828
-	} else {
829
-		_p0 = 0
830 673
 	}
831
-	r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0)
674
+	var _p1 uint32
675
+	if *saclDefaulted {
676
+		_p1 = 1
677
+	}
678
+	r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
679
+	*saclPresent = _p0 != 0
680
+	*saclDefaulted = _p1 != 0
832 681
 	if r1 == 0 {
833
-		if e1 != 0 {
834
-			err = errnoErr(e1)
835
-		} else {
836
-			err = syscall.EINVAL
837
-		}
682
+		err = errnoErr(e1)
838 683
 	}
839 684
 	return
840 685
 }
841 686
 
842
-func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
843
-	r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
844
-	newlowoffset = uint32(r0)
845
-	if newlowoffset == 0xffffffff {
846
-		if e1 != 0 {
847
-			err = errnoErr(e1)
848
-		} else {
849
-			err = syscall.EINVAL
850
-		}
687
+func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
688
+	r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
689
+	if r0 != 0 {
690
+		ret = syscall.Errno(r0)
851 691
 	}
852 692
 	return
853 693
 }
854 694
 
855
-func CloseHandle(handle Handle) (err error) {
856
-	r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
857
-	if r1 == 0 {
858
-		if e1 != 0 {
859
-			err = errnoErr(e1)
860
-		} else {
861
-			err = syscall.EINVAL
862
-		}
863
-	}
695
+func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) {
696
+	r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
697
+	authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0))
864 698
 	return
865 699
 }
866 700
 
867
-func GetStdHandle(stdhandle uint32) (handle Handle, err error) {
868
-	r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0)
869
-	handle = Handle(r0)
870
-	if handle == InvalidHandle {
871
-		if e1 != 0 {
872
-			err = errnoErr(e1)
873
-		} else {
874
-			err = syscall.EINVAL
875
-		}
876
-	}
701
+func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) {
702
+	r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0)
703
+	subAuthority = (*uint32)(unsafe.Pointer(r0))
877 704
 	return
878 705
 }
879 706
 
880
-func SetStdHandle(stdhandle uint32, handle Handle) (err error) {
881
-	r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0)
707
+func getSidSubAuthorityCount(sid *SID) (count *uint8) {
708
+	r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
709
+	count = (*uint8)(unsafe.Pointer(r0))
710
+	return
711
+}
712
+
713
+func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
714
+	r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
882 715
 	if r1 == 0 {
883
-		if e1 != 0 {
884
-			err = errnoErr(e1)
885
-		} else {
886
-			err = syscall.EINVAL
887
-		}
716
+		err = errnoErr(e1)
888 717
 	}
889 718
 	return
890 719
 }
891 720
 
892
-func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) {
893
-	r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
894
-	handle = Handle(r0)
895
-	if handle == InvalidHandle {
896
-		if e1 != 0 {
897
-			err = errnoErr(e1)
898
-		} else {
899
-			err = syscall.EINVAL
900
-		}
721
+func ImpersonateSelf(impersonationlevel uint32) (err error) {
722
+	r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
723
+	if r1 == 0 {
724
+		err = errnoErr(e1)
901 725
 	}
902 726
 	return
903 727
 }
904 728
 
905
-func findNextFile1(handle Handle, data *win32finddata1) (err error) {
906
-	r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
729
+func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) {
730
+	r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0)
907 731
 	if r1 == 0 {
908
-		if e1 != 0 {
909
-			err = errnoErr(e1)
910
-		} else {
911
-			err = syscall.EINVAL
912
-		}
732
+		err = errnoErr(e1)
913 733
 	}
914 734
 	return
915 735
 }
916 736
 
917
-func FindClose(handle Handle) (err error) {
918
-	r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
737
+func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) {
738
+	var _p0 uint32
739
+	if forceAppsClosed {
740
+		_p0 = 1
741
+	}
742
+	var _p1 uint32
743
+	if rebootAfterShutdown {
744
+		_p1 = 1
745
+	}
746
+	r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason))
919 747
 	if r1 == 0 {
920
-		if e1 != 0 {
921
-			err = errnoErr(e1)
922
-		} else {
923
-			err = syscall.EINVAL
924
-		}
748
+		err = errnoErr(e1)
925 749
 	}
926 750
 	return
927 751
 }
928 752
 
929
-func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
930
-	r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
753
+func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) {
754
+	r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
755
+	isValid = r0 != 0
756
+	return
757
+}
758
+
759
+func isValidSid(sid *SID) (isValid bool) {
760
+	r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
761
+	isValid = r0 != 0
762
+	return
763
+}
764
+
765
+func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) {
766
+	r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0)
767
+	isWellKnown = r0 != 0
768
+	return
769
+}
770
+
771
+func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
772
+	r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
931 773
 	if r1 == 0 {
932
-		if e1 != 0 {
933
-			err = errnoErr(e1)
934
-		} else {
935
-			err = syscall.EINVAL
936
-		}
774
+		err = errnoErr(e1)
937 775
 	}
938 776
 	return
939 777
 }
940 778
 
941
-func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) {
942
-	r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0)
779
+func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
780
+	r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
943 781
 	if r1 == 0 {
944
-		if e1 != 0 {
945
-			err = errnoErr(e1)
946
-		} else {
947
-			err = syscall.EINVAL
948
-		}
782
+		err = errnoErr(e1)
949 783
 	}
950 784
 	return
951 785
 }
952 786
 
953
-func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
954
-	r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
955
-	n = uint32(r0)
956
-	if n == 0 {
957
-		if e1 != 0 {
958
-			err = errnoErr(e1)
959
-		} else {
960
-			err = syscall.EINVAL
961
-		}
787
+func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
788
+	r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
789
+	if r1 == 0 {
790
+		err = errnoErr(e1)
962 791
 	}
963 792
 	return
964 793
 }
965 794
 
966
-func SetCurrentDirectory(path *uint16) (err error) {
967
-	r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
795
+func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) {
796
+	r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0)
968 797
 	if r1 == 0 {
969
-		if e1 != 0 {
970
-			err = errnoErr(e1)
971
-		} else {
972
-			err = syscall.EINVAL
973
-		}
798
+		err = errnoErr(e1)
974 799
 	}
975 800
 	return
976 801
 }
977 802
 
978
-func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
979
-	r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
803
+func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) {
804
+	r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize)))
980 805
 	if r1 == 0 {
981
-		if e1 != 0 {
982
-			err = errnoErr(e1)
983
-		} else {
984
-			err = syscall.EINVAL
985
-		}
806
+		err = errnoErr(e1)
986 807
 	}
987 808
 	return
988 809
 }
989 810
 
990
-func RemoveDirectory(path *uint16) (err error) {
991
-	r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
992
-	if r1 == 0 {
993
-		if e1 != 0 {
994
-			err = errnoErr(e1)
995
-		} else {
996
-			err = syscall.EINVAL
997
-		}
811
+func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) {
812
+	r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier)))
813
+	if r0 != 0 {
814
+		ret = syscall.Errno(r0)
998 815
 	}
999 816
 	return
1000 817
 }
1001 818
 
1002
-func DeleteFile(path *uint16) (err error) {
1003
-	r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
819
+func OpenProcessToken(process Handle, access uint32, token *Token) (err error) {
820
+	r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token)))
1004 821
 	if r1 == 0 {
1005
-		if e1 != 0 {
1006
-			err = errnoErr(e1)
1007
-		} else {
1008
-			err = syscall.EINVAL
1009
-		}
822
+		err = errnoErr(e1)
1010 823
 	}
1011 824
 	return
1012 825
 }
1013 826
 
1014
-func MoveFile(from *uint16, to *uint16) (err error) {
1015
-	r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
1016
-	if r1 == 0 {
1017
-		if e1 != 0 {
1018
-			err = errnoErr(e1)
1019
-		} else {
1020
-			err = syscall.EINVAL
1021
-		}
827
+func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) {
828
+	r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
829
+	handle = Handle(r0)
830
+	if handle == 0 {
831
+		err = errnoErr(e1)
1022 832
 	}
1023 833
 	return
1024 834
 }
1025 835
 
1026
-func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
1027
-	r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
1028
-	if r1 == 0 {
1029
-		if e1 != 0 {
1030
-			err = errnoErr(e1)
1031
-		} else {
1032
-			err = syscall.EINVAL
1033
-		}
836
+func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) {
837
+	r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
838
+	handle = Handle(r0)
839
+	if handle == 0 {
840
+		err = errnoErr(e1)
1034 841
 	}
1035 842
 	return
1036 843
 }
1037 844
 
1038
-func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
1039
-	r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
845
+func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) {
846
+	var _p0 uint32
847
+	if openAsSelf {
848
+		_p0 = 1
849
+	}
850
+	r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
1040 851
 	if r1 == 0 {
1041
-		if e1 != 0 {
1042
-			err = errnoErr(e1)
1043
-		} else {
1044
-			err = syscall.EINVAL
1045
-		}
852
+		err = errnoErr(e1)
1046 853
 	}
1047 854
 	return
1048 855
 }
1049 856
 
1050
-func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
1051
-	r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0)
857
+func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
858
+	r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
1052 859
 	if r1 == 0 {
1053
-		if e1 != 0 {
1054
-			err = errnoErr(e1)
1055
-		} else {
1056
-			err = syscall.EINVAL
1057
-		}
860
+		err = errnoErr(e1)
1058 861
 	}
1059 862
 	return
1060 863
 }
1061 864
 
1062
-func GetComputerName(buf *uint16, n *uint32) (err error) {
1063
-	r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
865
+func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) {
866
+	r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
1064 867
 	if r1 == 0 {
1065
-		if e1 != 0 {
1066
-			err = errnoErr(e1)
1067
-		} else {
1068
-			err = syscall.EINVAL
1069
-		}
868
+		err = errnoErr(e1)
1070 869
 	}
1071 870
 	return
1072 871
 }
1073 872
 
1074
-func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) {
1075
-	r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
873
+func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) {
874
+	r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
1076 875
 	if r1 == 0 {
1077
-		if e1 != 0 {
1078
-			err = errnoErr(e1)
1079
-		} else {
1080
-			err = syscall.EINVAL
1081
-		}
876
+		err = errnoErr(e1)
1082 877
 	}
1083 878
 	return
1084 879
 }
1085 880
 
1086
-func SetEndOfFile(handle Handle) (err error) {
1087
-	r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
881
+func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) {
882
+	r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0)
1088 883
 	if r1 == 0 {
1089
-		if e1 != 0 {
1090
-			err = errnoErr(e1)
1091
-		} else {
1092
-			err = syscall.EINVAL
1093
-		}
884
+		err = errnoErr(e1)
1094 885
 	}
1095 886
 	return
1096 887
 }
1097 888
 
1098
-func GetSystemTimeAsFileTime(time *Filetime) {
1099
-	syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
889
+func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
890
+	r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
891
+	if r1 == 0 {
892
+		err = errnoErr(e1)
893
+	}
1100 894
 	return
1101 895
 }
1102 896
 
1103
-func GetSystemTimePreciseAsFileTime(time *Filetime) {
1104
-	syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
897
+func RegCloseKey(key Handle) (regerrno error) {
898
+	r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0)
899
+	if r0 != 0 {
900
+		regerrno = syscall.Errno(r0)
901
+	}
1105 902
 	return
1106 903
 }
1107 904
 
1108
-func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
1109
-	r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0)
1110
-	rc = uint32(r0)
1111
-	if rc == 0xffffffff {
1112
-		if e1 != 0 {
1113
-			err = errnoErr(e1)
1114
-		} else {
1115
-			err = syscall.EINVAL
1116
-		}
905
+func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) {
906
+	r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0)
907
+	if r0 != 0 {
908
+		regerrno = syscall.Errno(r0)
1117 909
 	}
1118 910
 	return
1119 911
 }
1120 912
 
1121
-func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) {
1122
-	r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
1123
-	handle = Handle(r0)
1124
-	if handle == 0 {
1125
-		if e1 != 0 {
1126
-			err = errnoErr(e1)
1127
-		} else {
1128
-			err = syscall.EINVAL
1129
-		}
913
+func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) {
914
+	r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0)
915
+	if r0 != 0 {
916
+		regerrno = syscall.Errno(r0)
1130 917
 	}
1131 918
 	return
1132 919
 }
1133 920
 
1134
-func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
1135
-	r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
1136
-	if r1 == 0 {
1137
-		if e1 != 0 {
1138
-			err = errnoErr(e1)
1139
-		} else {
1140
-			err = syscall.EINVAL
1141
-		}
921
+func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) {
922
+	r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime)))
923
+	if r0 != 0 {
924
+		regerrno = syscall.Errno(r0)
1142 925
 	}
1143 926
 	return
1144 927
 }
1145 928
 
1146
-func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
1147
-	r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
1148
-	if r1 == 0 {
1149
-		if e1 != 0 {
1150
-			err = errnoErr(e1)
1151
-		} else {
1152
-			err = syscall.EINVAL
1153
-		}
929
+func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
930
+	r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)))
931
+	if r0 != 0 {
932
+		regerrno = syscall.Errno(r0)
1154 933
 	}
1155 934
 	return
1156 935
 }
1157 936
 
1158
-func CancelIo(s Handle) (err error) {
1159
-	r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
1160
-	if r1 == 0 {
1161
-		if e1 != 0 {
1162
-			err = errnoErr(e1)
1163
-		} else {
1164
-			err = syscall.EINVAL
1165
-		}
937
+func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
938
+	r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0)
939
+	handle = Handle(r0)
940
+	if handle == 0 {
941
+		err = errnoErr(e1)
1166 942
 	}
1167 943
 	return
1168 944
 }
1169 945
 
1170
-func CancelIoEx(s Handle, o *Overlapped) (err error) {
1171
-	r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0)
946
+func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) {
947
+	r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData)))
1172 948
 	if r1 == 0 {
1173
-		if e1 != 0 {
1174
-			err = errnoErr(e1)
1175
-		} else {
1176
-			err = syscall.EINVAL
1177
-		}
949
+		err = errnoErr(e1)
1178 950
 	}
1179 951
 	return
1180 952
 }
1181 953
 
1182
-func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
1183
-	var _p0 uint32
1184
-	if inheritHandles {
1185
-		_p0 = 1
1186
-	} else {
1187
-		_p0 = 0
1188
-	}
1189
-	r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0)
954
+func RevertToSelf() (err error) {
955
+	r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
1190 956
 	if r1 == 0 {
1191
-		if e1 != 0 {
1192
-			err = errnoErr(e1)
1193
-		} else {
1194
-			err = syscall.EINVAL
1195
-		}
957
+		err = errnoErr(e1)
1196 958
 	}
1197 959
 	return
1198 960
 }
1199 961
 
1200
-func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) {
1201
-	var _p0 uint32
1202
-	if inheritHandle {
1203
-		_p0 = 1
1204
-	} else {
1205
-		_p0 = 0
1206
-	}
1207
-	r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId))
1208
-	handle = Handle(r0)
1209
-	if handle == 0 {
1210
-		if e1 != 0 {
1211
-			err = errnoErr(e1)
1212
-		} else {
1213
-			err = syscall.EINVAL
1214
-		}
962
+func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) {
963
+	r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0)
964
+	if r0 != 0 {
965
+		ret = syscall.Errno(r0)
1215 966
 	}
1216 967
 	return
1217 968
 }
1218 969
 
1219
-func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) {
1220
-	r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd))
1221
-	if r1 <= 32 {
1222
-		if e1 != 0 {
1223
-			err = errnoErr(e1)
1224
-		} else {
1225
-			err = syscall.EINVAL
1226
-		}
970
+func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
971
+	var _p0 *uint16
972
+	_p0, ret = syscall.UTF16PtrFromString(objectName)
973
+	if ret != nil {
974
+		return
1227 975
 	}
1228
-	return
976
+	return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl)
1229 977
 }
1230 978
 
1231
-func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) {
1232
-	r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0)
979
+func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
980
+	r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
1233 981
 	if r0 != 0 {
1234 982
 		ret = syscall.Errno(r0)
1235 983
 	}
1236 984
 	return
1237 985
 }
1238 986
 
1239
-func TerminateProcess(handle Handle, exitcode uint32) (err error) {
1240
-	r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
987
+func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) {
988
+	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet))
1241 989
 	if r1 == 0 {
1242
-		if e1 != 0 {
1243
-			err = errnoErr(e1)
1244
-		} else {
1245
-			err = syscall.EINVAL
1246
-		}
990
+		err = errnoErr(e1)
1247 991
 	}
1248 992
 	return
1249 993
 }
1250 994
 
1251
-func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
1252
-	r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
1253
-	if r1 == 0 {
1254
-		if e1 != 0 {
1255
-			err = errnoErr(e1)
1256
-		} else {
1257
-			err = syscall.EINVAL
1258
-		}
995
+func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) {
996
+	var _p0 uint32
997
+	if daclPresent {
998
+		_p0 = 1
1259 999
 	}
1260
-	return
1261
-}
1262
-
1263
-func GetStartupInfo(startupInfo *StartupInfo) (err error) {
1264
-	r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
1000
+	var _p1 uint32
1001
+	if daclDefaulted {
1002
+		_p1 = 1
1003
+	}
1004
+	r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0)
1265 1005
 	if r1 == 0 {
1266
-		if e1 != 0 {
1267
-			err = errnoErr(e1)
1268
-		} else {
1269
-			err = syscall.EINVAL
1270
-		}
1006
+		err = errnoErr(e1)
1271 1007
 	}
1272 1008
 	return
1273 1009
 }
1274 1010
 
1275
-func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
1276
-	r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
1011
+func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) {
1012
+	var _p0 uint32
1013
+	if groupDefaulted {
1014
+		_p0 = 1
1015
+	}
1016
+	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0))
1277 1017
 	if r1 == 0 {
1278
-		if e1 != 0 {
1279
-			err = errnoErr(e1)
1280
-		} else {
1281
-			err = syscall.EINVAL
1282
-		}
1018
+		err = errnoErr(e1)
1283 1019
 	}
1284 1020
 	return
1285 1021
 }
1286 1022
 
1287
-func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
1023
+func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) {
1288 1024
 	var _p0 uint32
1289
-	if bInheritHandle {
1025
+	if ownerDefaulted {
1290 1026
 		_p0 = 1
1291
-	} else {
1292
-		_p0 = 0
1293 1027
 	}
1294
-	r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
1028
+	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0))
1295 1029
 	if r1 == 0 {
1296
-		if e1 != 0 {
1297
-			err = errnoErr(e1)
1298
-		} else {
1299
-			err = syscall.EINVAL
1300
-		}
1030
+		err = errnoErr(e1)
1301 1031
 	}
1302 1032
 	return
1303 1033
 }
1304 1034
 
1305
-func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) {
1306
-	r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0)
1307
-	event = uint32(r0)
1308
-	if event == 0xffffffff {
1309
-		if e1 != 0 {
1310
-			err = errnoErr(e1)
1311
-		} else {
1312
-			err = syscall.EINVAL
1313
-		}
1314
-	}
1035
+func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) {
1036
+	syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
1315 1037
 	return
1316 1038
 }
1317 1039
 
1318
-func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
1040
+func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) {
1319 1041
 	var _p0 uint32
1320
-	if waitAll {
1042
+	if saclPresent {
1321 1043
 		_p0 = 1
1322
-	} else {
1323
-		_p0 = 0
1324 1044
 	}
1325
-	r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0)
1326
-	event = uint32(r0)
1327
-	if event == 0xffffffff {
1328
-		if e1 != 0 {
1329
-			err = errnoErr(e1)
1330
-		} else {
1331
-			err = syscall.EINVAL
1332
-		}
1045
+	var _p1 uint32
1046
+	if saclDefaulted {
1047
+		_p1 = 1
1048
+	}
1049
+	r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0)
1050
+	if r1 == 0 {
1051
+		err = errnoErr(e1)
1333 1052
 	}
1334 1053
 	return
1335 1054
 }
1336 1055
 
1337
-func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
1338
-	r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
1339
-	n = uint32(r0)
1340
-	if n == 0 {
1341
-		if e1 != 0 {
1342
-			err = errnoErr(e1)
1343
-		} else {
1344
-			err = syscall.EINVAL
1345
-		}
1346
-	}
1056
+func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) {
1057
+	syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
1347 1058
 	return
1348 1059
 }
1349 1060
 
1350
-func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
1351
-	r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
1061
+func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) {
1062
+	r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0)
1352 1063
 	if r1 == 0 {
1353
-		if e1 != 0 {
1354
-			err = errnoErr(e1)
1355
-		} else {
1356
-			err = syscall.EINVAL
1357
-		}
1064
+		err = errnoErr(e1)
1358 1065
 	}
1359 1066
 	return
1360 1067
 }
1361 1068
 
1362
-func GetFileType(filehandle Handle) (n uint32, err error) {
1363
-	r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0)
1364
-	n = uint32(r0)
1365
-	if n == 0 {
1366
-		if e1 != 0 {
1367
-			err = errnoErr(e1)
1368
-		} else {
1369
-			err = syscall.EINVAL
1370
-		}
1069
+func SetThreadToken(thread *Handle, token Token) (err error) {
1070
+	r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0)
1071
+	if r1 == 0 {
1072
+		err = errnoErr(e1)
1371 1073
 	}
1372 1074
 	return
1373 1075
 }
1374 1076
 
1375
-func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
1376
-	r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
1077
+func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) {
1078
+	r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0)
1377 1079
 	if r1 == 0 {
1378
-		if e1 != 0 {
1379
-			err = errnoErr(e1)
1380
-		} else {
1381
-			err = syscall.EINVAL
1382
-		}
1080
+		err = errnoErr(e1)
1383 1081
 	}
1384 1082
 	return
1385 1083
 }
1386 1084
 
1387
-func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
1388
-	r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
1085
+func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) {
1086
+	r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0)
1389 1087
 	if r1 == 0 {
1390
-		if e1 != 0 {
1391
-			err = errnoErr(e1)
1392
-		} else {
1393
-			err = syscall.EINVAL
1394
-		}
1088
+		err = errnoErr(e1)
1395 1089
 	}
1396 1090
 	return
1397 1091
 }
1398 1092
 
1399
-func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
1400
-	r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
1093
+func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) {
1094
+	r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors)))
1401 1095
 	if r1 == 0 {
1402
-		if e1 != 0 {
1403
-			err = errnoErr(e1)
1404
-		} else {
1405
-			err = syscall.EINVAL
1406
-		}
1096
+		err = errnoErr(e1)
1407 1097
 	}
1408 1098
 	return
1409 1099
 }
1410 1100
 
1411
-func GetEnvironmentStrings() (envs *uint16, err error) {
1412
-	r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0)
1413
-	envs = (*uint16)(unsafe.Pointer(r0))
1414
-	if envs == nil {
1415
-		if e1 != 0 {
1416
-			err = errnoErr(e1)
1417
-		} else {
1418
-			err = syscall.EINVAL
1419
-		}
1101
+func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
1102
+	r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
1103
+	if r1 == 0 {
1104
+		err = errnoErr(e1)
1420 1105
 	}
1421 1106
 	return
1422 1107
 }
1423 1108
 
1424
-func FreeEnvironmentStrings(envs *uint16) (err error) {
1425
-	r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
1109
+func CertCloseStore(store Handle, flags uint32) (err error) {
1110
+	r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
1426 1111
 	if r1 == 0 {
1427
-		if e1 != 0 {
1428
-			err = errnoErr(e1)
1429
-		} else {
1430
-			err = syscall.EINVAL
1431
-		}
1112
+		err = errnoErr(e1)
1432 1113
 	}
1433 1114
 	return
1434 1115
 }
1435 1116
 
1436
-func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) {
1437
-	r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size))
1438
-	n = uint32(r0)
1439
-	if n == 0 {
1440
-		if e1 != 0 {
1441
-			err = errnoErr(e1)
1442
-		} else {
1443
-			err = syscall.EINVAL
1444
-		}
1117
+func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) {
1118
+	r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen))
1119
+	context = (*CertContext)(unsafe.Pointer(r0))
1120
+	if context == nil {
1121
+		err = errnoErr(e1)
1445 1122
 	}
1446 1123
 	return
1447 1124
 }
1448 1125
 
1449
-func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
1450
-	r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
1451
-	if r1 == 0 {
1452
-		if e1 != 0 {
1453
-			err = errnoErr(e1)
1454
-		} else {
1455
-			err = syscall.EINVAL
1456
-		}
1126
+func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) {
1127
+	r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0)
1128
+	context = (*CertContext)(unsafe.Pointer(r0))
1129
+	if context == nil {
1130
+		err = errnoErr(e1)
1457 1131
 	}
1458 1132
 	return
1459 1133
 }
1460 1134
 
1461
-func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) {
1462
-	var _p0 uint32
1463
-	if inheritExisting {
1464
-		_p0 = 1
1465
-	} else {
1466
-		_p0 = 0
1467
-	}
1468
-	r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
1469
-	if r1 == 0 {
1470
-		if e1 != 0 {
1471
-			err = errnoErr(e1)
1472
-		} else {
1473
-			err = syscall.EINVAL
1474
-		}
1475
-	}
1135
+func CertFreeCertificateChain(ctx *CertChainContext) {
1136
+	syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1476 1137
 	return
1477 1138
 }
1478 1139
 
1479
-func DestroyEnvironmentBlock(block *uint16) (err error) {
1480
-	r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
1140
+func CertFreeCertificateContext(ctx *CertContext) (err error) {
1141
+	r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1481 1142
 	if r1 == 0 {
1482
-		if e1 != 0 {
1483
-			err = errnoErr(e1)
1484
-		} else {
1485
-			err = syscall.EINVAL
1486
-		}
1143
+		err = errnoErr(e1)
1487 1144
 	}
1488 1145
 	return
1489 1146
 }
1490 1147
 
1491
-func getTickCount64() (ms uint64) {
1492
-	r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0)
1493
-	ms = uint64(r0)
1148
+func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
1149
+	r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0)
1150
+	if r1 == 0 {
1151
+		err = errnoErr(e1)
1152
+	}
1494 1153
 	return
1495 1154
 }
1496 1155
 
1497
-func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
1498
-	r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
1499
-	if r1 == 0 {
1500
-		if e1 != 0 {
1501
-			err = errnoErr(e1)
1502
-		} else {
1503
-			err = syscall.EINVAL
1504
-		}
1156
+func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
1157
+	r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
1158
+	handle = Handle(r0)
1159
+	if handle == InvalidHandle {
1160
+		err = errnoErr(e1)
1505 1161
 	}
1506 1162
 	return
1507 1163
 }
1508 1164
 
1509
-func GetFileAttributes(name *uint16) (attrs uint32, err error) {
1510
-	r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
1511
-	attrs = uint32(r0)
1512
-	if attrs == INVALID_FILE_ATTRIBUTES {
1513
-		if e1 != 0 {
1514
-			err = errnoErr(e1)
1515
-		} else {
1516
-			err = syscall.EINVAL
1517
-		}
1165
+func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
1166
+	r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0)
1167
+	store = Handle(r0)
1168
+	if store == 0 {
1169
+		err = errnoErr(e1)
1518 1170
 	}
1519 1171
 	return
1520 1172
 }
1521 1173
 
1522
-func SetFileAttributes(name *uint16, attrs uint32) (err error) {
1523
-	r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
1174
+func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
1175
+	r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
1524 1176
 	if r1 == 0 {
1525
-		if e1 != 0 {
1526
-			err = errnoErr(e1)
1527
-		} else {
1528
-			err = syscall.EINVAL
1529
-		}
1177
+		err = errnoErr(e1)
1530 1178
 	}
1531 1179
 	return
1532 1180
 }
1533 1181
 
1534
-func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
1535
-	r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
1536
-	if r1 == 0 {
1537
-		if e1 != 0 {
1538
-			err = errnoErr(e1)
1539
-		} else {
1540
-			err = syscall.EINVAL
1541
-		}
1182
+func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) {
1183
+	r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0)
1184
+	same = r0 != 0
1185
+	return
1186
+}
1187
+
1188
+func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
1189
+	var _p0 *uint16
1190
+	_p0, status = syscall.UTF16PtrFromString(name)
1191
+	if status != nil {
1192
+		return
1193
+	}
1194
+	return _DnsQuery(_p0, qtype, options, extra, qrs, pr)
1195
+}
1196
+
1197
+func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
1198
+	r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
1199
+	if r0 != 0 {
1200
+		status = syscall.Errno(r0)
1542 1201
 	}
1543 1202
 	return
1544 1203
 }
1545 1204
 
1546
-func GetCommandLine() (cmd *uint16) {
1547
-	r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0)
1548
-	cmd = (*uint16)(unsafe.Pointer(r0))
1205
+func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
1206
+	syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
1549 1207
 	return
1550 1208
 }
1551 1209
 
1552
-func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
1553
-	r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0)
1554
-	argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0))
1555
-	if argv == nil {
1556
-		if e1 != 0 {
1557
-			err = errnoErr(e1)
1558
-		} else {
1559
-			err = syscall.EINVAL
1560
-		}
1210
+func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
1211
+	r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
1212
+	if r0 != 0 {
1213
+		errcode = syscall.Errno(r0)
1561 1214
 	}
1562 1215
 	return
1563 1216
 }
1564 1217
 
1565
-func LocalFree(hmem Handle) (handle Handle, err error) {
1566
-	r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0)
1567
-	handle = Handle(r0)
1568
-	if handle != 0 {
1569
-		if e1 != 0 {
1570
-			err = errnoErr(e1)
1571
-		} else {
1572
-			err = syscall.EINVAL
1573
-		}
1218
+func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) {
1219
+	r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
1220
+	if r0 != 0 {
1221
+		errcode = syscall.Errno(r0)
1574 1222
 	}
1575 1223
 	return
1576 1224
 }
1577 1225
 
1578
-func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
1579
-	r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
1226
+func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
1227
+	r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
1228
+	if r0 != 0 {
1229
+		errcode = syscall.Errno(r0)
1230
+	}
1231
+	return
1232
+}
1233
+
1234
+func AssignProcessToJobObject(job Handle, process Handle) (err error) {
1235
+	r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
1580 1236
 	if r1 == 0 {
1581
-		if e1 != 0 {
1582
-			err = errnoErr(e1)
1583
-		} else {
1584
-			err = syscall.EINVAL
1585
-		}
1237
+		err = errnoErr(e1)
1586 1238
 	}
1587 1239
 	return
1588 1240
 }
1589 1241
 
1590
-func FlushFileBuffers(handle Handle) (err error) {
1591
-	r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
1242
+func CancelIo(s Handle) (err error) {
1243
+	r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
1592 1244
 	if r1 == 0 {
1593
-		if e1 != 0 {
1594
-			err = errnoErr(e1)
1595
-		} else {
1596
-			err = syscall.EINVAL
1597
-		}
1245
+		err = errnoErr(e1)
1598 1246
 	}
1599 1247
 	return
1600 1248
 }
1601 1249
 
1602
-func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) {
1603
-	r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0)
1604
-	n = uint32(r0)
1605
-	if n == 0 {
1606
-		if e1 != 0 {
1607
-			err = errnoErr(e1)
1608
-		} else {
1609
-			err = syscall.EINVAL
1610
-		}
1250
+func CancelIoEx(s Handle, o *Overlapped) (err error) {
1251
+	r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0)
1252
+	if r1 == 0 {
1253
+		err = errnoErr(e1)
1611 1254
 	}
1612 1255
 	return
1613 1256
 }
1614 1257
 
1615
-func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) {
1616
-	r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen))
1617
-	n = uint32(r0)
1618
-	if n == 0 {
1619
-		if e1 != 0 {
1620
-			err = errnoErr(e1)
1621
-		} else {
1622
-			err = syscall.EINVAL
1623
-		}
1258
+func CloseHandle(handle Handle) (err error) {
1259
+	r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
1260
+	if r1 == 0 {
1261
+		err = errnoErr(e1)
1624 1262
 	}
1625 1263
 	return
1626 1264
 }
1627 1265
 
1628
-func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) {
1629
-	r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen))
1630
-	n = uint32(r0)
1631
-	if n == 0 {
1632
-		if e1 != 0 {
1633
-			err = errnoErr(e1)
1634
-		} else {
1635
-			err = syscall.EINVAL
1636
-		}
1266
+func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
1267
+	r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
1268
+	if r1 == 0 {
1269
+		err = errnoErr(e1)
1637 1270
 	}
1638 1271
 	return
1639 1272
 }
1640 1273
 
1641
-func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) {
1642
-	r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
1274
+func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
1275
+	r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
1643 1276
 	handle = Handle(r0)
1644 1277
 	if handle == 0 {
1645
-		if e1 != 0 {
1646
-			err = errnoErr(e1)
1647
-		} else {
1648
-			err = syscall.EINVAL
1649
-		}
1278
+		err = errnoErr(e1)
1650 1279
 	}
1651 1280
 	return
1652 1281
 }
1653 1282
 
1654
-func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) {
1655
-	r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
1656
-	addr = uintptr(r0)
1657
-	if addr == 0 {
1658
-		if e1 != 0 {
1659
-			err = errnoErr(e1)
1660
-		} else {
1661
-			err = syscall.EINVAL
1662
-		}
1283
+func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) {
1284
+	r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
1285
+	handle = Handle(r0)
1286
+	if handle == 0 {
1287
+		err = errnoErr(e1)
1663 1288
 	}
1664 1289
 	return
1665 1290
 }
1666 1291
 
1667
-func UnmapViewOfFile(addr uintptr) (err error) {
1668
-	r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
1669
-	if r1 == 0 {
1670
-		if e1 != 0 {
1671
-			err = errnoErr(e1)
1672
-		} else {
1673
-			err = syscall.EINVAL
1674
-		}
1292
+func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) {
1293
+	r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
1294
+	handle = Handle(r0)
1295
+	if handle == 0 {
1296
+		err = errnoErr(e1)
1675 1297
 	}
1676 1298
 	return
1677 1299
 }
1678 1300
 
1679
-func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
1680
-	r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
1681
-	if r1 == 0 {
1682
-		if e1 != 0 {
1683
-			err = errnoErr(e1)
1684
-		} else {
1685
-			err = syscall.EINVAL
1686
-		}
1301
+func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
1302
+	r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
1303
+	handle = Handle(r0)
1304
+	if handle == InvalidHandle {
1305
+		err = errnoErr(e1)
1687 1306
 	}
1688 1307
 	return
1689 1308
 }
1690 1309
 
1691
-func VirtualLock(addr uintptr, length uintptr) (err error) {
1692
-	r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
1693
-	if r1 == 0 {
1694
-		if e1 != 0 {
1695
-			err = errnoErr(e1)
1696
-		} else {
1697
-			err = syscall.EINVAL
1698
-		}
1310
+func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) {
1311
+	r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved))
1312
+	if r1&0xff == 0 {
1313
+		err = errnoErr(e1)
1699 1314
 	}
1700 1315
 	return
1701 1316
 }
1702 1317
 
1703
-func VirtualUnlock(addr uintptr, length uintptr) (err error) {
1704
-	r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
1705
-	if r1 == 0 {
1706
-		if e1 != 0 {
1707
-			err = errnoErr(e1)
1708
-		} else {
1709
-			err = syscall.EINVAL
1710
-		}
1318
+func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) {
1319
+	r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
1320
+	handle = Handle(r0)
1321
+	if handle == 0 {
1322
+		err = errnoErr(e1)
1711 1323
 	}
1712 1324
 	return
1713 1325
 }
1714 1326
 
1715
-func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) {
1716
-	r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0)
1717
-	value = uintptr(r0)
1718
-	if value == 0 {
1719
-		if e1 != 0 {
1720
-			err = errnoErr(e1)
1721
-		} else {
1722
-			err = syscall.EINVAL
1723
-		}
1327
+func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) {
1328
+	r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0)
1329
+	handle = Handle(r0)
1330
+	if handle == 0 {
1331
+		err = errnoErr(e1)
1724 1332
 	}
1725 1333
 	return
1726 1334
 }
1727 1335
 
1728
-func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) {
1729
-	r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype))
1730
-	if r1 == 0 {
1731
-		if e1 != 0 {
1732
-			err = errnoErr(e1)
1733
-		} else {
1734
-			err = syscall.EINVAL
1735
-		}
1336
+func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
1337
+	r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
1338
+	handle = Handle(r0)
1339
+	if handle == 0 {
1340
+		err = errnoErr(e1)
1736 1341
 	}
1737 1342
 	return
1738 1343
 }
1739 1344
 
1740
-func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) {
1741
-	r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0)
1742
-	if r1 == 0 {
1743
-		if e1 != 0 {
1744
-			err = errnoErr(e1)
1745
-		} else {
1746
-			err = syscall.EINVAL
1747
-		}
1345
+func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) {
1346
+	var _p0 uint32
1347
+	if initialOwner {
1348
+		_p0 = 1
1349
+	}
1350
+	r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name)))
1351
+	handle = Handle(r0)
1352
+	if handle == 0 {
1353
+		err = errnoErr(e1)
1748 1354
 	}
1749 1355
 	return
1750 1356
 }
1751 1357
 
1752
-func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
1753
-	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)
1358
+func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
1359
+	r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
1754 1360
 	if r1 == 0 {
1755
-		if e1 != 0 {
1756
-			err = errnoErr(e1)
1757
-		} else {
1758
-			err = syscall.EINVAL
1759
-		}
1361
+		err = errnoErr(e1)
1760 1362
 	}
1761 1363
 	return
1762 1364
 }
1763 1365
 
1764
-func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
1366
+func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
1765 1367
 	var _p0 uint32
1766
-	if watchSubTree {
1368
+	if inheritHandles {
1767 1369
 		_p0 = 1
1768
-	} else {
1769
-		_p0 = 0
1770 1370
 	}
1771
-	r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0)
1371
+	r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0)
1772 1372
 	if r1 == 0 {
1773
-		if e1 != 0 {
1774
-			err = errnoErr(e1)
1775
-		} else {
1776
-			err = syscall.EINVAL
1777
-		}
1373
+		err = errnoErr(e1)
1778 1374
 	}
1779 1375
 	return
1780 1376
 }
1781 1377
 
1782
-func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
1783
-	r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0)
1784
-	store = Handle(r0)
1785
-	if store == 0 {
1786
-		if e1 != 0 {
1787
-			err = errnoErr(e1)
1788
-		} else {
1789
-			err = syscall.EINVAL
1790
-		}
1378
+func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) {
1379
+	r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags))
1380
+	if r1&0xff == 0 {
1381
+		err = errnoErr(e1)
1791 1382
 	}
1792 1383
 	return
1793 1384
 }
1794 1385
 
1795
-func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
1796
-	r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
1386
+func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) {
1387
+	r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0)
1797 1388
 	handle = Handle(r0)
1798 1389
 	if handle == InvalidHandle {
1799
-		if e1 != 0 {
1800
-			err = errnoErr(e1)
1801
-		} else {
1802
-			err = syscall.EINVAL
1803
-		}
1390
+		err = errnoErr(e1)
1804 1391
 	}
1805 1392
 	return
1806 1393
 }
1807 1394
 
1808
-func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) {
1809
-	r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0)
1810
-	context = (*CertContext)(unsafe.Pointer(r0))
1811
-	if context == nil {
1812
-		if e1 != 0 {
1813
-			err = errnoErr(e1)
1814
-		} else {
1815
-			err = syscall.EINVAL
1816
-		}
1395
+func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
1396
+	r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
1397
+	if r1 == 0 {
1398
+		err = errnoErr(e1)
1817 1399
 	}
1818 1400
 	return
1819 1401
 }
1820 1402
 
1821
-func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
1822
-	r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
1403
+func DeleteFile(path *uint16) (err error) {
1404
+	r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
1823 1405
 	if r1 == 0 {
1824
-		if e1 != 0 {
1825
-			err = errnoErr(e1)
1826
-		} else {
1827
-			err = syscall.EINVAL
1828
-		}
1406
+		err = errnoErr(e1)
1829 1407
 	}
1830 1408
 	return
1831 1409
 }
1832 1410
 
1833
-func CertCloseStore(store Handle, flags uint32) (err error) {
1834
-	r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
1411
+func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) {
1412
+	r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0)
1835 1413
 	if r1 == 0 {
1836
-		if e1 != 0 {
1837
-			err = errnoErr(e1)
1838
-		} else {
1839
-			err = syscall.EINVAL
1840
-		}
1414
+		err = errnoErr(e1)
1841 1415
 	}
1842 1416
 	return
1843 1417
 }
1844 1418
 
1845
-func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
1846
-	r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0)
1419
+func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
1420
+	r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0)
1847 1421
 	if r1 == 0 {
1848
-		if e1 != 0 {
1849
-			err = errnoErr(e1)
1850
-		} else {
1851
-			err = syscall.EINVAL
1852
-		}
1422
+		err = errnoErr(e1)
1853 1423
 	}
1854 1424
 	return
1855 1425
 }
1856 1426
 
1857
-func CertFreeCertificateChain(ctx *CertChainContext) {
1858
-	syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1427
+func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
1428
+	var _p0 uint32
1429
+	if bInheritHandle {
1430
+		_p0 = 1
1431
+	}
1432
+	r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
1433
+	if r1 == 0 {
1434
+		err = errnoErr(e1)
1435
+	}
1859 1436
 	return
1860 1437
 }
1861 1438
 
1862
-func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) {
1863
-	r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen))
1864
-	context = (*CertContext)(unsafe.Pointer(r0))
1865
-	if context == nil {
1866
-		if e1 != 0 {
1867
-			err = errnoErr(e1)
1868
-		} else {
1869
-			err = syscall.EINVAL
1870
-		}
1871
-	}
1439
+func ExitProcess(exitcode uint32) {
1440
+	syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
1872 1441
 	return
1873 1442
 }
1874 1443
 
1875
-func CertFreeCertificateContext(ctx *CertContext) (err error) {
1876
-	r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1444
+func FindClose(handle Handle) (err error) {
1445
+	r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
1877 1446
 	if r1 == 0 {
1878
-		if e1 != 0 {
1879
-			err = errnoErr(e1)
1880
-		} else {
1881
-			err = syscall.EINVAL
1882
-		}
1447
+		err = errnoErr(e1)
1883 1448
 	}
1884 1449
 	return
1885 1450
 }
1886 1451
 
1887
-func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
1888
-	r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
1889
-	if r1 == 0 {
1890
-		if e1 != 0 {
1891
-			err = errnoErr(e1)
1892
-		} else {
1893
-			err = syscall.EINVAL
1894
-		}
1452
+func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) {
1453
+	r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
1454
+	handle = Handle(r0)
1455
+	if handle == InvalidHandle {
1456
+		err = errnoErr(e1)
1895 1457
 	}
1896 1458
 	return
1897 1459
 }
1898 1460
 
1899
-func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) {
1900
-	r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0)
1901
-	if r0 != 0 {
1902
-		regerrno = syscall.Errno(r0)
1461
+func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) {
1462
+	r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
1463
+	handle = Handle(r0)
1464
+	if handle == InvalidHandle {
1465
+		err = errnoErr(e1)
1903 1466
 	}
1904 1467
 	return
1905 1468
 }
1906 1469
 
1907
-func RegCloseKey(key Handle) (regerrno error) {
1908
-	r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0)
1909
-	if r0 != 0 {
1910
-		regerrno = syscall.Errno(r0)
1470
+func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) {
1471
+	r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0)
1472
+	handle = Handle(r0)
1473
+	if handle == InvalidHandle {
1474
+		err = errnoErr(e1)
1911 1475
 	}
1912 1476
 	return
1913 1477
 }
1914 1478
 
1915
-func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) {
1916
-	r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime)))
1917
-	if r0 != 0 {
1918
-		regerrno = syscall.Errno(r0)
1479
+func findNextFile1(handle Handle, data *win32finddata1) (err error) {
1480
+	r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
1481
+	if r1 == 0 {
1482
+		err = errnoErr(e1)
1919 1483
 	}
1920 1484
 	return
1921 1485
 }
1922 1486
 
1923
-func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) {
1924
-	r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0)
1925
-	if r0 != 0 {
1926
-		regerrno = syscall.Errno(r0)
1487
+func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) {
1488
+	r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
1489
+	if r1 == 0 {
1490
+		err = errnoErr(e1)
1927 1491
 	}
1928 1492
 	return
1929 1493
 }
1930 1494
 
1931
-func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
1932
-	r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)))
1933
-	if r0 != 0 {
1934
-		regerrno = syscall.Errno(r0)
1495
+func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) {
1496
+	r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength))
1497
+	if r1 == 0 {
1498
+		err = errnoErr(e1)
1935 1499
 	}
1936 1500
 	return
1937 1501
 }
1938 1502
 
1939
-func GetCurrentProcessId() (pid uint32) {
1940
-	r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
1941
-	pid = uint32(r0)
1503
+func FindVolumeClose(findVolume Handle) (err error) {
1504
+	r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0)
1505
+	if r1 == 0 {
1506
+		err = errnoErr(e1)
1507
+	}
1942 1508
 	return
1943 1509
 }
1944 1510
 
1945
-func GetConsoleMode(console Handle, mode *uint32) (err error) {
1946
-	r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
1511
+func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) {
1512
+	r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0)
1947 1513
 	if r1 == 0 {
1948
-		if e1 != 0 {
1949
-			err = errnoErr(e1)
1950
-		} else {
1951
-			err = syscall.EINVAL
1952
-		}
1514
+		err = errnoErr(e1)
1953 1515
 	}
1954 1516
 	return
1955 1517
 }
1956 1518
 
1957
-func SetConsoleMode(console Handle, mode uint32) (err error) {
1958
-	r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0)
1519
+func FlushFileBuffers(handle Handle) (err error) {
1520
+	r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
1959 1521
 	if r1 == 0 {
1960
-		if e1 != 0 {
1961
-			err = errnoErr(e1)
1962
-		} else {
1963
-			err = syscall.EINVAL
1964
-		}
1522
+		err = errnoErr(e1)
1965 1523
 	}
1966 1524
 	return
1967 1525
 }
1968 1526
 
1969
-func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
1970
-	r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
1527
+func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
1528
+	r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
1971 1529
 	if r1 == 0 {
1972
-		if e1 != 0 {
1973
-			err = errnoErr(e1)
1974
-		} else {
1975
-			err = syscall.EINVAL
1976
-		}
1530
+		err = errnoErr(e1)
1977 1531
 	}
1978 1532
 	return
1979 1533
 }
1980 1534
 
1981
-func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
1982
-	r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
1983
-	if r1 == 0 {
1984
-		if e1 != 0 {
1985
-			err = errnoErr(e1)
1986
-		} else {
1987
-			err = syscall.EINVAL
1988
-		}
1535
+func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) {
1536
+	var _p0 *uint16
1537
+	if len(buf) > 0 {
1538
+		_p0 = &buf[0]
1539
+	}
1540
+	r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0)
1541
+	n = uint32(r0)
1542
+	if n == 0 {
1543
+		err = errnoErr(e1)
1989 1544
 	}
1990 1545
 	return
1991 1546
 }
1992 1547
 
1993
-func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) {
1994
-	r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0)
1548
+func FreeEnvironmentStrings(envs *uint16) (err error) {
1549
+	r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
1995 1550
 	if r1 == 0 {
1996
-		if e1 != 0 {
1997
-			err = errnoErr(e1)
1998
-		} else {
1999
-			err = syscall.EINVAL
2000
-		}
1551
+		err = errnoErr(e1)
2001 1552
 	}
2002 1553
 	return
2003 1554
 }
2004 1555
 
2005
-func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) {
2006
-	r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0)
2007
-	handle = Handle(r0)
2008
-	if handle == InvalidHandle {
2009
-		if e1 != 0 {
2010
-			err = errnoErr(e1)
2011
-		} else {
2012
-			err = syscall.EINVAL
2013
-		}
1556
+func FreeLibrary(handle Handle) (err error) {
1557
+	r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
1558
+	if r1 == 0 {
1559
+		err = errnoErr(e1)
2014 1560
 	}
2015 1561
 	return
2016 1562
 }
2017 1563
 
2018
-func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2019
-	r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
1564
+func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) {
1565
+	r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0)
2020 1566
 	if r1 == 0 {
2021
-		if e1 != 0 {
2022
-			err = errnoErr(e1)
2023
-		} else {
2024
-			err = syscall.EINVAL
2025
-		}
1567
+		err = errnoErr(e1)
2026 1568
 	}
2027 1569
 	return
2028 1570
 }
2029 1571
 
2030
-func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2031
-	r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
1572
+func GetACP() (acp uint32) {
1573
+	r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
1574
+	acp = uint32(r0)
1575
+	return
1576
+}
1577
+
1578
+func GetCommandLine() (cmd *uint16) {
1579
+	r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0)
1580
+	cmd = (*uint16)(unsafe.Pointer(r0))
1581
+	return
1582
+}
1583
+
1584
+func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) {
1585
+	r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
2032 1586
 	if r1 == 0 {
2033
-		if e1 != 0 {
2034
-			err = errnoErr(e1)
2035
-		} else {
2036
-			err = syscall.EINVAL
2037
-		}
1587
+		err = errnoErr(e1)
2038 1588
 	}
2039 1589
 	return
2040 1590
 }
2041 1591
 
2042
-func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
2043
-	r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
1592
+func GetComputerName(buf *uint16, n *uint32) (err error) {
1593
+	r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
2044 1594
 	if r1 == 0 {
2045
-		if e1 != 0 {
2046
-			err = errnoErr(e1)
2047
-		} else {
2048
-			err = syscall.EINVAL
2049
-		}
1595
+		err = errnoErr(e1)
2050 1596
 	}
2051 1597
 	return
2052 1598
 }
2053 1599
 
2054
-func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
2055
-	r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
1600
+func GetConsoleMode(console Handle, mode *uint32) (err error) {
1601
+	r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
2056 1602
 	if r1 == 0 {
2057
-		if e1 != 0 {
2058
-			err = errnoErr(e1)
2059
-		} else {
2060
-			err = syscall.EINVAL
2061
-		}
1603
+		err = errnoErr(e1)
2062 1604
 	}
2063 1605
 	return
2064 1606
 }
2065 1607
 
2066
-func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
2067
-	r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0)
1608
+func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
1609
+	r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
2068 1610
 	if r1 == 0 {
2069
-		if e1 != 0 {
2070
-			err = errnoErr(e1)
2071
-		} else {
2072
-			err = syscall.EINVAL
2073
-		}
1611
+		err = errnoErr(e1)
2074 1612
 	}
2075 1613
 	return
2076 1614
 }
2077 1615
 
2078
-func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) {
2079
-	r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags))
2080
-	if r1&0xff == 0 {
2081
-		if e1 != 0 {
2082
-			err = errnoErr(e1)
2083
-		} else {
2084
-			err = syscall.EINVAL
2085
-		}
1616
+func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
1617
+	r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
1618
+	n = uint32(r0)
1619
+	if n == 0 {
1620
+		err = errnoErr(e1)
2086 1621
 	}
2087 1622
 	return
2088 1623
 }
2089 1624
 
2090
-func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) {
2091
-	r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved))
2092
-	if r1&0xff == 0 {
2093
-		if e1 != 0 {
2094
-			err = errnoErr(e1)
2095
-		} else {
2096
-			err = syscall.EINVAL
2097
-		}
2098
-	}
1625
+func GetCurrentProcessId() (pid uint32) {
1626
+	r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
1627
+	pid = uint32(r0)
2099 1628
 	return
2100 1629
 }
2101 1630
 
... ...
@@ -2105,226 +1634,157 @@ func GetCurrentThreadId() (id uint32) {
2105 2105
 	return
2106 2106
 }
2107 2107
 
2108
-func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) {
2109
-	r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
2110
-	handle = Handle(r0)
2111
-	if handle == 0 {
2112
-		if e1 != 0 {
2113
-			err = errnoErr(e1)
2114
-		} else {
2115
-			err = syscall.EINVAL
2116
-		}
2108
+func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) {
2109
+	r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0)
2110
+	if r1 == 0 {
2111
+		err = errnoErr(e1)
2117 2112
 	}
2118 2113
 	return
2119 2114
 }
2120 2115
 
2121
-func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
2122
-	r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
2123
-	handle = Handle(r0)
2124
-	if handle == 0 {
2125
-		if e1 != 0 {
2126
-			err = errnoErr(e1)
2127
-		} else {
2128
-			err = syscall.EINVAL
2129
-		}
2130
-	}
2116
+func GetDriveType(rootPathName *uint16) (driveType uint32) {
2117
+	r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
2118
+	driveType = uint32(r0)
2131 2119
 	return
2132 2120
 }
2133 2121
 
2134
-func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2135
-	var _p0 uint32
2136
-	if inheritHandle {
2137
-		_p0 = 1
2138
-	} else {
2139
-		_p0 = 0
2140
-	}
2141
-	r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2142
-	handle = Handle(r0)
2143
-	if handle == 0 {
2144
-		if e1 != 0 {
2145
-			err = errnoErr(e1)
2146
-		} else {
2147
-			err = syscall.EINVAL
2148
-		}
2122
+func GetEnvironmentStrings() (envs *uint16, err error) {
2123
+	r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0)
2124
+	envs = (*uint16)(unsafe.Pointer(r0))
2125
+	if envs == nil {
2126
+		err = errnoErr(e1)
2149 2127
 	}
2150 2128
 	return
2151 2129
 }
2152 2130
 
2153
-func SetEvent(event Handle) (err error) {
2154
-	r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0)
2155
-	if r1 == 0 {
2156
-		if e1 != 0 {
2157
-			err = errnoErr(e1)
2158
-		} else {
2159
-			err = syscall.EINVAL
2160
-		}
2131
+func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) {
2132
+	r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size))
2133
+	n = uint32(r0)
2134
+	if n == 0 {
2135
+		err = errnoErr(e1)
2161 2136
 	}
2162 2137
 	return
2163 2138
 }
2164 2139
 
2165
-func ResetEvent(event Handle) (err error) {
2166
-	r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
2140
+func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
2141
+	r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
2167 2142
 	if r1 == 0 {
2168
-		if e1 != 0 {
2169
-			err = errnoErr(e1)
2170
-		} else {
2171
-			err = syscall.EINVAL
2172
-		}
2143
+		err = errnoErr(e1)
2173 2144
 	}
2174 2145
 	return
2175 2146
 }
2176 2147
 
2177
-func PulseEvent(event Handle) (err error) {
2178
-	r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0)
2148
+func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
2149
+	r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
2179 2150
 	if r1 == 0 {
2180
-		if e1 != 0 {
2181
-			err = errnoErr(e1)
2182
-		} else {
2183
-			err = syscall.EINVAL
2184
-		}
2151
+		err = errnoErr(e1)
2185 2152
 	}
2186 2153
 	return
2187 2154
 }
2188 2155
 
2189
-func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) {
2190
-	var _p0 uint32
2191
-	if initialOwner {
2192
-		_p0 = 1
2193
-	} else {
2194
-		_p0 = 0
2195
-	}
2196
-	r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2197
-	handle = Handle(r0)
2198
-	if handle == 0 {
2199
-		if e1 != 0 {
2200
-			err = errnoErr(e1)
2201
-		} else {
2202
-			err = syscall.EINVAL
2203
-		}
2156
+func GetFileAttributes(name *uint16) (attrs uint32, err error) {
2157
+	r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
2158
+	attrs = uint32(r0)
2159
+	if attrs == INVALID_FILE_ATTRIBUTES {
2160
+		err = errnoErr(e1)
2204 2161
 	}
2205 2162
 	return
2206 2163
 }
2207 2164
 
2208
-func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
2209
-	r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
2210
-	handle = Handle(r0)
2211
-	if handle == 0 {
2212
-		if e1 != 0 {
2213
-			err = errnoErr(e1)
2214
-		} else {
2215
-			err = syscall.EINVAL
2216
-		}
2165
+func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
2166
+	r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
2167
+	if r1 == 0 {
2168
+		err = errnoErr(e1)
2217 2169
 	}
2218 2170
 	return
2219 2171
 }
2220 2172
 
2221
-func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2222
-	var _p0 uint32
2223
-	if inheritHandle {
2224
-		_p0 = 1
2225
-	} else {
2226
-		_p0 = 0
2173
+func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) {
2174
+	r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0)
2175
+	if r1 == 0 {
2176
+		err = errnoErr(e1)
2227 2177
 	}
2228
-	r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2229
-	handle = Handle(r0)
2230
-	if handle == 0 {
2231
-		if e1 != 0 {
2232
-			err = errnoErr(e1)
2233
-		} else {
2234
-			err = syscall.EINVAL
2235
-		}
2178
+	return
2179
+}
2180
+
2181
+func GetFileType(filehandle Handle) (n uint32, err error) {
2182
+	r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0)
2183
+	n = uint32(r0)
2184
+	if n == 0 {
2185
+		err = errnoErr(e1)
2236 2186
 	}
2237 2187
 	return
2238 2188
 }
2239 2189
 
2240
-func ReleaseMutex(mutex Handle) (err error) {
2241
-	r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0)
2242
-	if r1 == 0 {
2243
-		if e1 != 0 {
2244
-			err = errnoErr(e1)
2245
-		} else {
2246
-			err = syscall.EINVAL
2247
-		}
2190
+func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) {
2191
+	r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0)
2192
+	n = uint32(r0)
2193
+	if n == 0 {
2194
+		err = errnoErr(e1)
2248 2195
 	}
2249 2196
 	return
2250 2197
 }
2251 2198
 
2252
-func SleepEx(milliseconds uint32, alertable bool) (ret uint32) {
2253
-	var _p0 uint32
2254
-	if alertable {
2255
-		_p0 = 1
2256
-	} else {
2257
-		_p0 = 0
2199
+func GetLastError() (lasterr error) {
2200
+	r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
2201
+	if r0 != 0 {
2202
+		lasterr = syscall.Errno(r0)
2258 2203
 	}
2259
-	r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0)
2260
-	ret = uint32(r0)
2261 2204
 	return
2262 2205
 }
2263 2206
 
2264
-func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) {
2265
-	r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0)
2266
-	handle = Handle(r0)
2267
-	if handle == 0 {
2268
-		if e1 != 0 {
2269
-			err = errnoErr(e1)
2270
-		} else {
2271
-			err = syscall.EINVAL
2272
-		}
2207
+func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) {
2208
+	r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0)
2209
+	n = uint32(r0)
2210
+	if n == 0 {
2211
+		err = errnoErr(e1)
2273 2212
 	}
2274 2213
 	return
2275 2214
 }
2276 2215
 
2277
-func AssignProcessToJobObject(job Handle, process Handle) (err error) {
2278
-	r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
2279
-	if r1 == 0 {
2280
-		if e1 != 0 {
2281
-			err = errnoErr(e1)
2282
-		} else {
2283
-			err = syscall.EINVAL
2284
-		}
2216
+func GetLogicalDrives() (drivesBitMask uint32, err error) {
2217
+	r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0)
2218
+	drivesBitMask = uint32(r0)
2219
+	if drivesBitMask == 0 {
2220
+		err = errnoErr(e1)
2285 2221
 	}
2286 2222
 	return
2287 2223
 }
2288 2224
 
2289
-func TerminateJobObject(job Handle, exitCode uint32) (err error) {
2290
-	r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0)
2291
-	if r1 == 0 {
2292
-		if e1 != 0 {
2293
-			err = errnoErr(e1)
2294
-		} else {
2295
-			err = syscall.EINVAL
2296
-		}
2225
+func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) {
2226
+	r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen))
2227
+	n = uint32(r0)
2228
+	if n == 0 {
2229
+		err = errnoErr(e1)
2297 2230
 	}
2298 2231
 	return
2299 2232
 }
2300 2233
 
2301
-func SetErrorMode(mode uint32) (ret uint32) {
2302
-	r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0)
2303
-	ret = uint32(r0)
2234
+func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) {
2235
+	r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size))
2236
+	n = uint32(r0)
2237
+	if n == 0 {
2238
+		err = errnoErr(e1)
2239
+	}
2304 2240
 	return
2305 2241
 }
2306 2242
 
2307
-func ResumeThread(thread Handle) (ret uint32, err error) {
2308
-	r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0)
2309
-	ret = uint32(r0)
2310
-	if ret == 0xffffffff {
2311
-		if e1 != 0 {
2312
-			err = errnoErr(e1)
2313
-		} else {
2314
-			err = syscall.EINVAL
2315
-		}
2243
+func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) {
2244
+	r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module)))
2245
+	if r1 == 0 {
2246
+		err = errnoErr(e1)
2316 2247
 	}
2317 2248
 	return
2318 2249
 }
2319 2250
 
2320
-func SetPriorityClass(process Handle, priorityClass uint32) (err error) {
2321
-	r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0)
2251
+func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
2252
+	var _p0 uint32
2253
+	if wait {
2254
+		_p0 = 1
2255
+	}
2256
+	r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0)
2322 2257
 	if r1 == 0 {
2323
-		if e1 != 0 {
2324
-			err = errnoErr(e1)
2325
-		} else {
2326
-			err = syscall.EINVAL
2327
-		}
2258
+		err = errnoErr(e1)
2328 2259
 	}
2329 2260
 	return
2330 2261
 }
... ...
@@ -2333,48 +1793,25 @@ func GetPriorityClass(process Handle) (ret uint32, err error) {
2333 2333
 	r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0)
2334 2334
 	ret = uint32(r0)
2335 2335
 	if ret == 0 {
2336
-		if e1 != 0 {
2337
-			err = errnoErr(e1)
2338
-		} else {
2339
-			err = syscall.EINVAL
2340
-		}
2341
-	}
2342
-	return
2343
-}
2344
-
2345
-func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) {
2346
-	r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0)
2347
-	if r1 == 0 {
2348
-		if e1 != 0 {
2349
-			err = errnoErr(e1)
2350
-		} else {
2351
-			err = syscall.EINVAL
2352
-		}
2336
+		err = errnoErr(e1)
2353 2337
 	}
2354 2338
 	return
2355 2339
 }
2356 2340
 
2357
-func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
2358
-	r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
2359
-	ret = int(r0)
2360
-	if ret == 0 {
2361
-		if e1 != 0 {
2362
-			err = errnoErr(e1)
2363
-		} else {
2364
-			err = syscall.EINVAL
2365
-		}
2341
+func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
2342
+	var _p0 *byte
2343
+	_p0, err = syscall.BytePtrFromString(procname)
2344
+	if err != nil {
2345
+		return
2366 2346
 	}
2367
-	return
2347
+	return _GetProcAddress(module, _p0)
2368 2348
 }
2369 2349
 
2370
-func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) {
2371
-	r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0)
2372
-	if r1 == 0 {
2373
-		if e1 != 0 {
2374
-			err = errnoErr(e1)
2375
-		} else {
2376
-			err = syscall.EINVAL
2377
-		}
2350
+func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) {
2351
+	r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0)
2352
+	proc = uintptr(r0)
2353
+	if proc == 0 {
2354
+		err = errnoErr(e1)
2378 2355
 	}
2379 2356
 	return
2380 2357
 }
... ...
@@ -2383,48 +1820,31 @@ func GetProcessId(process Handle) (id uint32, err error) {
2383 2383
 	r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0)
2384 2384
 	id = uint32(r0)
2385 2385
 	if id == 0 {
2386
-		if e1 != 0 {
2387
-			err = errnoErr(e1)
2388
-		} else {
2389
-			err = syscall.EINVAL
2390
-		}
2386
+		err = errnoErr(e1)
2391 2387
 	}
2392 2388
 	return
2393 2389
 }
2394 2390
 
2395
-func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) {
2396
-	var _p0 uint32
2397
-	if inheritHandle {
2398
-		_p0 = 1
2399
-	} else {
2400
-		_p0 = 0
2401
-	}
2402
-	r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId))
2403
-	handle = Handle(r0)
2404
-	if handle == 0 {
2405
-		if e1 != 0 {
2406
-			err = errnoErr(e1)
2407
-		} else {
2408
-			err = syscall.EINVAL
2409
-		}
2391
+func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2392
+	r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2393
+	if r1 == 0 {
2394
+		err = errnoErr(e1)
2410 2395
 	}
2411 2396
 	return
2412 2397
 }
2413 2398
 
2414
-func SetProcessPriorityBoost(process Handle, disable bool) (err error) {
2415
-	var _p0 uint32
2416
-	if disable {
2417
-		_p0 = 1
2418
-	} else {
2419
-		_p0 = 0
2399
+func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) {
2400
+	r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0)
2401
+	if r1 == 0 {
2402
+		err = errnoErr(e1)
2420 2403
 	}
2421
-	r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0)
2404
+	return
2405
+}
2406
+
2407
+func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
2408
+	r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
2422 2409
 	if r1 == 0 {
2423
-		if e1 != 0 {
2424
-			err = errnoErr(e1)
2425
-		} else {
2426
-			err = syscall.EINVAL
2427
-		}
2410
+		err = errnoErr(e1)
2428 2411
 	}
2429 2412
 	return
2430 2413
 }
... ...
@@ -2434,168 +1854,121 @@ func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintpt
2434 2434
 	return
2435 2435
 }
2436 2436
 
2437
-func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) {
2438
-	r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0)
2437
+func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
2438
+	r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
2439 2439
 	if r1 == 0 {
2440
-		if e1 != 0 {
2441
-			err = errnoErr(e1)
2442
-		} else {
2443
-			err = syscall.EINVAL
2444
-		}
2440
+		err = errnoErr(e1)
2445 2441
 	}
2446 2442
 	return
2447 2443
 }
2448 2444
 
2449
-func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
2450
-	r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
2451
-	if r1 == 0 {
2452
-		if e1 != 0 {
2453
-			err = errnoErr(e1)
2454
-		} else {
2455
-			err = syscall.EINVAL
2456
-		}
2445
+func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) {
2446
+	r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen))
2447
+	n = uint32(r0)
2448
+	if n == 0 {
2449
+		err = errnoErr(e1)
2457 2450
 	}
2458 2451
 	return
2459 2452
 }
2460 2453
 
2461
-func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) {
2462
-	r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0)
2454
+func GetStartupInfo(startupInfo *StartupInfo) (err error) {
2455
+	r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
2463 2456
 	if r1 == 0 {
2464
-		if e1 != 0 {
2465
-			err = errnoErr(e1)
2466
-		} else {
2467
-			err = syscall.EINVAL
2468
-		}
2457
+		err = errnoErr(e1)
2469 2458
 	}
2470 2459
 	return
2471 2460
 }
2472 2461
 
2473
-func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) {
2474
-	r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0)
2462
+func GetStdHandle(stdhandle uint32) (handle Handle, err error) {
2463
+	r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0)
2475 2464
 	handle = Handle(r0)
2476 2465
 	if handle == InvalidHandle {
2477
-		if e1 != 0 {
2478
-			err = errnoErr(e1)
2479
-		} else {
2480
-			err = syscall.EINVAL
2481
-		}
2466
+		err = errnoErr(e1)
2482 2467
 	}
2483 2468
 	return
2484 2469
 }
2485 2470
 
2486
-func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) {
2487
-	r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
2488
-	handle = Handle(r0)
2489
-	if handle == InvalidHandle {
2490
-		if e1 != 0 {
2491
-			err = errnoErr(e1)
2492
-		} else {
2493
-			err = syscall.EINVAL
2494
-		}
2471
+func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2472
+	r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2473
+	len = uint32(r0)
2474
+	if len == 0 {
2475
+		err = errnoErr(e1)
2495 2476
 	}
2496 2477
 	return
2497 2478
 }
2498 2479
 
2499
-func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) {
2500
-	r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength))
2480
+func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2481
+	r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2501 2482
 	if r1 == 0 {
2502
-		if e1 != 0 {
2503
-			err = errnoErr(e1)
2504
-		} else {
2505
-			err = syscall.EINVAL
2506
-		}
2483
+		err = errnoErr(e1)
2507 2484
 	}
2508 2485
 	return
2509 2486
 }
2510 2487
 
2511
-func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) {
2512
-	r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
2513
-	if r1 == 0 {
2514
-		if e1 != 0 {
2515
-			err = errnoErr(e1)
2516
-		} else {
2517
-			err = syscall.EINVAL
2518
-		}
2519
-	}
2488
+func GetSystemTimeAsFileTime(time *Filetime) {
2489
+	syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
2520 2490
 	return
2521 2491
 }
2522 2492
 
2523
-func FindVolumeClose(findVolume Handle) (err error) {
2524
-	r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0)
2525
-	if r1 == 0 {
2526
-		if e1 != 0 {
2527
-			err = errnoErr(e1)
2528
-		} else {
2529
-			err = syscall.EINVAL
2530
-		}
2493
+func GetSystemTimePreciseAsFileTime(time *Filetime) {
2494
+	syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
2495
+	return
2496
+}
2497
+
2498
+func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2499
+	r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2500
+	len = uint32(r0)
2501
+	if len == 0 {
2502
+		err = errnoErr(e1)
2531 2503
 	}
2532 2504
 	return
2533 2505
 }
2534 2506
 
2535
-func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) {
2536
-	r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0)
2537
-	if r1 == 0 {
2538
-		if e1 != 0 {
2539
-			err = errnoErr(e1)
2540
-		} else {
2541
-			err = syscall.EINVAL
2542
-		}
2507
+func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
2508
+	r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
2509
+	n = uint32(r0)
2510
+	if n == 0 {
2511
+		err = errnoErr(e1)
2543 2512
 	}
2544 2513
 	return
2545 2514
 }
2546 2515
 
2547
-func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) {
2548
-	r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0)
2516
+func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2517
+	r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2549 2518
 	if r1 == 0 {
2550
-		if e1 != 0 {
2551
-			err = errnoErr(e1)
2552
-		} else {
2553
-			err = syscall.EINVAL
2554
-		}
2519
+		err = errnoErr(e1)
2555 2520
 	}
2556 2521
 	return
2557 2522
 }
2558 2523
 
2559
-func GetDriveType(rootPathName *uint16) (driveType uint32) {
2560
-	r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
2561
-	driveType = uint32(r0)
2524
+func getTickCount64() (ms uint64) {
2525
+	r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0)
2526
+	ms = uint64(r0)
2562 2527
 	return
2563 2528
 }
2564 2529
 
2565
-func GetLogicalDrives() (drivesBitMask uint32, err error) {
2566
-	r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0)
2567
-	drivesBitMask = uint32(r0)
2568
-	if drivesBitMask == 0 {
2569
-		if e1 != 0 {
2570
-			err = errnoErr(e1)
2571
-		} else {
2572
-			err = syscall.EINVAL
2573
-		}
2530
+func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
2531
+	r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0)
2532
+	rc = uint32(r0)
2533
+	if rc == 0xffffffff {
2534
+		err = errnoErr(e1)
2574 2535
 	}
2575 2536
 	return
2576 2537
 }
2577 2538
 
2578
-func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) {
2579
-	r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0)
2580
-	n = uint32(r0)
2581
-	if n == 0 {
2582
-		if e1 != 0 {
2583
-			err = errnoErr(e1)
2584
-		} else {
2585
-			err = syscall.EINVAL
2586
-		}
2539
+func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2540
+	r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2541
+	if r1 == 0 {
2542
+		err = errnoErr(e1)
2587 2543
 	}
2588 2544
 	return
2589 2545
 }
2590 2546
 
2591
-func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
2592
-	r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
2593
-	if r1 == 0 {
2594
-		if e1 != 0 {
2595
-			err = errnoErr(e1)
2596
-		} else {
2597
-			err = syscall.EINVAL
2598
-		}
2547
+func GetVersion() (ver uint32, err error) {
2548
+	r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0)
2549
+	ver = uint32(r0)
2550
+	if ver == 0 {
2551
+		err = errnoErr(e1)
2599 2552
 	}
2600 2553
 	return
2601 2554
 }
... ...
@@ -2603,11 +1976,15 @@ func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volume
2603 2603
 func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
2604 2604
 	r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
2605 2605
 	if r1 == 0 {
2606
-		if e1 != 0 {
2607
-			err = errnoErr(e1)
2608
-		} else {
2609
-			err = syscall.EINVAL
2610
-		}
2606
+		err = errnoErr(e1)
2607
+	}
2608
+	return
2609
+}
2610
+
2611
+func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
2612
+	r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
2613
+	if r1 == 0 {
2614
+		err = errnoErr(e1)
2611 2615
 	}
2612 2616
 	return
2613 2617
 }
... ...
@@ -2615,11 +1992,7 @@ func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeN
2615 2615
 func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
2616 2616
 	r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
2617 2617
 	if r1 == 0 {
2618
-		if e1 != 0 {
2619
-			err = errnoErr(e1)
2620
-		} else {
2621
-			err = syscall.EINVAL
2622
-		}
2618
+		err = errnoErr(e1)
2623 2619
 	}
2624 2620
 	return
2625 2621
 }
... ...
@@ -2627,11 +2000,7 @@ func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint
2627 2627
 func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) {
2628 2628
 	r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength))
2629 2629
 	if r1 == 0 {
2630
-		if e1 != 0 {
2631
-			err = errnoErr(e1)
2632
-		} else {
2633
-			err = syscall.EINVAL
2634
-		}
2630
+		err = errnoErr(e1)
2635 2631
 	}
2636 2632
 	return
2637 2633
 }
... ...
@@ -2639,1010 +2008,770 @@ func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength ui
2639 2639
 func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) {
2640 2640
 	r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0)
2641 2641
 	if r1 == 0 {
2642
-		if e1 != 0 {
2643
-			err = errnoErr(e1)
2644
-		} else {
2645
-			err = syscall.EINVAL
2646
-		}
2642
+		err = errnoErr(e1)
2647 2643
 	}
2648 2644
 	return
2649 2645
 }
2650 2646
 
2651
-func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
2652
-	r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
2653
-	n = uint32(r0)
2654
-	if n == 0 {
2655
-		if e1 != 0 {
2656
-			err = errnoErr(e1)
2657
-		} else {
2658
-			err = syscall.EINVAL
2659
-		}
2647
+func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2648
+	r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2649
+	len = uint32(r0)
2650
+	if len == 0 {
2651
+		err = errnoErr(e1)
2660 2652
 	}
2661 2653
 	return
2662 2654
 }
2663 2655
 
2664
-func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) {
2665
-	r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0)
2656
+func IsWow64Process(handle Handle, isWow64 *bool) (err error) {
2657
+	var _p0 uint32
2658
+	if *isWow64 {
2659
+		_p0 = 1
2660
+	}
2661
+	r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0)
2662
+	*isWow64 = _p0 != 0
2666 2663
 	if r1 == 0 {
2667
-		if e1 != 0 {
2668
-			err = errnoErr(e1)
2669
-		} else {
2670
-			err = syscall.EINVAL
2671
-		}
2664
+		err = errnoErr(e1)
2672 2665
 	}
2673 2666
 	return
2674 2667
 }
2675 2668
 
2676
-func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) {
2677
-	r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0)
2678
-	if r1 == 0 {
2679
-		if e1 != 0 {
2680
-			err = errnoErr(e1)
2681
-		} else {
2682
-			err = syscall.EINVAL
2683
-		}
2669
+func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) {
2670
+	var _p0 *uint16
2671
+	_p0, err = syscall.UTF16PtrFromString(libname)
2672
+	if err != nil {
2673
+		return
2684 2674
 	}
2685
-	return
2675
+	return _LoadLibraryEx(_p0, zero, flags)
2686 2676
 }
2687 2677
 
2688
-func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
2689
-	r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
2690
-	ret = int32(r0)
2691
-	if ret == 0 {
2692
-		if e1 != 0 {
2693
-			err = errnoErr(e1)
2694
-		} else {
2695
-			err = syscall.EINVAL
2696
-		}
2678
+func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) {
2679
+	r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags))
2680
+	handle = Handle(r0)
2681
+	if handle == 0 {
2682
+		err = errnoErr(e1)
2697 2683
 	}
2698 2684
 	return
2699 2685
 }
2700 2686
 
2701
-func ExitWindowsEx(flags uint32, reason uint32) (err error) {
2702
-	r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
2703
-	if r1 == 0 {
2704
-		if e1 != 0 {
2705
-			err = errnoErr(e1)
2706
-		} else {
2707
-			err = syscall.EINVAL
2708
-		}
2687
+func LoadLibrary(libname string) (handle Handle, err error) {
2688
+	var _p0 *uint16
2689
+	_p0, err = syscall.UTF16PtrFromString(libname)
2690
+	if err != nil {
2691
+		return
2709 2692
 	}
2710
-	return
2693
+	return _LoadLibrary(_p0)
2711 2694
 }
2712 2695
 
2713
-func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) {
2714
-	var _p0 uint32
2715
-	if forceAppsClosed {
2716
-		_p0 = 1
2717
-	} else {
2718
-		_p0 = 0
2719
-	}
2720
-	var _p1 uint32
2721
-	if rebootAfterShutdown {
2722
-		_p1 = 1
2723
-	} else {
2724
-		_p1 = 0
2696
+func _LoadLibrary(libname *uint16) (handle Handle, err error) {
2697
+	r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0)
2698
+	handle = Handle(r0)
2699
+	if handle == 0 {
2700
+		err = errnoErr(e1)
2725 2701
 	}
2726
-	r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason))
2727
-	if r1 == 0 {
2728
-		if e1 != 0 {
2729
-			err = errnoErr(e1)
2730
-		} else {
2731
-			err = syscall.EINVAL
2732
-		}
2702
+	return
2703
+}
2704
+
2705
+func LocalFree(hmem Handle) (handle Handle, err error) {
2706
+	r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0)
2707
+	handle = Handle(r0)
2708
+	if handle != 0 {
2709
+		err = errnoErr(e1)
2733 2710
 	}
2734 2711
 	return
2735 2712
 }
2736 2713
 
2737
-func SetProcessShutdownParameters(level uint32, flags uint32) (err error) {
2738
-	r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0)
2714
+func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
2715
+	r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
2739 2716
 	if r1 == 0 {
2740
-		if e1 != 0 {
2741
-			err = errnoErr(e1)
2742
-		} else {
2743
-			err = syscall.EINVAL
2744
-		}
2717
+		err = errnoErr(e1)
2745 2718
 	}
2746 2719
 	return
2747 2720
 }
2748 2721
 
2749
-func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) {
2750
-	r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0)
2751
-	if r1 == 0 {
2752
-		if e1 != 0 {
2753
-			err = errnoErr(e1)
2754
-		} else {
2755
-			err = syscall.EINVAL
2756
-		}
2722
+func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) {
2723
+	r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
2724
+	addr = uintptr(r0)
2725
+	if addr == 0 {
2726
+		err = errnoErr(e1)
2757 2727
 	}
2758 2728
 	return
2759 2729
 }
2760 2730
 
2761
-func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) {
2762
-	r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
2763
-	if r0 != 0 {
2764
-		ret = syscall.Errno(r0)
2731
+func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
2732
+	r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
2733
+	if r1 == 0 {
2734
+		err = errnoErr(e1)
2765 2735
 	}
2766 2736
 	return
2767 2737
 }
2768 2738
 
2769
-func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) {
2770
-	r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax))
2771
-	chars = int32(r0)
2739
+func MoveFile(from *uint16, to *uint16) (err error) {
2740
+	r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
2741
+	if r1 == 0 {
2742
+		err = errnoErr(e1)
2743
+	}
2772 2744
 	return
2773 2745
 }
2774 2746
 
2775
-func coCreateGuid(pguid *GUID) (ret error) {
2776
-	r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0)
2777
-	if r0 != 0 {
2778
-		ret = syscall.Errno(r0)
2747
+func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
2748
+	r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
2749
+	nwrite = int32(r0)
2750
+	if nwrite == 0 {
2751
+		err = errnoErr(e1)
2779 2752
 	}
2780 2753
 	return
2781 2754
 }
2782 2755
 
2783
-func CoTaskMemFree(address unsafe.Pointer) {
2784
-	syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0)
2756
+func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2757
+	var _p0 uint32
2758
+	if inheritHandle {
2759
+		_p0 = 1
2760
+	}
2761
+	r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2762
+	handle = Handle(r0)
2763
+	if handle == 0 {
2764
+		err = errnoErr(e1)
2765
+	}
2785 2766
 	return
2786 2767
 }
2787 2768
 
2788
-func rtlGetVersion(info *OsVersionInfoEx) (ret error) {
2789
-	r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0)
2790
-	if r0 != 0 {
2791
-		ret = syscall.Errno(r0)
2769
+func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2770
+	var _p0 uint32
2771
+	if inheritHandle {
2772
+		_p0 = 1
2773
+	}
2774
+	r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2775
+	handle = Handle(r0)
2776
+	if handle == 0 {
2777
+		err = errnoErr(e1)
2792 2778
 	}
2793 2779
 	return
2794 2780
 }
2795 2781
 
2796
-func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) {
2797
-	syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber)))
2782
+func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) {
2783
+	var _p0 uint32
2784
+	if inheritHandle {
2785
+		_p0 = 1
2786
+	}
2787
+	r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId))
2788
+	handle = Handle(r0)
2789
+	if handle == 0 {
2790
+		err = errnoErr(e1)
2791
+	}
2798 2792
 	return
2799 2793
 }
2800 2794
 
2801
-func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2802
-	r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2803
-	if r1 == 0 {
2804
-		if e1 != 0 {
2805
-			err = errnoErr(e1)
2806
-		} else {
2807
-			err = syscall.EINVAL
2808
-		}
2795
+func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) {
2796
+	var _p0 uint32
2797
+	if inheritHandle {
2798
+		_p0 = 1
2799
+	}
2800
+	r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId))
2801
+	handle = Handle(r0)
2802
+	if handle == 0 {
2803
+		err = errnoErr(e1)
2809 2804
 	}
2810 2805
 	return
2811 2806
 }
2812 2807
 
2813
-func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2814
-	r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2808
+func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
2809
+	r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
2815 2810
 	if r1 == 0 {
2816
-		if e1 != 0 {
2817
-			err = errnoErr(e1)
2818
-		} else {
2819
-			err = syscall.EINVAL
2820
-		}
2811
+		err = errnoErr(e1)
2821 2812
 	}
2822 2813
 	return
2823 2814
 }
2824 2815
 
2825
-func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2826
-	r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2816
+func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2817
+	r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
2827 2818
 	if r1 == 0 {
2828
-		if e1 != 0 {
2829
-			err = errnoErr(e1)
2830
-		} else {
2831
-			err = syscall.EINVAL
2832
-		}
2819
+		err = errnoErr(e1)
2833 2820
 	}
2834 2821
 	return
2835 2822
 }
2836 2823
 
2837
-func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2838
-	r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2824
+func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2825
+	r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
2839 2826
 	if r1 == 0 {
2840
-		if e1 != 0 {
2841
-			err = errnoErr(e1)
2842
-		} else {
2843
-			err = syscall.EINVAL
2844
-		}
2827
+		err = errnoErr(e1)
2845 2828
 	}
2846 2829
 	return
2847 2830
 }
2848 2831
 
2849
-func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) {
2850
-	var _p0 *uint32
2851
-	if len(processIds) > 0 {
2852
-		_p0 = &processIds[0]
2853
-	}
2854
-	r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned)))
2832
+func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) {
2833
+	r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0)
2855 2834
 	if r1 == 0 {
2856
-		if e1 != 0 {
2857
-			err = errnoErr(e1)
2858
-		} else {
2859
-			err = syscall.EINVAL
2860
-		}
2835
+		err = errnoErr(e1)
2861 2836
 	}
2862 2837
 	return
2863 2838
 }
2864 2839
 
2865
-func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
2866
-	r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
2867
-	if r0 != 0 {
2868
-		sockerr = syscall.Errno(r0)
2840
+func PulseEvent(event Handle) (err error) {
2841
+	r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0)
2842
+	if r1 == 0 {
2843
+		err = errnoErr(e1)
2869 2844
 	}
2870 2845
 	return
2871 2846
 }
2872 2847
 
2873
-func WSACleanup() (err error) {
2874
-	r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
2875
-	if r1 == socket_error {
2876
-		if e1 != 0 {
2877
-			err = errnoErr(e1)
2878
-		} else {
2879
-			err = syscall.EINVAL
2880
-		}
2848
+func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
2849
+	r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
2850
+	n = uint32(r0)
2851
+	if n == 0 {
2852
+		err = errnoErr(e1)
2881 2853
 	}
2882 2854
 	return
2883 2855
 }
2884 2856
 
2885
-func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
2886
-	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))
2887
-	if r1 == socket_error {
2888
-		if e1 != 0 {
2889
-			err = errnoErr(e1)
2890
-		} else {
2891
-			err = syscall.EINVAL
2892
-		}
2857
+func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) {
2858
+	r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0)
2859
+	if r1 == 0 {
2860
+		err = errnoErr(e1)
2893 2861
 	}
2894 2862
 	return
2895 2863
 }
2896 2864
 
2897
-func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
2898
-	r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol))
2899
-	handle = Handle(r0)
2900
-	if handle == InvalidHandle {
2901
-		if e1 != 0 {
2902
-			err = errnoErr(e1)
2903
-		} else {
2904
-			err = syscall.EINVAL
2905
-		}
2865
+func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) {
2866
+	r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0)
2867
+	if r1 == 0 {
2868
+		err = errnoErr(e1)
2906 2869
 	}
2907 2870
 	return
2908 2871
 }
2909 2872
 
2910
-func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) {
2911
-	var _p0 *byte
2912
-	if len(buf) > 0 {
2913
-		_p0 = &buf[0]
2873
+func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
2874
+	var _p0 uint32
2875
+	if watchSubTree {
2876
+		_p0 = 1
2914 2877
 	}
2915
-	r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen))
2916
-	if r1 == socket_error {
2917
-		if e1 != 0 {
2918
-			err = errnoErr(e1)
2919
-		} else {
2920
-			err = syscall.EINVAL
2921
-		}
2878
+	r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0)
2879
+	if r1 == 0 {
2880
+		err = errnoErr(e1)
2922 2881
 	}
2923 2882
 	return
2924 2883
 }
2925 2884
 
2926
-func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) {
2885
+func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
2927 2886
 	var _p0 *byte
2928 2887
 	if len(buf) > 0 {
2929 2888
 		_p0 = &buf[0]
2930 2889
 	}
2931
-	r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
2932
-	n = int32(r0)
2933
-	if n == -1 {
2934
-		if e1 != 0 {
2935
-			err = errnoErr(e1)
2936
-		} else {
2937
-			err = syscall.EINVAL
2938
-		}
2939
-	}
2940
-	return
2941
-}
2942
-
2943
-func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
2944
-	r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
2945
-	if r1 == socket_error {
2946
-		if e1 != 0 {
2947
-			err = errnoErr(e1)
2948
-		} else {
2949
-			err = syscall.EINVAL
2950
-		}
2890
+	r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
2891
+	if r1 == 0 {
2892
+		err = errnoErr(e1)
2951 2893
 	}
2952 2894
 	return
2953 2895
 }
2954 2896
 
2955
-func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
2956
-	r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
2957
-	if r1 == socket_error {
2958
-		if e1 != 0 {
2959
-			err = errnoErr(e1)
2960
-		} else {
2961
-			err = syscall.EINVAL
2962
-		}
2897
+func ReleaseMutex(mutex Handle) (err error) {
2898
+	r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0)
2899
+	if r1 == 0 {
2900
+		err = errnoErr(e1)
2963 2901
 	}
2964 2902
 	return
2965 2903
 }
2966 2904
 
2967
-func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
2968
-	r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
2969
-	if r1 == socket_error {
2970
-		if e1 != 0 {
2971
-			err = errnoErr(e1)
2972
-		} else {
2973
-			err = syscall.EINVAL
2974
-		}
2905
+func RemoveDirectory(path *uint16) (err error) {
2906
+	r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
2907
+	if r1 == 0 {
2908
+		err = errnoErr(e1)
2975 2909
 	}
2976 2910
 	return
2977 2911
 }
2978 2912
 
2979
-func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
2980
-	r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
2981
-	if r1 == socket_error {
2982
-		if e1 != 0 {
2983
-			err = errnoErr(e1)
2984
-		} else {
2985
-			err = syscall.EINVAL
2986
-		}
2913
+func ResetEvent(event Handle) (err error) {
2914
+	r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
2915
+	if r1 == 0 {
2916
+		err = errnoErr(e1)
2987 2917
 	}
2988 2918
 	return
2989 2919
 }
2990 2920
 
2991
-func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
2992
-	r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
2993
-	if r1 == socket_error {
2994
-		if e1 != 0 {
2995
-			err = errnoErr(e1)
2996
-		} else {
2997
-			err = syscall.EINVAL
2998
-		}
2921
+func ResumeThread(thread Handle) (ret uint32, err error) {
2922
+	r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0)
2923
+	ret = uint32(r0)
2924
+	if ret == 0xffffffff {
2925
+		err = errnoErr(e1)
2999 2926
 	}
3000 2927
 	return
3001 2928
 }
3002 2929
 
3003
-func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
3004
-	r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
3005
-	if r1 == socket_error {
3006
-		if e1 != 0 {
3007
-			err = errnoErr(e1)
3008
-		} else {
3009
-			err = syscall.EINVAL
3010
-		}
2930
+func SetConsoleCursorPosition(console Handle, position Coord) (err error) {
2931
+	r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(*((*uint32)(unsafe.Pointer(&position)))), 0)
2932
+	if r1 == 0 {
2933
+		err = errnoErr(e1)
3011 2934
 	}
3012 2935
 	return
3013 2936
 }
3014 2937
 
3015
-func listen(s Handle, backlog int32) (err error) {
3016
-	r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
3017
-	if r1 == socket_error {
3018
-		if e1 != 0 {
3019
-			err = errnoErr(e1)
3020
-		} else {
3021
-			err = syscall.EINVAL
3022
-		}
2938
+func SetConsoleMode(console Handle, mode uint32) (err error) {
2939
+	r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0)
2940
+	if r1 == 0 {
2941
+		err = errnoErr(e1)
3023 2942
 	}
3024 2943
 	return
3025 2944
 }
3026 2945
 
3027
-func shutdown(s Handle, how int32) (err error) {
3028
-	r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
3029
-	if r1 == socket_error {
3030
-		if e1 != 0 {
3031
-			err = errnoErr(e1)
3032
-		} else {
3033
-			err = syscall.EINVAL
3034
-		}
2946
+func SetCurrentDirectory(path *uint16) (err error) {
2947
+	r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
2948
+	if r1 == 0 {
2949
+		err = errnoErr(e1)
3035 2950
 	}
3036 2951
 	return
3037 2952
 }
3038 2953
 
3039
-func Closesocket(s Handle) (err error) {
3040
-	r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
3041
-	if r1 == socket_error {
3042
-		if e1 != 0 {
3043
-			err = errnoErr(e1)
3044
-		} else {
3045
-			err = syscall.EINVAL
3046
-		}
2954
+func SetEndOfFile(handle Handle) (err error) {
2955
+	r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
2956
+	if r1 == 0 {
2957
+		err = errnoErr(e1)
3047 2958
 	}
3048 2959
 	return
3049 2960
 }
3050 2961
 
3051
-func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
3052
-	r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0)
2962
+func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
2963
+	r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
3053 2964
 	if r1 == 0 {
3054
-		if e1 != 0 {
3055
-			err = errnoErr(e1)
3056
-		} else {
3057
-			err = syscall.EINVAL
3058
-		}
2965
+		err = errnoErr(e1)
3059 2966
 	}
3060 2967
 	return
3061 2968
 }
3062 2969
 
3063
-func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) {
3064
-	syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0)
2970
+func SetErrorMode(mode uint32) (ret uint32) {
2971
+	r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0)
2972
+	ret = uint32(r0)
3065 2973
 	return
3066 2974
 }
3067 2975
 
3068
-func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
3069
-	r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
3070
-	if r1 == socket_error {
3071
-		if e1 != 0 {
3072
-			err = errnoErr(e1)
3073
-		} else {
3074
-			err = syscall.EINVAL
3075
-		}
2976
+func SetEvent(event Handle) (err error) {
2977
+	r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0)
2978
+	if r1 == 0 {
2979
+		err = errnoErr(e1)
3076 2980
 	}
3077 2981
 	return
3078 2982
 }
3079 2983
 
3080
-func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
3081
-	r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
3082
-	if r1 == socket_error {
3083
-		if e1 != 0 {
3084
-			err = errnoErr(e1)
3085
-		} else {
3086
-			err = syscall.EINVAL
3087
-		}
2984
+func SetFileAttributes(name *uint16, attrs uint32) (err error) {
2985
+	r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
2986
+	if r1 == 0 {
2987
+		err = errnoErr(e1)
3088 2988
 	}
3089 2989
 	return
3090 2990
 }
3091 2991
 
3092
-func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
3093
-	r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
3094
-	if r1 == socket_error {
3095
-		if e1 != 0 {
3096
-			err = errnoErr(e1)
3097
-		} else {
3098
-			err = syscall.EINVAL
3099
-		}
2992
+func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) {
2993
+	r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0)
2994
+	if r1 == 0 {
2995
+		err = errnoErr(e1)
3100 2996
 	}
3101 2997
 	return
3102 2998
 }
3103 2999
 
3104
-func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
3105
-	r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
3106
-	if r1 == socket_error {
3107
-		if e1 != 0 {
3108
-			err = errnoErr(e1)
3109
-		} else {
3110
-			err = syscall.EINVAL
3111
-		}
3000
+func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
3001
+	r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
3002
+	newlowoffset = uint32(r0)
3003
+	if newlowoffset == 0xffffffff {
3004
+		err = errnoErr(e1)
3112 3005
 	}
3113 3006
 	return
3114 3007
 }
3115 3008
 
3116
-func GetHostByName(name string) (h *Hostent, err error) {
3117
-	var _p0 *byte
3118
-	_p0, err = syscall.BytePtrFromString(name)
3119
-	if err != nil {
3120
-		return
3121
-	}
3122
-	return _GetHostByName(_p0)
3123
-}
3124
-
3125
-func _GetHostByName(name *byte) (h *Hostent, err error) {
3126
-	r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
3127
-	h = (*Hostent)(unsafe.Pointer(r0))
3128
-	if h == nil {
3129
-		if e1 != 0 {
3130
-			err = errnoErr(e1)
3131
-		} else {
3132
-			err = syscall.EINVAL
3133
-		}
3009
+func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
3010
+	r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
3011
+	if r1 == 0 {
3012
+		err = errnoErr(e1)
3134 3013
 	}
3135 3014
 	return
3136 3015
 }
3137 3016
 
3138
-func GetServByName(name string, proto string) (s *Servent, err error) {
3139
-	var _p0 *byte
3140
-	_p0, err = syscall.BytePtrFromString(name)
3141
-	if err != nil {
3142
-		return
3143
-	}
3144
-	var _p1 *byte
3145
-	_p1, err = syscall.BytePtrFromString(proto)
3146
-	if err != nil {
3147
-		return
3017
+func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
3018
+	r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
3019
+	if r1 == 0 {
3020
+		err = errnoErr(e1)
3148 3021
 	}
3149
-	return _GetServByName(_p0, _p1)
3022
+	return
3150 3023
 }
3151 3024
 
3152
-func _GetServByName(name *byte, proto *byte) (s *Servent, err error) {
3153
-	r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0)
3154
-	s = (*Servent)(unsafe.Pointer(r0))
3155
-	if s == nil {
3156
-		if e1 != 0 {
3157
-			err = errnoErr(e1)
3158
-		} else {
3159
-			err = syscall.EINVAL
3160
-		}
3025
+func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
3026
+	r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
3027
+	ret = int(r0)
3028
+	if ret == 0 {
3029
+		err = errnoErr(e1)
3161 3030
 	}
3162 3031
 	return
3163 3032
 }
3164 3033
 
3165
-func Ntohs(netshort uint16) (u uint16) {
3166
-	r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0)
3167
-	u = uint16(r0)
3034
+func SetPriorityClass(process Handle, priorityClass uint32) (err error) {
3035
+	r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0)
3036
+	if r1 == 0 {
3037
+		err = errnoErr(e1)
3038
+	}
3168 3039
 	return
3169 3040
 }
3170 3041
 
3171
-func GetProtoByName(name string) (p *Protoent, err error) {
3172
-	var _p0 *byte
3173
-	_p0, err = syscall.BytePtrFromString(name)
3174
-	if err != nil {
3175
-		return
3042
+func SetProcessPriorityBoost(process Handle, disable bool) (err error) {
3043
+	var _p0 uint32
3044
+	if disable {
3045
+		_p0 = 1
3176 3046
 	}
3177
-	return _GetProtoByName(_p0)
3178
-}
3179
-
3180
-func _GetProtoByName(name *byte) (p *Protoent, err error) {
3181
-	r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
3182
-	p = (*Protoent)(unsafe.Pointer(r0))
3183
-	if p == nil {
3184
-		if e1 != 0 {
3185
-			err = errnoErr(e1)
3186
-		} else {
3187
-			err = syscall.EINVAL
3188
-		}
3047
+	r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0)
3048
+	if r1 == 0 {
3049
+		err = errnoErr(e1)
3189 3050
 	}
3190 3051
 	return
3191 3052
 }
3192 3053
 
3193
-func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
3194
-	var _p0 *uint16
3195
-	_p0, status = syscall.UTF16PtrFromString(name)
3196
-	if status != nil {
3197
-		return
3054
+func SetProcessShutdownParameters(level uint32, flags uint32) (err error) {
3055
+	r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0)
3056
+	if r1 == 0 {
3057
+		err = errnoErr(e1)
3198 3058
 	}
3199
-	return _DnsQuery(_p0, qtype, options, extra, qrs, pr)
3059
+	return
3200 3060
 }
3201 3061
 
3202
-func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
3203
-	r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
3204
-	if r0 != 0 {
3205
-		status = syscall.Errno(r0)
3062
+func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) {
3063
+	r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0)
3064
+	if r1 == 0 {
3065
+		err = errnoErr(e1)
3206 3066
 	}
3207 3067
 	return
3208 3068
 }
3209 3069
 
3210
-func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
3211
-	syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
3070
+func SetStdHandle(stdhandle uint32, handle Handle) (err error) {
3071
+	r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0)
3072
+	if r1 == 0 {
3073
+		err = errnoErr(e1)
3074
+	}
3212 3075
 	return
3213 3076
 }
3214 3077
 
3215
-func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) {
3216
-	r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0)
3217
-	same = r0 != 0
3078
+func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) {
3079
+	r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0)
3080
+	if r1 == 0 {
3081
+		err = errnoErr(e1)
3082
+	}
3218 3083
 	return
3219 3084
 }
3220 3085
 
3221
-func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) {
3222
-	r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0)
3223
-	if r0 != 0 {
3224
-		sockerr = syscall.Errno(r0)
3086
+func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) {
3087
+	r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0)
3088
+	if r1 == 0 {
3089
+		err = errnoErr(e1)
3225 3090
 	}
3226 3091
 	return
3227 3092
 }
3228 3093
 
3229
-func FreeAddrInfoW(addrinfo *AddrinfoW) {
3230
-	syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
3094
+func SleepEx(milliseconds uint32, alertable bool) (ret uint32) {
3095
+	var _p0 uint32
3096
+	if alertable {
3097
+		_p0 = 1
3098
+	}
3099
+	r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0)
3100
+	ret = uint32(r0)
3231 3101
 	return
3232 3102
 }
3233 3103
 
3234
-func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
3235
-	r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
3236
-	if r0 != 0 {
3237
-		errcode = syscall.Errno(r0)
3104
+func TerminateJobObject(job Handle, exitCode uint32) (err error) {
3105
+	r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0)
3106
+	if r1 == 0 {
3107
+		err = errnoErr(e1)
3238 3108
 	}
3239 3109
 	return
3240 3110
 }
3241 3111
 
3242
-func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) {
3243
-	r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
3244
-	if r0 != 0 {
3245
-		errcode = syscall.Errno(r0)
3112
+func TerminateProcess(handle Handle, exitcode uint32) (err error) {
3113
+	r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
3114
+	if r1 == 0 {
3115
+		err = errnoErr(e1)
3246 3116
 	}
3247 3117
 	return
3248 3118
 }
3249 3119
 
3250
-func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) {
3251
-	r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0)
3120
+func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
3121
+	r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
3252 3122
 	if r1 == 0 {
3253
-		if e1 != 0 {
3254
-			err = errnoErr(e1)
3255
-		} else {
3256
-			err = syscall.EINVAL
3257
-		}
3123
+		err = errnoErr(e1)
3258 3124
 	}
3259 3125
 	return
3260 3126
 }
3261 3127
 
3262
-func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) {
3263
-	r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength)))
3264
-	n = int32(r0)
3265
-	if n == -1 {
3266
-		if e1 != 0 {
3267
-			err = errnoErr(e1)
3268
-		} else {
3269
-			err = syscall.EINVAL
3270
-		}
3128
+func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
3129
+	r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
3130
+	if r1 == 0 {
3131
+		err = errnoErr(e1)
3271 3132
 	}
3272 3133
 	return
3273 3134
 }
3274 3135
 
3275
-func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
3276
-	r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
3277
-	if r0 != 0 {
3278
-		errcode = syscall.Errno(r0)
3136
+func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
3137
+	r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0)
3138
+	if r1 == 0 {
3139
+		err = errnoErr(e1)
3279 3140
 	}
3280 3141
 	return
3281 3142
 }
3282 3143
 
3283
-func GetACP() (acp uint32) {
3284
-	r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
3285
-	acp = uint32(r0)
3144
+func UnmapViewOfFile(addr uintptr) (err error) {
3145
+	r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
3146
+	if r1 == 0 {
3147
+		err = errnoErr(e1)
3148
+	}
3286 3149
 	return
3287 3150
 }
3288 3151
 
3289
-func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
3290
-	r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
3291
-	nwrite = int32(r0)
3292
-	if nwrite == 0 {
3293
-		if e1 != 0 {
3294
-			err = errnoErr(e1)
3295
-		} else {
3296
-			err = syscall.EINVAL
3297
-		}
3152
+func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) {
3153
+	r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0)
3154
+	value = uintptr(r0)
3155
+	if value == 0 {
3156
+		err = errnoErr(e1)
3298 3157
 	}
3299 3158
 	return
3300 3159
 }
3301 3160
 
3302
-func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
3303
-	r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
3304
-	if r1&0xff == 0 {
3305
-		if e1 != 0 {
3306
-			err = errnoErr(e1)
3307
-		} else {
3308
-			err = syscall.EINVAL
3309
-		}
3161
+func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) {
3162
+	r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype))
3163
+	if r1 == 0 {
3164
+		err = errnoErr(e1)
3310 3165
 	}
3311 3166
 	return
3312 3167
 }
3313 3168
 
3314
-func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
3315
-	r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
3316
-	if r1&0xff == 0 {
3317
-		if e1 != 0 {
3318
-			err = errnoErr(e1)
3319
-		} else {
3320
-			err = syscall.EINVAL
3321
-		}
3169
+func VirtualLock(addr uintptr, length uintptr) (err error) {
3170
+	r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
3171
+	if r1 == 0 {
3172
+		err = errnoErr(e1)
3322 3173
 	}
3323 3174
 	return
3324 3175
 }
3325 3176
 
3326
-func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
3327
-	r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
3328
-	if r0 != 0 {
3329
-		neterr = syscall.Errno(r0)
3177
+func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) {
3178
+	r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0)
3179
+	if r1 == 0 {
3180
+		err = errnoErr(e1)
3330 3181
 	}
3331 3182
 	return
3332 3183
 }
3333 3184
 
3334
-func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) {
3335
-	r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType)))
3336
-	if r0 != 0 {
3337
-		neterr = syscall.Errno(r0)
3185
+func VirtualUnlock(addr uintptr, length uintptr) (err error) {
3186
+	r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
3187
+	if r1 == 0 {
3188
+		err = errnoErr(e1)
3338 3189
 	}
3339 3190
 	return
3340 3191
 }
3341 3192
 
3342
-func NetApiBufferFree(buf *byte) (neterr error) {
3343
-	r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0)
3344
-	if r0 != 0 {
3345
-		neterr = syscall.Errno(r0)
3193
+func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
3194
+	var _p0 uint32
3195
+	if waitAll {
3196
+		_p0 = 1
3197
+	}
3198
+	r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0)
3199
+	event = uint32(r0)
3200
+	if event == 0xffffffff {
3201
+		err = errnoErr(e1)
3346 3202
 	}
3347 3203
 	return
3348 3204
 }
3349 3205
 
3350
-func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
3351
-	r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
3352
-	if r1 == 0 {
3353
-		if e1 != 0 {
3354
-			err = errnoErr(e1)
3355
-		} else {
3356
-			err = syscall.EINVAL
3357
-		}
3206
+func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) {
3207
+	r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0)
3208
+	event = uint32(r0)
3209
+	if event == 0xffffffff {
3210
+		err = errnoErr(e1)
3358 3211
 	}
3359 3212
 	return
3360 3213
 }
3361 3214
 
3362
-func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
3363
-	r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
3215
+func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
3216
+	r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
3364 3217
 	if r1 == 0 {
3365
-		if e1 != 0 {
3366
-			err = errnoErr(e1)
3367
-		} else {
3368
-			err = syscall.EINVAL
3369
-		}
3218
+		err = errnoErr(e1)
3370 3219
 	}
3371 3220
 	return
3372 3221
 }
3373 3222
 
3374
-func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
3375
-	r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
3223
+func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
3224
+	var _p0 *byte
3225
+	if len(buf) > 0 {
3226
+		_p0 = &buf[0]
3227
+	}
3228
+	r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
3376 3229
 	if r1 == 0 {
3377
-		if e1 != 0 {
3378
-			err = errnoErr(e1)
3379
-		} else {
3380
-			err = syscall.EINVAL
3381
-		}
3230
+		err = errnoErr(e1)
3382 3231
 	}
3383 3232
 	return
3384 3233
 }
3385 3234
 
3386
-func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
3387
-	r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
3235
+func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
3236
+	r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0)
3388 3237
 	if r1 == 0 {
3389
-		if e1 != 0 {
3390
-			err = errnoErr(e1)
3391
-		} else {
3392
-			err = syscall.EINVAL
3393
-		}
3238
+		err = errnoErr(e1)
3394 3239
 	}
3395 3240
 	return
3396 3241
 }
3397 3242
 
3398
-func GetLengthSid(sid *SID) (len uint32) {
3399
-	r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
3400
-	len = uint32(r0)
3243
+func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) {
3244
+	syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0)
3401 3245
 	return
3402 3246
 }
3403 3247
 
3404
-func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
3405
-	r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
3248
+func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
3249
+	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)
3406 3250
 	if r1 == 0 {
3407
-		if e1 != 0 {
3408
-			err = errnoErr(e1)
3409
-		} else {
3410
-			err = syscall.EINVAL
3411
-		}
3251
+		err = errnoErr(e1)
3412 3252
 	}
3413 3253
 	return
3414 3254
 }
3415 3255
 
3416
-func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) {
3417
-	r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0)
3418
-	if r1 == 0 {
3419
-		if e1 != 0 {
3420
-			err = errnoErr(e1)
3421
-		} else {
3422
-			err = syscall.EINVAL
3423
-		}
3256
+func NetApiBufferFree(buf *byte) (neterr error) {
3257
+	r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0)
3258
+	if r0 != 0 {
3259
+		neterr = syscall.Errno(r0)
3424 3260
 	}
3425 3261
 	return
3426 3262
 }
3427 3263
 
3428
-func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) {
3429
-	r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0)
3430
-	if r1 == 0 {
3431
-		if e1 != 0 {
3432
-			err = errnoErr(e1)
3433
-		} else {
3434
-			err = syscall.EINVAL
3435
-		}
3264
+func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) {
3265
+	r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType)))
3266
+	if r0 != 0 {
3267
+		neterr = syscall.Errno(r0)
3436 3268
 	}
3437 3269
 	return
3438 3270
 }
3439 3271
 
3440
-func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) {
3441
-	r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0)
3442
-	isWellKnown = r0 != 0
3272
+func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
3273
+	r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
3274
+	if r0 != 0 {
3275
+		neterr = syscall.Errno(r0)
3276
+	}
3443 3277
 	return
3444 3278
 }
3445 3279
 
3446
-func FreeSid(sid *SID) (err error) {
3447
-	r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
3448
-	if r1 != 0 {
3449
-		if e1 != 0 {
3450
-			err = errnoErr(e1)
3451
-		} else {
3452
-			err = syscall.EINVAL
3453
-		}
3454
-	}
3280
+func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) {
3281
+	syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber)))
3455 3282
 	return
3456 3283
 }
3457 3284
 
3458
-func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) {
3459
-	r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0)
3460
-	isEqual = r0 != 0
3285
+func rtlGetVersion(info *OsVersionInfoEx) (ret error) {
3286
+	r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0)
3287
+	if r0 != 0 {
3288
+		ret = syscall.Errno(r0)
3289
+	}
3461 3290
 	return
3462 3291
 }
3463 3292
 
3464
-func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) {
3465
-	r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
3466
-	authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0))
3293
+func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) {
3294
+	r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
3295
+	if r0 != 0 {
3296
+		ret = syscall.Errno(r0)
3297
+	}
3467 3298
 	return
3468 3299
 }
3469 3300
 
3470
-func getSidSubAuthorityCount(sid *SID) (count *uint8) {
3471
-	r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
3472
-	count = (*uint8)(unsafe.Pointer(r0))
3301
+func coCreateGuid(pguid *GUID) (ret error) {
3302
+	r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0)
3303
+	if r0 != 0 {
3304
+		ret = syscall.Errno(r0)
3305
+	}
3473 3306
 	return
3474 3307
 }
3475 3308
 
3476
-func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) {
3477
-	r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0)
3478
-	subAuthority = (*uint32)(unsafe.Pointer(r0))
3309
+func CoTaskMemFree(address unsafe.Pointer) {
3310
+	syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0)
3479 3311
 	return
3480 3312
 }
3481 3313
 
3482
-func isValidSid(sid *SID) (isValid bool) {
3483
-	r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
3484
-	isValid = r0 != 0
3314
+func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) {
3315
+	r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax))
3316
+	chars = int32(r0)
3485 3317
 	return
3486 3318
 }
3487 3319
 
3488
-func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) {
3489
-	r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember)))
3320
+func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) {
3321
+	var _p0 *uint32
3322
+	if len(processIds) > 0 {
3323
+		_p0 = &processIds[0]
3324
+	}
3325
+	r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned)))
3490 3326
 	if r1 == 0 {
3491
-		if e1 != 0 {
3492
-			err = errnoErr(e1)
3493
-		} else {
3494
-			err = syscall.EINVAL
3495
-		}
3327
+		err = errnoErr(e1)
3496 3328
 	}
3497 3329
 	return
3498 3330
 }
3499 3331
 
3500
-func OpenProcessToken(process Handle, access uint32, token *Token) (err error) {
3501
-	r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token)))
3502
-	if r1 == 0 {
3503
-		if e1 != 0 {
3504
-			err = errnoErr(e1)
3505
-		} else {
3506
-			err = syscall.EINVAL
3507
-		}
3332
+func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
3333
+	r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
3334
+	if r1&0xff == 0 {
3335
+		err = errnoErr(e1)
3508 3336
 	}
3509 3337
 	return
3510 3338
 }
3511 3339
 
3512
-func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) {
3513
-	var _p0 uint32
3514
-	if openAsSelf {
3515
-		_p0 = 1
3516
-	} else {
3517
-		_p0 = 0
3518
-	}
3519
-	r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
3520
-	if r1 == 0 {
3521
-		if e1 != 0 {
3522
-			err = errnoErr(e1)
3523
-		} else {
3524
-			err = syscall.EINVAL
3525
-		}
3340
+func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
3341
+	r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
3342
+	if r1&0xff == 0 {
3343
+		err = errnoErr(e1)
3526 3344
 	}
3527 3345
 	return
3528 3346
 }
3529 3347
 
3530
-func ImpersonateSelf(impersonationlevel uint32) (err error) {
3531
-	r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
3532
-	if r1 == 0 {
3533
-		if e1 != 0 {
3534
-			err = errnoErr(e1)
3535
-		} else {
3536
-			err = syscall.EINVAL
3537
-		}
3348
+func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
3349
+	r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0)
3350
+	argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0))
3351
+	if argv == nil {
3352
+		err = errnoErr(e1)
3538 3353
 	}
3539 3354
 	return
3540 3355
 }
3541 3356
 
3542
-func RevertToSelf() (err error) {
3543
-	r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
3544
-	if r1 == 0 {
3545
-		if e1 != 0 {
3546
-			err = errnoErr(e1)
3547
-		} else {
3548
-			err = syscall.EINVAL
3549
-		}
3357
+func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) {
3358
+	r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0)
3359
+	if r0 != 0 {
3360
+		ret = syscall.Errno(r0)
3550 3361
 	}
3551 3362
 	return
3552 3363
 }
3553 3364
 
3554
-func SetThreadToken(thread *Handle, token Token) (err error) {
3555
-	r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0)
3556
-	if r1 == 0 {
3557
-		if e1 != 0 {
3558
-			err = errnoErr(e1)
3559
-		} else {
3560
-			err = syscall.EINVAL
3561
-		}
3365
+func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) {
3366
+	r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd))
3367
+	if r1 <= 32 {
3368
+		err = errnoErr(e1)
3562 3369
 	}
3563 3370
 	return
3564 3371
 }
3565 3372
 
3566
-func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
3567
-	r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
3373
+func ExitWindowsEx(flags uint32, reason uint32) (err error) {
3374
+	r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
3568 3375
 	if r1 == 0 {
3569
-		if e1 != 0 {
3570
-			err = errnoErr(e1)
3571
-		} else {
3572
-			err = syscall.EINVAL
3573
-		}
3376
+		err = errnoErr(e1)
3574 3377
 	}
3575 3378
 	return
3576 3379
 }
3577 3380
 
3578
-func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) {
3579
-	var _p0 uint32
3580
-	if disableAllPrivileges {
3581
-		_p0 = 1
3582
-	} else {
3583
-		_p0 = 0
3584
-	}
3585
-	r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
3586
-	if r1 == 0 {
3587
-		if e1 != 0 {
3588
-			err = errnoErr(e1)
3589
-		} else {
3590
-			err = syscall.EINVAL
3591
-		}
3381
+func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
3382
+	r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
3383
+	ret = int32(r0)
3384
+	if ret == 0 {
3385
+		err = errnoErr(e1)
3592 3386
 	}
3593 3387
 	return
3594 3388
 }
3595 3389
 
3596
-func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) {
3390
+func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) {
3597 3391
 	var _p0 uint32
3598
-	if resetToDefault {
3392
+	if inheritExisting {
3599 3393
 		_p0 = 1
3600
-	} else {
3601
-		_p0 = 0
3602
-	}
3603
-	r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
3604
-	if r1 == 0 {
3605
-		if e1 != 0 {
3606
-			err = errnoErr(e1)
3607
-		} else {
3608
-			err = syscall.EINVAL
3609
-		}
3610
-	}
3611
-	return
3612
-}
3613
-
3614
-func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
3615
-	r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
3616
-	if r1 == 0 {
3617
-		if e1 != 0 {
3618
-			err = errnoErr(e1)
3619
-		} else {
3620
-			err = syscall.EINVAL
3621
-		}
3622 3394
 	}
3623
-	return
3624
-}
3625
-
3626
-func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) {
3627
-	r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0)
3395
+	r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
3628 3396
 	if r1 == 0 {
3629
-		if e1 != 0 {
3630
-			err = errnoErr(e1)
3631
-		} else {
3632
-			err = syscall.EINVAL
3633
-		}
3397
+		err = errnoErr(e1)
3634 3398
 	}
3635 3399
 	return
3636 3400
 }
3637 3401
 
3638
-func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) {
3639
-	r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken)))
3402
+func DestroyEnvironmentBlock(block *uint16) (err error) {
3403
+	r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
3640 3404
 	if r1 == 0 {
3641
-		if e1 != 0 {
3642
-			err = errnoErr(e1)
3643
-		} else {
3644
-			err = syscall.EINVAL
3645
-		}
3405
+		err = errnoErr(e1)
3646 3406
 	}
3647 3407
 	return
3648 3408
 }
... ...
@@ -3650,434 +2779,277 @@ func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes
3650 3650
 func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
3651 3651
 	r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
3652 3652
 	if r1 == 0 {
3653
-		if e1 != 0 {
3654
-			err = errnoErr(e1)
3655
-		} else {
3656
-			err = syscall.EINVAL
3657
-		}
3653
+		err = errnoErr(e1)
3658 3654
 	}
3659 3655
 	return
3660 3656
 }
3661 3657
 
3662
-func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
3663
-	r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
3664
-	len = uint32(r0)
3665
-	if len == 0 {
3666
-		if e1 != 0 {
3667
-			err = errnoErr(e1)
3668
-		} else {
3669
-			err = syscall.EINVAL
3670
-		}
3671
-	}
3658
+func FreeAddrInfoW(addrinfo *AddrinfoW) {
3659
+	syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
3672 3660
 	return
3673 3661
 }
3674 3662
 
3675
-func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
3676
-	r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
3677
-	len = uint32(r0)
3678
-	if len == 0 {
3679
-		if e1 != 0 {
3680
-			err = errnoErr(e1)
3681
-		} else {
3682
-			err = syscall.EINVAL
3683
-		}
3663
+func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) {
3664
+	r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0)
3665
+	if r0 != 0 {
3666
+		sockerr = syscall.Errno(r0)
3684 3667
 	}
3685 3668
 	return
3686 3669
 }
3687 3670
 
3688
-func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
3689
-	r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
3690
-	len = uint32(r0)
3691
-	if len == 0 {
3692
-		if e1 != 0 {
3693
-			err = errnoErr(e1)
3694
-		} else {
3695
-			err = syscall.EINVAL
3696
-		}
3671
+func WSACleanup() (err error) {
3672
+	r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
3673
+	if r1 == socket_error {
3674
+		err = errnoErr(e1)
3697 3675
 	}
3698 3676
 	return
3699 3677
 }
3700 3678
 
3701
-func WTSQueryUserToken(session uint32, token *Token) (err error) {
3702
-	r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0)
3703
-	if r1 == 0 {
3704
-		if e1 != 0 {
3705
-			err = errnoErr(e1)
3706
-		} else {
3707
-			err = syscall.EINVAL
3708
-		}
3679
+func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) {
3680
+	r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength)))
3681
+	n = int32(r0)
3682
+	if n == -1 {
3683
+		err = errnoErr(e1)
3709 3684
 	}
3710 3685
 	return
3711 3686
 }
3712 3687
 
3713
-func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) {
3714
-	r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0)
3715
-	if r1 == 0 {
3716
-		if e1 != 0 {
3717
-			err = errnoErr(e1)
3718
-		} else {
3719
-			err = syscall.EINVAL
3720
-		}
3688
+func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
3689
+	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))
3690
+	if r1 == socket_error {
3691
+		err = errnoErr(e1)
3721 3692
 	}
3722 3693
 	return
3723 3694
 }
3724 3695
 
3725
-func WTSFreeMemory(ptr uintptr) {
3726
-	syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0)
3696
+func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
3697
+	r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
3698
+	if r1 == socket_error {
3699
+		err = errnoErr(e1)
3700
+	}
3727 3701
 	return
3728 3702
 }
3729 3703
 
3730
-func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
3731
-	r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
3732
-	if r0 != 0 {
3733
-		ret = syscall.Errno(r0)
3704
+func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
3705
+	r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
3706
+	if r1 == socket_error {
3707
+		err = errnoErr(e1)
3734 3708
 	}
3735 3709
 	return
3736 3710
 }
3737 3711
 
3738
-func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) {
3739
-	syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
3712
+func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
3713
+	r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
3714
+	if r1 == socket_error {
3715
+		err = errnoErr(e1)
3716
+	}
3740 3717
 	return
3741 3718
 }
3742 3719
 
3743
-func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
3744
-	var _p0 *uint16
3745
-	_p0, ret = syscall.UTF16PtrFromString(objectName)
3746
-	if ret != nil {
3747
-		return
3720
+func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
3721
+	r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
3722
+	if r1 == socket_error {
3723
+		err = errnoErr(e1)
3748 3724
 	}
3749
-	return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd)
3725
+	return
3750 3726
 }
3751 3727
 
3752
-func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
3753
-	r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
3728
+func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
3729
+	r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
3754 3730
 	if r0 != 0 {
3755
-		ret = syscall.Errno(r0)
3731
+		sockerr = syscall.Errno(r0)
3756 3732
 	}
3757 3733
 	return
3758 3734
 }
3759 3735
 
3760
-func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
3761
-	var _p0 *uint16
3762
-	_p0, ret = syscall.UTF16PtrFromString(objectName)
3763
-	if ret != nil {
3764
-		return
3736
+func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
3737
+	r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
3738
+	if r1 == socket_error {
3739
+		err = errnoErr(e1)
3765 3740
 	}
3766
-	return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl)
3741
+	return
3767 3742
 }
3768 3743
 
3769
-func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
3770
-	r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
3771
-	if r0 != 0 {
3772
-		ret = syscall.Errno(r0)
3744
+func Closesocket(s Handle) (err error) {
3745
+	r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
3746
+	if r1 == socket_error {
3747
+		err = errnoErr(e1)
3773 3748
 	}
3774 3749
 	return
3775 3750
 }
3776 3751
 
3777
-func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) {
3778
-	r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor)))
3779
-	if r0 != 0 {
3780
-		ret = syscall.Errno(r0)
3752
+func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
3753
+	r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
3754
+	if r1 == socket_error {
3755
+		err = errnoErr(e1)
3781 3756
 	}
3782 3757
 	return
3783 3758
 }
3784 3759
 
3785
-func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) {
3786
-	r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0)
3787
-	if r1 == 0 {
3788
-		if e1 != 0 {
3789
-			err = errnoErr(e1)
3790
-		} else {
3791
-			err = syscall.EINVAL
3792
-		}
3760
+func GetHostByName(name string) (h *Hostent, err error) {
3761
+	var _p0 *byte
3762
+	_p0, err = syscall.BytePtrFromString(name)
3763
+	if err != nil {
3764
+		return
3793 3765
 	}
3794
-	return
3766
+	return _GetHostByName(_p0)
3795 3767
 }
3796 3768
 
3797
-func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) {
3798
-	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision)))
3799
-	if r1 == 0 {
3800
-		if e1 != 0 {
3801
-			err = errnoErr(e1)
3802
-		} else {
3803
-			err = syscall.EINVAL
3804
-		}
3769
+func _GetHostByName(name *byte) (h *Hostent, err error) {
3770
+	r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
3771
+	h = (*Hostent)(unsafe.Pointer(r0))
3772
+	if h == nil {
3773
+		err = errnoErr(e1)
3805 3774
 	}
3806 3775
 	return
3807 3776
 }
3808 3777
 
3809
-func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) {
3810
-	var _p0 uint32
3811
-	if *daclPresent {
3812
-		_p0 = 1
3813
-	} else {
3814
-		_p0 = 0
3815
-	}
3816
-	var _p1 uint32
3817
-	if *daclDefaulted {
3818
-		_p1 = 1
3819
-	} else {
3820
-		_p1 = 0
3821
-	}
3822
-	r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
3823
-	*daclPresent = _p0 != 0
3824
-	*daclDefaulted = _p1 != 0
3825
-	if r1 == 0 {
3826
-		if e1 != 0 {
3827
-			err = errnoErr(e1)
3828
-		} else {
3829
-			err = syscall.EINVAL
3830
-		}
3778
+func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
3779
+	r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
3780
+	if r1 == socket_error {
3781
+		err = errnoErr(e1)
3831 3782
 	}
3832 3783
 	return
3833 3784
 }
3834 3785
 
3835
-func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) {
3836
-	var _p0 uint32
3837
-	if *saclPresent {
3838
-		_p0 = 1
3839
-	} else {
3840
-		_p0 = 0
3841
-	}
3842
-	var _p1 uint32
3843
-	if *saclDefaulted {
3844
-		_p1 = 1
3845
-	} else {
3846
-		_p1 = 0
3847
-	}
3848
-	r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
3849
-	*saclPresent = _p0 != 0
3850
-	*saclDefaulted = _p1 != 0
3851
-	if r1 == 0 {
3852
-		if e1 != 0 {
3853
-			err = errnoErr(e1)
3854
-		} else {
3855
-			err = syscall.EINVAL
3856
-		}
3786
+func GetProtoByName(name string) (p *Protoent, err error) {
3787
+	var _p0 *byte
3788
+	_p0, err = syscall.BytePtrFromString(name)
3789
+	if err != nil {
3790
+		return
3857 3791
 	}
3858
-	return
3792
+	return _GetProtoByName(_p0)
3859 3793
 }
3860 3794
 
3861
-func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) {
3862
-	var _p0 uint32
3863
-	if *ownerDefaulted {
3864
-		_p0 = 1
3865
-	} else {
3866
-		_p0 = 0
3867
-	}
3868
-	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0)))
3869
-	*ownerDefaulted = _p0 != 0
3870
-	if r1 == 0 {
3871
-		if e1 != 0 {
3872
-			err = errnoErr(e1)
3873
-		} else {
3874
-			err = syscall.EINVAL
3875
-		}
3795
+func _GetProtoByName(name *byte) (p *Protoent, err error) {
3796
+	r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
3797
+	p = (*Protoent)(unsafe.Pointer(r0))
3798
+	if p == nil {
3799
+		err = errnoErr(e1)
3876 3800
 	}
3877 3801
 	return
3878 3802
 }
3879 3803
 
3880
-func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) {
3881
-	var _p0 uint32
3882
-	if *groupDefaulted {
3883
-		_p0 = 1
3884
-	} else {
3885
-		_p0 = 0
3804
+func GetServByName(name string, proto string) (s *Servent, err error) {
3805
+	var _p0 *byte
3806
+	_p0, err = syscall.BytePtrFromString(name)
3807
+	if err != nil {
3808
+		return
3886 3809
 	}
3887
-	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0)))
3888
-	*groupDefaulted = _p0 != 0
3889
-	if r1 == 0 {
3890
-		if e1 != 0 {
3891
-			err = errnoErr(e1)
3892
-		} else {
3893
-			err = syscall.EINVAL
3894
-		}
3810
+	var _p1 *byte
3811
+	_p1, err = syscall.BytePtrFromString(proto)
3812
+	if err != nil {
3813
+		return
3895 3814
 	}
3896
-	return
3897
-}
3898
-
3899
-func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) {
3900
-	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
3901
-	len = uint32(r0)
3902
-	return
3815
+	return _GetServByName(_p0, _p1)
3903 3816
 }
3904 3817
 
3905
-func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) {
3906
-	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
3907
-	if r0 != 0 {
3908
-		ret = syscall.Errno(r0)
3818
+func _GetServByName(name *byte, proto *byte) (s *Servent, err error) {
3819
+	r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0)
3820
+	s = (*Servent)(unsafe.Pointer(r0))
3821
+	if s == nil {
3822
+		err = errnoErr(e1)
3909 3823
 	}
3910 3824
 	return
3911 3825
 }
3912 3826
 
3913
-func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) {
3914
-	r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
3915
-	isValid = r0 != 0
3827
+func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
3828
+	r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
3829
+	if r1 == socket_error {
3830
+		err = errnoErr(e1)
3831
+	}
3916 3832
 	return
3917 3833
 }
3918 3834
 
3919
-func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) {
3920
-	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet))
3921
-	if r1 == 0 {
3922
-		if e1 != 0 {
3923
-			err = errnoErr(e1)
3924
-		} else {
3925
-			err = syscall.EINVAL
3926
-		}
3835
+func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
3836
+	r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
3837
+	if r1 == socket_error {
3838
+		err = errnoErr(e1)
3927 3839
 	}
3928 3840
 	return
3929 3841
 }
3930 3842
 
3931
-func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) {
3932
-	var _p0 uint32
3933
-	if daclPresent {
3934
-		_p0 = 1
3935
-	} else {
3936
-		_p0 = 0
3937
-	}
3938
-	var _p1 uint32
3939
-	if daclDefaulted {
3940
-		_p1 = 1
3941
-	} else {
3942
-		_p1 = 0
3943
-	}
3944
-	r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0)
3945
-	if r1 == 0 {
3946
-		if e1 != 0 {
3947
-			err = errnoErr(e1)
3948
-		} else {
3949
-			err = syscall.EINVAL
3950
-		}
3843
+func listen(s Handle, backlog int32) (err error) {
3844
+	r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
3845
+	if r1 == socket_error {
3846
+		err = errnoErr(e1)
3951 3847
 	}
3952 3848
 	return
3953 3849
 }
3954 3850
 
3955
-func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) {
3956
-	var _p0 uint32
3957
-	if saclPresent {
3958
-		_p0 = 1
3959
-	} else {
3960
-		_p0 = 0
3961
-	}
3962
-	var _p1 uint32
3963
-	if saclDefaulted {
3964
-		_p1 = 1
3965
-	} else {
3966
-		_p1 = 0
3967
-	}
3968
-	r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0)
3969
-	if r1 == 0 {
3970
-		if e1 != 0 {
3971
-			err = errnoErr(e1)
3972
-		} else {
3973
-			err = syscall.EINVAL
3974
-		}
3975
-	}
3851
+func Ntohs(netshort uint16) (u uint16) {
3852
+	r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0)
3853
+	u = uint16(r0)
3976 3854
 	return
3977 3855
 }
3978 3856
 
3979
-func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) {
3980
-	var _p0 uint32
3981
-	if ownerDefaulted {
3982
-		_p0 = 1
3983
-	} else {
3984
-		_p0 = 0
3857
+func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) {
3858
+	var _p0 *byte
3859
+	if len(buf) > 0 {
3860
+		_p0 = &buf[0]
3985 3861
 	}
3986
-	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0))
3987
-	if r1 == 0 {
3988
-		if e1 != 0 {
3989
-			err = errnoErr(e1)
3990
-		} else {
3991
-			err = syscall.EINVAL
3992
-		}
3862
+	r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
3863
+	n = int32(r0)
3864
+	if n == -1 {
3865
+		err = errnoErr(e1)
3993 3866
 	}
3994 3867
 	return
3995 3868
 }
3996 3869
 
3997
-func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) {
3998
-	var _p0 uint32
3999
-	if groupDefaulted {
4000
-		_p0 = 1
4001
-	} else {
4002
-		_p0 = 0
3870
+func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) {
3871
+	var _p0 *byte
3872
+	if len(buf) > 0 {
3873
+		_p0 = &buf[0]
4003 3874
 	}
4004
-	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0))
4005
-	if r1 == 0 {
4006
-		if e1 != 0 {
4007
-			err = errnoErr(e1)
4008
-		} else {
4009
-			err = syscall.EINVAL
4010
-		}
3875
+	r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen))
3876
+	if r1 == socket_error {
3877
+		err = errnoErr(e1)
4011 3878
 	}
4012 3879
 	return
4013 3880
 }
4014 3881
 
4015
-func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) {
4016
-	syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
4017
-	return
4018
-}
4019
-
4020
-func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
4021
-	var _p0 *uint16
4022
-	_p0, err = syscall.UTF16PtrFromString(str)
4023
-	if err != nil {
4024
-		return
3882
+func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
3883
+	r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
3884
+	if r1 == socket_error {
3885
+		err = errnoErr(e1)
4025 3886
 	}
4026
-	return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
3887
+	return
4027 3888
 }
4028 3889
 
4029
-func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
4030
-	r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
4031
-	if r1 == 0 {
4032
-		if e1 != 0 {
4033
-			err = errnoErr(e1)
4034
-		} else {
4035
-			err = syscall.EINVAL
4036
-		}
3890
+func shutdown(s Handle, how int32) (err error) {
3891
+	r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
3892
+	if r1 == socket_error {
3893
+		err = errnoErr(e1)
4037 3894
 	}
4038 3895
 	return
4039 3896
 }
4040 3897
 
4041
-func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) {
4042
-	r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0)
4043
-	if r1 == 0 {
4044
-		if e1 != 0 {
4045
-			err = errnoErr(e1)
4046
-		} else {
4047
-			err = syscall.EINVAL
4048
-		}
3898
+func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
3899
+	r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol))
3900
+	handle = Handle(r0)
3901
+	if handle == InvalidHandle {
3902
+		err = errnoErr(e1)
4049 3903
 	}
4050 3904
 	return
4051 3905
 }
4052 3906
 
4053
-func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) {
4054
-	r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0)
3907
+func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) {
3908
+	r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0)
4055 3909
 	if r1 == 0 {
4056
-		if e1 != 0 {
4057
-			err = errnoErr(e1)
4058
-		} else {
4059
-			err = syscall.EINVAL
4060
-		}
3910
+		err = errnoErr(e1)
4061 3911
 	}
4062 3912
 	return
4063 3913
 }
4064 3914
 
4065
-func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) {
4066
-	r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize)))
4067
-	if r1 == 0 {
4068
-		if e1 != 0 {
4069
-			err = errnoErr(e1)
4070
-		} else {
4071
-			err = syscall.EINVAL
4072
-		}
4073
-	}
3915
+func WTSFreeMemory(ptr uintptr) {
3916
+	syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0)
4074 3917
 	return
4075 3918
 }
4076 3919
 
4077
-func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) {
4078
-	r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0)
4079
-	if r0 != 0 {
4080
-		ret = syscall.Errno(r0)
3920
+func WTSQueryUserToken(session uint32, token *Token) (err error) {
3921
+	r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0)
3922
+	if r1 == 0 {
3923
+		err = errnoErr(e1)
4081 3924
 	}
4082 3925
 	return
4083 3926
 }