Commit 70c4b52a authored by Alex Brainman's avatar Alex Brainman

go.sys/windows: delete errors_windows.go (except APPLICATION_ERROR) and Errno

All consts in errors_windows.go (except APPLICATION_ERROR) were
"invented" at the start of windows port to have minimal impact on
existing Go packages. No point keeping them around.
Also remove Errno, since we will be using syscall.Errno everywhere anyway.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/128290044
parent 96cf2ceb
...@@ -21,8 +21,8 @@ type DLLError struct { ...@@ -21,8 +21,8 @@ type DLLError struct {
func (e *DLLError) Error() string { return e.Msg } func (e *DLLError) Error() string { return e.Msg }
// Implemented in runtime/syscall_windows.goc; we provide jumps to them in our assembly file. // Implemented in runtime/syscall_windows.goc; we provide jumps to them in our assembly file.
func loadlibrary(filename *uint16) (handle uintptr, err Errno) func loadlibrary(filename *uint16) (handle uintptr, err syscall.Errno)
func getprocaddress(handle uintptr, procname *uint8) (proc uintptr, err Errno) func getprocaddress(handle uintptr, procname *uint8) (proc uintptr, err syscall.Errno)
// A DLL implements access to a single DLL. // A DLL implements access to a single DLL.
type DLL struct { type DLL struct {
......
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package windows
import "syscall"
// Go names for Windows errors.
const (
ENOENT syscall.Errno = ERROR_FILE_NOT_FOUND
ENOTDIR syscall.Errno = ERROR_PATH_NOT_FOUND
)
// Windows reserves errors >= 1<<29 for application use.
const APPLICATION_ERROR = 1 << 29
// Invented values to support what package os and others expects.
const (
E2BIG syscall.Errno = APPLICATION_ERROR + iota
EACCES
EADDRINUSE
EADDRNOTAVAIL
EADV
EAFNOSUPPORT
EAGAIN
EALREADY
EBADE
EBADF
EBADFD
EBADMSG
EBADR
EBADRQC
EBADSLT
EBFONT
EBUSY
ECANCELED
ECHILD
ECHRNG
ECOMM
ECONNABORTED
ECONNREFUSED
ECONNRESET
EDEADLK
EDEADLOCK
EDESTADDRREQ
EDOM
EDOTDOT
EDQUOT
EEXIST
EFAULT
EFBIG
EHOSTDOWN
EHOSTUNREACH
EIDRM
EILSEQ
EINPROGRESS
EINTR
EINVAL
EIO
EISCONN
EISDIR
EISNAM
EKEYEXPIRED
EKEYREJECTED
EKEYREVOKED
EL2HLT
EL2NSYNC
EL3HLT
EL3RST
ELIBACC
ELIBBAD
ELIBEXEC
ELIBMAX
ELIBSCN
ELNRNG
ELOOP
EMEDIUMTYPE
EMFILE
EMLINK
EMSGSIZE
EMULTIHOP
ENAMETOOLONG
ENAVAIL
ENETDOWN
ENETRESET
ENETUNREACH
ENFILE
ENOANO
ENOBUFS
ENOCSI
ENODATA
ENODEV
ENOEXEC
ENOKEY
ENOLCK
ENOLINK
ENOMEDIUM
ENOMEM
ENOMSG
ENONET
ENOPKG
ENOPROTOOPT
ENOSPC
ENOSR
ENOSTR
ENOSYS
ENOTBLK
ENOTCONN
ENOTEMPTY
ENOTNAM
ENOTRECOVERABLE
ENOTSOCK
ENOTSUP
ENOTTY
ENOTUNIQ
ENXIO
EOPNOTSUPP
EOVERFLOW
EOWNERDEAD
EPERM
EPFNOSUPPORT
EPIPE
EPROTO
EPROTONOSUPPORT
EPROTOTYPE
ERANGE
EREMCHG
EREMOTE
EREMOTEIO
ERESTART
EROFS
ESHUTDOWN
ESOCKTNOSUPPORT
ESPIPE
ESRCH
ESRMNT
ESTALE
ESTRPIPE
ETIME
ETIMEDOUT
ETOOMANYREFS
ETXTBSY
EUCLEAN
EUNATCH
EUSERS
EWOULDBLOCK
EXDEV
EXFULL
EWINDOWS
)
// Error strings for invented errors
var errors = [...]string{
E2BIG - APPLICATION_ERROR: "argument list too long",
EACCES - APPLICATION_ERROR: "permission denied",
EADDRINUSE - APPLICATION_ERROR: "address already in use",
EADDRNOTAVAIL - APPLICATION_ERROR: "cannot assign requested address",
EADV - APPLICATION_ERROR: "advertise error",
EAFNOSUPPORT - APPLICATION_ERROR: "address family not supported by protocol",
EAGAIN - APPLICATION_ERROR: "resource temporarily unavailable",
EALREADY - APPLICATION_ERROR: "operation already in progress",
EBADE - APPLICATION_ERROR: "invalid exchange",
EBADF - APPLICATION_ERROR: "bad file descriptor",
EBADFD - APPLICATION_ERROR: "file descriptor in bad state",
EBADMSG - APPLICATION_ERROR: "bad message",
EBADR - APPLICATION_ERROR: "invalid request descriptor",
EBADRQC - APPLICATION_ERROR: "invalid request code",
EBADSLT - APPLICATION_ERROR: "invalid slot",
EBFONT - APPLICATION_ERROR: "bad font file format",
EBUSY - APPLICATION_ERROR: "device or resource busy",
ECANCELED - APPLICATION_ERROR: "operation canceled",
ECHILD - APPLICATION_ERROR: "no child processes",
ECHRNG - APPLICATION_ERROR: "channel number out of range",
ECOMM - APPLICATION_ERROR: "communication error on send",
ECONNABORTED - APPLICATION_ERROR: "software caused connection abort",
ECONNREFUSED - APPLICATION_ERROR: "connection refused",
ECONNRESET - APPLICATION_ERROR: "connection reset by peer",
EDEADLK - APPLICATION_ERROR: "resource deadlock avoided",
EDEADLOCK - APPLICATION_ERROR: "resource deadlock avoided",
EDESTADDRREQ - APPLICATION_ERROR: "destination address required",
EDOM - APPLICATION_ERROR: "numerical argument out of domain",
EDOTDOT - APPLICATION_ERROR: "RFS specific error",
EDQUOT - APPLICATION_ERROR: "disk quota exceeded",
EEXIST - APPLICATION_ERROR: "file exists",
EFAULT - APPLICATION_ERROR: "bad address",
EFBIG - APPLICATION_ERROR: "file too large",
EHOSTDOWN - APPLICATION_ERROR: "host is down",
EHOSTUNREACH - APPLICATION_ERROR: "no route to host",
EIDRM - APPLICATION_ERROR: "identifier removed",
EILSEQ - APPLICATION_ERROR: "invalid or incomplete multibyte or wide character",
EINPROGRESS - APPLICATION_ERROR: "operation now in progress",
EINTR - APPLICATION_ERROR: "interrupted system call",
EINVAL - APPLICATION_ERROR: "invalid argument",
EIO - APPLICATION_ERROR: "input/output error",
EISCONN - APPLICATION_ERROR: "transport endpoint is already connected",
EISDIR - APPLICATION_ERROR: "is a directory",
EISNAM - APPLICATION_ERROR: "is a named type file",
EKEYEXPIRED - APPLICATION_ERROR: "key has expired",
EKEYREJECTED - APPLICATION_ERROR: "key was rejected by service",
EKEYREVOKED - APPLICATION_ERROR: "key has been revoked",
EL2HLT - APPLICATION_ERROR: "level 2 halted",
EL2NSYNC - APPLICATION_ERROR: "level 2 not synchronized",
EL3HLT - APPLICATION_ERROR: "level 3 halted",
EL3RST - APPLICATION_ERROR: "level 3 reset",
ELIBACC - APPLICATION_ERROR: "can not access a needed shared library",
ELIBBAD - APPLICATION_ERROR: "accessing a corrupted shared library",
ELIBEXEC - APPLICATION_ERROR: "cannot exec a shared library directly",
ELIBMAX - APPLICATION_ERROR: "attempting to link in too many shared libraries",
ELIBSCN - APPLICATION_ERROR: ".lib section in a.out corrupted",
ELNRNG - APPLICATION_ERROR: "link number out of range",
ELOOP - APPLICATION_ERROR: "too many levels of symbolic links",
EMEDIUMTYPE - APPLICATION_ERROR: "wrong medium type",
EMFILE - APPLICATION_ERROR: "too many open files",
EMLINK - APPLICATION_ERROR: "too many links",
EMSGSIZE - APPLICATION_ERROR: "message too long",
EMULTIHOP - APPLICATION_ERROR: "multihop attempted",
ENAMETOOLONG - APPLICATION_ERROR: "file name too long",
ENAVAIL - APPLICATION_ERROR: "no XENIX semaphores available",
ENETDOWN - APPLICATION_ERROR: "network is down",
ENETRESET - APPLICATION_ERROR: "network dropped connection on reset",
ENETUNREACH - APPLICATION_ERROR: "network is unreachable",
ENFILE - APPLICATION_ERROR: "too many open files in system",
ENOANO - APPLICATION_ERROR: "no anode",
ENOBUFS - APPLICATION_ERROR: "no buffer space available",
ENOCSI - APPLICATION_ERROR: "no CSI structure available",
ENODATA - APPLICATION_ERROR: "no data available",
ENODEV - APPLICATION_ERROR: "no such device",
ENOEXEC - APPLICATION_ERROR: "exec format error",
ENOKEY - APPLICATION_ERROR: "required key not available",
ENOLCK - APPLICATION_ERROR: "no locks available",
ENOLINK - APPLICATION_ERROR: "link has been severed",
ENOMEDIUM - APPLICATION_ERROR: "no medium found",
ENOMEM - APPLICATION_ERROR: "cannot allocate memory",
ENOMSG - APPLICATION_ERROR: "no message of desired type",
ENONET - APPLICATION_ERROR: "machine is not on the network",
ENOPKG - APPLICATION_ERROR: "package not installed",
ENOPROTOOPT - APPLICATION_ERROR: "protocol not available",
ENOSPC - APPLICATION_ERROR: "no space left on device",
ENOSR - APPLICATION_ERROR: "out of streams resources",
ENOSTR - APPLICATION_ERROR: "device not a stream",
ENOSYS - APPLICATION_ERROR: "function not implemented",
ENOTBLK - APPLICATION_ERROR: "block device required",
ENOTCONN - APPLICATION_ERROR: "transport endpoint is not connected",
ENOTEMPTY - APPLICATION_ERROR: "directory not empty",
ENOTNAM - APPLICATION_ERROR: "not a XENIX named type file",
ENOTRECOVERABLE - APPLICATION_ERROR: "state not recoverable",
ENOTSOCK - APPLICATION_ERROR: "socket operation on non-socket",
ENOTSUP - APPLICATION_ERROR: "operation not supported",
ENOTTY - APPLICATION_ERROR: "inappropriate ioctl for device",
ENOTUNIQ - APPLICATION_ERROR: "name not unique on network",
ENXIO - APPLICATION_ERROR: "no such device or address",
EOPNOTSUPP - APPLICATION_ERROR: "operation not supported",
EOVERFLOW - APPLICATION_ERROR: "value too large for defined data type",
EOWNERDEAD - APPLICATION_ERROR: "owner died",
EPERM - APPLICATION_ERROR: "operation not permitted",
EPFNOSUPPORT - APPLICATION_ERROR: "protocol family not supported",
EPIPE - APPLICATION_ERROR: "broken pipe",
EPROTO - APPLICATION_ERROR: "protocol error",
EPROTONOSUPPORT - APPLICATION_ERROR: "protocol not supported",
EPROTOTYPE - APPLICATION_ERROR: "protocol wrong type for socket",
ERANGE - APPLICATION_ERROR: "numerical result out of range",
EREMCHG - APPLICATION_ERROR: "remote address changed",
EREMOTE - APPLICATION_ERROR: "object is remote",
EREMOTEIO - APPLICATION_ERROR: "remote I/O error",
ERESTART - APPLICATION_ERROR: "interrupted system call should be restarted",
EROFS - APPLICATION_ERROR: "read-only file system",
ESHUTDOWN - APPLICATION_ERROR: "cannot send after transport endpoint shutdown",
ESOCKTNOSUPPORT - APPLICATION_ERROR: "socket type not supported",
ESPIPE - APPLICATION_ERROR: "illegal seek",
ESRCH - APPLICATION_ERROR: "no such process",
ESRMNT - APPLICATION_ERROR: "srmount error",
ESTALE - APPLICATION_ERROR: "stale NFS file handle",
ESTRPIPE - APPLICATION_ERROR: "streams pipe error",
ETIME - APPLICATION_ERROR: "timer expired",
ETIMEDOUT - APPLICATION_ERROR: "connection timed out",
ETOOMANYREFS - APPLICATION_ERROR: "too many references: cannot splice",
ETXTBSY - APPLICATION_ERROR: "text file busy",
EUCLEAN - APPLICATION_ERROR: "structure needs cleaning",
EUNATCH - APPLICATION_ERROR: "protocol driver not attached",
EUSERS - APPLICATION_ERROR: "too many users",
EWOULDBLOCK - APPLICATION_ERROR: "resource temporarily unavailable",
EXDEV - APPLICATION_ERROR: "invalid cross-device link",
EXFULL - APPLICATION_ERROR: "exchange full",
EWINDOWS - APPLICATION_ERROR: "not supported by windows",
}
...@@ -8,6 +8,7 @@ package windows ...@@ -8,6 +8,7 @@ package windows
import ( import (
"sync" "sync"
"syscall"
"unicode/utf16" "unicode/utf16"
"unsafe" "unsafe"
) )
...@@ -149,7 +150,7 @@ func getFullPath(name string) (path string, err error) { ...@@ -149,7 +150,7 @@ func getFullPath(name string) (path string, err error) {
return "", err return "", err
} }
if n > uint32(len(buf)) { if n > uint32(len(buf)) {
return "", EINVAL return "", syscall.EINVAL
} }
} }
return UTF16ToString(buf[:n]), nil return UTF16ToString(buf[:n]), nil
...@@ -166,7 +167,7 @@ func normalizeDir(dir string) (name string, err error) { ...@@ -166,7 +167,7 @@ func normalizeDir(dir string) (name string, err error) {
} }
if len(ndir) > 2 && isSlash(ndir[0]) && isSlash(ndir[1]) { if len(ndir) > 2 && isSlash(ndir[0]) && isSlash(ndir[1]) {
// dir cannot have \\server\share\path form // dir cannot have \\server\share\path form
return "", EINVAL return "", syscall.EINVAL
} }
return ndir, nil return ndir, nil
} }
...@@ -180,7 +181,7 @@ func volToUpper(ch int) int { ...@@ -180,7 +181,7 @@ func volToUpper(ch int) int {
func joinExeDirAndFName(dir, p string) (name string, err error) { func joinExeDirAndFName(dir, p string) (name string, err error) {
if len(p) == 0 { if len(p) == 0 {
return "", EINVAL return "", syscall.EINVAL
} }
if len(p) > 2 && isSlash(p[0]) && isSlash(p[1]) { if len(p) > 2 && isSlash(p[0]) && isSlash(p[1]) {
// \\server\share\path form // \\server\share\path form
...@@ -189,7 +190,7 @@ func joinExeDirAndFName(dir, p string) (name string, err error) { ...@@ -189,7 +190,7 @@ func joinExeDirAndFName(dir, p string) (name string, err error) {
if len(p) > 1 && p[1] == ':' { if len(p) > 1 && p[1] == ':' {
// has drive letter // has drive letter
if len(p) == 2 { if len(p) == 2 {
return "", EINVAL return "", syscall.EINVAL
} }
if isSlash(p[2]) { if isSlash(p[2]) {
return p, nil return p, nil
...@@ -217,7 +218,7 @@ func joinExeDirAndFName(dir, p string) (name string, err error) { ...@@ -217,7 +218,7 @@ func joinExeDirAndFName(dir, p string) (name string, err error) {
} }
} }
// we shouldn't be here // we shouldn't be here
return "", EINVAL return "", syscall.EINVAL
} }
type ProcAttr struct { type ProcAttr struct {
...@@ -238,7 +239,7 @@ var zeroSysProcAttr SysProcAttr ...@@ -238,7 +239,7 @@ var zeroSysProcAttr SysProcAttr
func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) { func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) {
if len(argv0) == 0 { if len(argv0) == 0 {
return 0, 0, EWINDOWS return 0, 0, syscall.EWINDOWS
} }
if attr == nil { if attr == nil {
attr = &zeroProcAttr attr = &zeroProcAttr
...@@ -249,7 +250,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle ...@@ -249,7 +250,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle
} }
if len(attr.Files) > 3 { if len(attr.Files) > 3 {
return 0, 0, EWINDOWS return 0, 0, syscall.EWINDOWS
} }
if len(attr.Dir) != 0 { if len(attr.Dir) != 0 {
...@@ -337,5 +338,5 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle ...@@ -337,5 +338,5 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle
} }
func Exec(argv0 string, argv []string, envv []string) (err error) { func Exec(argv0 string, argv []string, envv []string) (err error) {
return EWINDOWS return syscall.EWINDOWS
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package windows package windows
import ( import (
"syscall"
"unsafe" "unsafe"
) )
...@@ -123,7 +124,7 @@ func StringToSid(s string) (*SID, error) { ...@@ -123,7 +124,7 @@ func StringToSid(s string) (*SID, error) {
// System specify target computer to search. // System specify target computer to search.
func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) { func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) {
if len(account) == 0 { if len(account) == 0 {
return nil, "", 0, EINVAL return nil, "", 0, syscall.EINVAL
} }
acc, e := UTF16PtrFromString(account) acc, e := UTF16PtrFromString(account)
if e != nil { if e != nil {
......
...@@ -21,13 +21,15 @@ ...@@ -21,13 +21,15 @@
// holds a value of type syscall.Errno. // holds a value of type syscall.Errno.
package windows package windows
import "syscall"
// ByteSliceFromString returns a NUL-terminated slice of bytes // ByteSliceFromString returns a NUL-terminated slice of bytes
// containing the text of s. If s contains a NUL byte at any // containing the text of s. If s contains a NUL byte at any
// location, it returns (nil, EINVAL). // location, it returns (nil, syscall.EINVAL).
func ByteSliceFromString(s string) ([]byte, error) { func ByteSliceFromString(s string) ([]byte, error) {
for i := 0; i < len(s); i++ { for i := 0; i < len(s); i++ {
if s[i] == 0 { if s[i] == 0 {
return nil, EINVAL return nil, syscall.EINVAL
} }
} }
a := make([]byte, len(s)+1) a := make([]byte, len(s)+1)
...@@ -37,7 +39,7 @@ func ByteSliceFromString(s string) ([]byte, error) { ...@@ -37,7 +39,7 @@ func ByteSliceFromString(s string) ([]byte, error) {
// BytePtrFromString returns a pointer to a NUL-terminated array of // BytePtrFromString returns a pointer to a NUL-terminated array of
// bytes containing the text of s. If s contains a NUL byte at any // bytes containing the text of s. If s contains a NUL byte at any
// location, it returns (nil, EINVAL). // location, it returns (nil, syscall.EINVAL).
func BytePtrFromString(s string) (*byte, error) { func BytePtrFromString(s string) (*byte, error) {
a, err := ByteSliceFromString(s) a, err := ByteSliceFromString(s)
if err != nil { if err != nil {
......
...@@ -31,11 +31,11 @@ func StringToUTF16(s string) []uint16 { ...@@ -31,11 +31,11 @@ func StringToUTF16(s string) []uint16 {
// UTF16FromString returns the UTF-16 encoding of the UTF-8 string // UTF16FromString returns the UTF-16 encoding of the UTF-8 string
// s, with a terminating NUL added. If s contains a NUL byte at any // s, with a terminating NUL added. If s contains a NUL byte at any
// location, it returns (nil, EINVAL). // location, it returns (nil, syscall.EINVAL).
func UTF16FromString(s string) ([]uint16, error) { func UTF16FromString(s string) ([]uint16, error) {
for i := 0; i < len(s); i++ { for i := 0; i < len(s); i++ {
if s[i] == 0 { if s[i] == 0 {
return nil, EINVAL return nil, syscall.EINVAL
} }
} }
return utf16.Encode([]rune(s + "\x00")), nil return utf16.Encode([]rune(s + "\x00")), nil
...@@ -60,7 +60,7 @@ func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] } ...@@ -60,7 +60,7 @@ func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] }
// UTF16PtrFromString returns pointer to the UTF-16 encoding of // UTF16PtrFromString returns pointer to the UTF-16 encoding of
// the UTF-8 string s, with a terminating NUL added. If s // the UTF-8 string s, with a terminating NUL added. If s
// contains a NUL byte at any location, it returns (nil, EINVAL). // contains a NUL byte at any location, it returns (nil, syscall.EINVAL).
func UTF16PtrFromString(s string) (*uint16, error) { func UTF16PtrFromString(s string) (*uint16, error) {
a, err := UTF16FromString(s) a, err := UTF16FromString(s)
if err != nil { if err != nil {
...@@ -71,41 +71,6 @@ func UTF16PtrFromString(s string) (*uint16, error) { ...@@ -71,41 +71,6 @@ func UTF16PtrFromString(s string) (*uint16, error) {
func Getpagesize() int { return 4096 } func Getpagesize() int { return 4096 }
// Errno is the Windows error number.
type Errno uintptr
func langid(pri, sub uint16) uint32 { return uint32(sub)<<10 | uint32(pri) }
func (e Errno) Error() string {
// deal with special go errors
idx := int(e - APPLICATION_ERROR)
if 0 <= idx && idx < len(errors) {
return errors[idx]
}
// ask windows for the remaining errors
var flags uint32 = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_IGNORE_INSERTS
b := make([]uint16, 300)
n, err := FormatMessage(flags, 0, uint32(e), langid(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil)
if err != nil {
n, err = FormatMessage(flags, 0, uint32(e), 0, b, nil)
if err != nil {
return "winapi error #" + itoa(int(e))
}
}
// trim terminating \r and \n
for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- {
}
return string(utf16.Decode(b[:n]))
}
func (e Errno) Temporary() bool {
return e == EINTR || e == EMFILE || e.Timeout()
}
func (e Errno) Timeout() bool {
return e == EAGAIN || e == EWOULDBLOCK || e == ETIMEDOUT
}
// Converts a Go function to a function pointer conforming // Converts a Go function to a function pointer conforming
// to the stdcall or cdecl calling convention. This is useful when // to the stdcall or cdecl calling convention. This is useful when
// interoperating with Windows code requiring callbacks. // interoperating with Windows code requiring callbacks.
...@@ -321,7 +286,7 @@ func Seek(fd Handle, offset int64, whence int) (newoffset int64, err error) { ...@@ -321,7 +286,7 @@ func Seek(fd Handle, offset int64, whence int) (newoffset int64, err error) {
// use GetFileType to check pipe, pipe can't do seek // use GetFileType to check pipe, pipe can't do seek
ft, _ := GetFileType(fd) ft, _ := GetFileType(fd)
if ft == FILE_TYPE_PIPE { if ft == FILE_TYPE_PIPE {
return 0, EPIPE return 0, syscall.EPIPE
} }
rlo, e := SetFilePointer(fd, lo, &hi, w) rlo, e := SetFilePointer(fd, lo, &hi, w)
if e != nil { if e != nil {
...@@ -437,7 +402,7 @@ func Gettimeofday(tv *Timeval) (err error) { ...@@ -437,7 +402,7 @@ func Gettimeofday(tv *Timeval) (err error) {
func Pipe(p []Handle) (err error) { func Pipe(p []Handle) (err error) {
if len(p) != 2 { if len(p) != 2 {
return EINVAL return syscall.EINVAL
} }
var r, w Handle var r, w Handle
e := CreatePipe(&r, &w, makeInheritSa(), 0) e := CreatePipe(&r, &w, makeInheritSa(), 0)
...@@ -451,7 +416,7 @@ func Pipe(p []Handle) (err error) { ...@@ -451,7 +416,7 @@ func Pipe(p []Handle) (err error) {
func Utimes(path string, tv []Timeval) (err error) { func Utimes(path string, tv []Timeval) (err error) {
if len(tv) != 2 { if len(tv) != 2 {
return EINVAL return syscall.EINVAL
} }
pathp, e := UTF16PtrFromString(path) pathp, e := UTF16PtrFromString(path)
if e != nil { if e != nil {
...@@ -471,7 +436,7 @@ func Utimes(path string, tv []Timeval) (err error) { ...@@ -471,7 +436,7 @@ func Utimes(path string, tv []Timeval) (err error) {
func UtimesNano(path string, ts []Timespec) (err error) { func UtimesNano(path string, ts []Timespec) (err error) {
if len(ts) != 2 { if len(ts) != 2 {
return EINVAL return syscall.EINVAL
} }
pathp, e := UTF16PtrFromString(path) pathp, e := UTF16PtrFromString(path)
if e != nil { if e != nil {
...@@ -495,7 +460,7 @@ func Fsync(fd Handle) (err error) { ...@@ -495,7 +460,7 @@ func Fsync(fd Handle) (err error) {
func Chmod(path string, mode uint32) (err error) { func Chmod(path string, mode uint32) (err error) {
if mode == 0 { if mode == 0 {
return EINVAL return syscall.EINVAL
} }
p, e := UTF16PtrFromString(path) p, e := UTF16PtrFromString(path)
if e != nil { if e != nil {
...@@ -598,7 +563,7 @@ type SockaddrInet4 struct { ...@@ -598,7 +563,7 @@ type SockaddrInet4 struct {
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, int32, error) { func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, int32, error) {
if sa.Port < 0 || sa.Port > 0xFFFF { if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL return nil, 0, syscall.EINVAL
} }
sa.raw.Family = AF_INET sa.raw.Family = AF_INET
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
...@@ -619,7 +584,7 @@ type SockaddrInet6 struct { ...@@ -619,7 +584,7 @@ type SockaddrInet6 struct {
func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, int32, error) { func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, int32, error) {
if sa.Port < 0 || sa.Port > 0xFFFF { if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL return nil, 0, syscall.EINVAL
} }
sa.raw.Family = AF_INET6 sa.raw.Family = AF_INET6
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
...@@ -638,13 +603,13 @@ type SockaddrUnix struct { ...@@ -638,13 +603,13 @@ type SockaddrUnix struct {
func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) { func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) {
// TODO(brainman): implement SockaddrUnix.sockaddr() // TODO(brainman): implement SockaddrUnix.sockaddr()
return nil, 0, EWINDOWS return nil, 0, syscall.EWINDOWS
} }
func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) { func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
switch rsa.Addr.Family { switch rsa.Addr.Family {
case AF_UNIX: case AF_UNIX:
return nil, EWINDOWS return nil, syscall.EWINDOWS
case AF_INET: case AF_INET:
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa)) pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
...@@ -667,12 +632,12 @@ func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) { ...@@ -667,12 +632,12 @@ func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
} }
return sa, nil return sa, nil
} }
return nil, EAFNOSUPPORT return nil, syscall.EAFNOSUPPORT
} }
func Socket(domain, typ, proto int) (fd Handle, err error) { func Socket(domain, typ, proto int) (fd Handle, err error) {
if domain == AF_INET6 && SocketDisableIPv6 { if domain == AF_INET6 && SocketDisableIPv6 {
return InvalidHandle, EAFNOSUPPORT return InvalidHandle, syscall.EAFNOSUPPORT
} }
return socket(int32(domain), int32(typ), int32(proto)) return socket(int32(domain), int32(typ), int32(proto))
} }
...@@ -768,7 +733,7 @@ func connectEx(s Handle, name unsafe.Pointer, namelen int32, sendBuf *byte, send ...@@ -768,7 +733,7 @@ func connectEx(s Handle, name unsafe.Pointer, namelen int32, sendBuf *byte, send
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -833,12 +798,12 @@ func NsecToTimespec(nsec int64) (ts Timespec) { ...@@ -833,12 +798,12 @@ func NsecToTimespec(nsec int64) (ts Timespec) {
// TODO(brainman): fix all needed for net // TODO(brainman): fix all needed for net
func Accept(fd Handle) (nfd Handle, sa Sockaddr, err error) { return 0, nil, EWINDOWS } func Accept(fd Handle) (nfd Handle, sa Sockaddr, err error) { return 0, nil, syscall.EWINDOWS }
func Recvfrom(fd Handle, p []byte, flags int) (n int, from Sockaddr, err error) { func Recvfrom(fd Handle, p []byte, flags int) (n int, from Sockaddr, err error) {
return 0, nil, EWINDOWS return 0, nil, syscall.EWINDOWS
} }
func Sendto(fd Handle, p []byte, flags int, to Sockaddr) (err error) { return EWINDOWS } func Sendto(fd Handle, p []byte, flags int, to Sockaddr) (err error) { return syscall.EWINDOWS }
func SetsockoptTimeval(fd Handle, level, opt int, tv *Timeval) (err error) { return EWINDOWS } func SetsockoptTimeval(fd Handle, level, opt int, tv *Timeval) (err error) { return syscall.EWINDOWS }
// The Linger struct is wrong but we only noticed after Go 1. // The Linger struct is wrong but we only noticed after Go 1.
// sysLinger is the real system call structure. // sysLinger is the real system call structure.
...@@ -867,7 +832,7 @@ type IPv6Mreq struct { ...@@ -867,7 +832,7 @@ type IPv6Mreq struct {
Interface uint32 Interface uint32
} }
func GetsockoptInt(fd Handle, level, opt int) (int, error) { return -1, EWINDOWS } func GetsockoptInt(fd Handle, level, opt int) (int, error) { return -1, syscall.EWINDOWS }
func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) { func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) {
sys := sysLinger{Onoff: uint16(l.Onoff), Linger: uint16(l.Linger)} sys := sysLinger{Onoff: uint16(l.Onoff), Linger: uint16(l.Linger)}
...@@ -880,7 +845,9 @@ func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { ...@@ -880,7 +845,9 @@ func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) {
func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) {
return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq)))
} }
func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return EWINDOWS } func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) {
return syscall.EWINDOWS
}
func Getpid() (pid int) { return int(getCurrentProcessId()) } func Getpid() (pid int) { return int(getCurrentProcessId()) }
...@@ -941,20 +908,20 @@ func Getppid() (ppid int) { ...@@ -941,20 +908,20 @@ func Getppid() (ppid int) {
} }
// TODO(brainman): fix all needed for os // TODO(brainman): fix all needed for os
func Fchdir(fd Handle) (err error) { return EWINDOWS } func Fchdir(fd Handle) (err error) { return syscall.EWINDOWS }
func Link(oldpath, newpath string) (err error) { return EWINDOWS } func Link(oldpath, newpath string) (err error) { return syscall.EWINDOWS }
func Symlink(path, link string) (err error) { return EWINDOWS } func Symlink(path, link string) (err error) { return syscall.EWINDOWS }
func Fchmod(fd Handle, mode uint32) (err error) { return EWINDOWS } func Fchmod(fd Handle, mode uint32) (err error) { return syscall.EWINDOWS }
func Chown(path string, uid int, gid int) (err error) { return EWINDOWS } func Chown(path string, uid int, gid int) (err error) { return syscall.EWINDOWS }
func Lchown(path string, uid int, gid int) (err error) { return EWINDOWS } func Lchown(path string, uid int, gid int) (err error) { return syscall.EWINDOWS }
func Fchown(fd Handle, uid int, gid int) (err error) { return EWINDOWS } func Fchown(fd Handle, uid int, gid int) (err error) { return syscall.EWINDOWS }
func Getuid() (uid int) { return -1 } func Getuid() (uid int) { return -1 }
func Geteuid() (euid int) { return -1 } func Geteuid() (euid int) { return -1 }
func Getgid() (gid int) { return -1 } func Getgid() (gid int) { return -1 }
func Getegid() (egid int) { return -1 } func Getegid() (egid int) { return -1 }
func Getgroups() (gids []int, err error) { return nil, EWINDOWS } func Getgroups() (gids []int, err error) { return nil, syscall.EWINDOWS }
type Signal int type Signal int
...@@ -994,7 +961,7 @@ func Readlink(path string, buf []byte) (n int, err error) { ...@@ -994,7 +961,7 @@ func Readlink(path string, buf []byte) (n int, err error) {
if uintptr(bytesReturned) < unsafe.Sizeof(*rdb) || if uintptr(bytesReturned) < unsafe.Sizeof(*rdb) ||
rdb.ReparseTag != IO_REPARSE_TAG_SYMLINK { rdb.ReparseTag != IO_REPARSE_TAG_SYMLINK {
// the path is not a symlink but another type of reparse point // the path is not a symlink but another type of reparse point
return -1, ENOENT return -1, syscall.ENOENT
} }
s := UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(&rdb.PathBuffer[0]))[:rdb.PrintNameLength/2]) s := UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(&rdb.PathBuffer[0]))[:rdb.PrintNameLength/2])
......
...@@ -182,7 +182,7 @@ func LoadLibrary(libname string) (handle Handle, err error) { ...@@ -182,7 +182,7 @@ func LoadLibrary(libname string) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -194,7 +194,7 @@ func FreeLibrary(handle Handle) (err error) { ...@@ -194,7 +194,7 @@ func FreeLibrary(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -212,7 +212,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { ...@@ -212,7 +212,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -225,7 +225,7 @@ func GetVersion() (ver uint32, err error) { ...@@ -225,7 +225,7 @@ func GetVersion() (ver uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -242,7 +242,7 @@ func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf ...@@ -242,7 +242,7 @@ func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -260,7 +260,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes ...@@ -260,7 +260,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -276,7 +276,7 @@ func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( ...@@ -276,7 +276,7 @@ func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -292,7 +292,7 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ...@@ -292,7 +292,7 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped)
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -305,7 +305,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence ...@@ -305,7 +305,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -317,7 +317,7 @@ func CloseHandle(handle Handle) (err error) { ...@@ -317,7 +317,7 @@ func CloseHandle(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -330,7 +330,7 @@ func GetStdHandle(stdhandle int) (handle Handle, err error) { ...@@ -330,7 +330,7 @@ func GetStdHandle(stdhandle int) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -343,7 +343,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro ...@@ -343,7 +343,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -355,7 +355,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) { ...@@ -355,7 +355,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -367,7 +367,7 @@ func FindClose(handle Handle) (err error) { ...@@ -367,7 +367,7 @@ func FindClose(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -379,7 +379,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e ...@@ -379,7 +379,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -392,7 +392,7 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { ...@@ -392,7 +392,7 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -404,7 +404,7 @@ func SetCurrentDirectory(path *uint16) (err error) { ...@@ -404,7 +404,7 @@ func SetCurrentDirectory(path *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -416,7 +416,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { ...@@ -416,7 +416,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -428,7 +428,7 @@ func RemoveDirectory(path *uint16) (err error) { ...@@ -428,7 +428,7 @@ func RemoveDirectory(path *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -440,7 +440,7 @@ func DeleteFile(path *uint16) (err error) { ...@@ -440,7 +440,7 @@ func DeleteFile(path *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -452,7 +452,7 @@ func MoveFile(from *uint16, to *uint16) (err error) { ...@@ -452,7 +452,7 @@ func MoveFile(from *uint16, to *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -464,7 +464,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { ...@@ -464,7 +464,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -476,7 +476,7 @@ func SetEndOfFile(handle Handle) (err error) { ...@@ -476,7 +476,7 @@ func SetEndOfFile(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -494,7 +494,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { ...@@ -494,7 +494,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -507,7 +507,7 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, thre ...@@ -507,7 +507,7 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, thre
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -519,7 +519,7 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overla ...@@ -519,7 +519,7 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overla
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -531,7 +531,7 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlap ...@@ -531,7 +531,7 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlap
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -543,7 +543,7 @@ func CancelIo(s Handle) (err error) { ...@@ -543,7 +543,7 @@ func CancelIo(s Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -555,7 +555,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) { ...@@ -555,7 +555,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -573,7 +573,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA ...@@ -573,7 +573,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -592,7 +592,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err ...@@ -592,7 +592,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -604,7 +604,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) { ...@@ -604,7 +604,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -616,7 +616,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { ...@@ -616,7 +616,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -628,7 +628,7 @@ func GetStartupInfo(startupInfo *StartupInfo) (err error) { ...@@ -628,7 +628,7 @@ func GetStartupInfo(startupInfo *StartupInfo) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -641,7 +641,7 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) { ...@@ -641,7 +641,7 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -653,7 +653,7 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, ...@@ -653,7 +653,7 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -671,7 +671,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP ...@@ -671,7 +671,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -684,7 +684,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, ...@@ -684,7 +684,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -697,7 +697,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { ...@@ -697,7 +697,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -709,7 +709,7 @@ func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, ...@@ -709,7 +709,7 @@ func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -722,7 +722,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) { ...@@ -722,7 +722,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -734,7 +734,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 ...@@ -734,7 +734,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -746,7 +746,7 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { ...@@ -746,7 +746,7 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -758,7 +758,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { ...@@ -758,7 +758,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -771,7 +771,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) { ...@@ -771,7 +771,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -783,7 +783,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) { ...@@ -783,7 +783,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -796,7 +796,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 ...@@ -796,7 +796,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -808,7 +808,7 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { ...@@ -808,7 +808,7 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -820,7 +820,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim ...@@ -820,7 +820,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -833,7 +833,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { ...@@ -833,7 +833,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -845,7 +845,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) { ...@@ -845,7 +845,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -857,7 +857,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { ...@@ -857,7 +857,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -876,7 +876,7 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err ...@@ -876,7 +876,7 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -889,7 +889,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) { ...@@ -889,7 +889,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -901,7 +901,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) ...@@ -901,7 +901,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error)
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -913,7 +913,7 @@ func FlushFileBuffers(handle Handle) (err error) { ...@@ -913,7 +913,7 @@ func FlushFileBuffers(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -926,7 +926,7 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( ...@@ -926,7 +926,7 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -939,7 +939,7 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er ...@@ -939,7 +939,7 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -952,7 +952,7 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin ...@@ -952,7 +952,7 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -965,7 +965,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS ...@@ -965,7 +965,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -978,7 +978,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui ...@@ -978,7 +978,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -990,7 +990,7 @@ func UnmapViewOfFile(addr uintptr) (err error) { ...@@ -990,7 +990,7 @@ func UnmapViewOfFile(addr uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1002,7 +1002,7 @@ func FlushViewOfFile(addr uintptr, length uintptr) (err error) { ...@@ -1002,7 +1002,7 @@ func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1014,7 +1014,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) { ...@@ -1014,7 +1014,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1026,7 +1026,7 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) { ...@@ -1026,7 +1026,7 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1038,7 +1038,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint ...@@ -1038,7 +1038,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1056,7 +1056,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree ...@@ -1056,7 +1056,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1069,7 +1069,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { ...@@ -1069,7 +1069,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1082,7 +1082,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr ...@@ -1082,7 +1082,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1095,7 +1095,7 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex ...@@ -1095,7 +1095,7 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1107,7 +1107,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad ...@@ -1107,7 +1107,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1119,7 +1119,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) { ...@@ -1119,7 +1119,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1131,7 +1131,7 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a ...@@ -1131,7 +1131,7 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1149,7 +1149,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en ...@@ -1149,7 +1149,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1161,7 +1161,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) { ...@@ -1161,7 +1161,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1173,7 +1173,7 @@ func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext ...@@ -1173,7 +1173,7 @@ func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1231,7 +1231,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { ...@@ -1231,7 +1231,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1243,7 +1243,7 @@ func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, ...@@ -1243,7 +1243,7 @@ func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1255,7 +1255,7 @@ func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, input ...@@ -1255,7 +1255,7 @@ func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, input
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1268,7 +1268,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er ...@@ -1268,7 +1268,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1280,7 +1280,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { ...@@ -1280,7 +1280,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1292,7 +1292,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { ...@@ -1292,7 +1292,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1304,7 +1304,7 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff ...@@ -1304,7 +1304,7 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1316,7 +1316,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u ...@@ -1316,7 +1316,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1328,7 +1328,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr ...@@ -1328,7 +1328,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1348,7 +1348,7 @@ func WSACleanup() (err error) { ...@@ -1348,7 +1348,7 @@ func WSACleanup() (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1360,7 +1360,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo ...@@ -1360,7 +1360,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1373,7 +1373,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { ...@@ -1373,7 +1373,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1385,7 +1385,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 ...@@ -1385,7 +1385,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1397,7 +1397,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3 ...@@ -1397,7 +1397,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1409,7 +1409,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { ...@@ -1409,7 +1409,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1421,7 +1421,7 @@ func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { ...@@ -1421,7 +1421,7 @@ func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1433,7 +1433,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { ...@@ -1433,7 +1433,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1445,7 +1445,7 @@ func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { ...@@ -1445,7 +1445,7 @@ func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1457,7 +1457,7 @@ func listen(s Handle, backlog int32) (err error) { ...@@ -1457,7 +1457,7 @@ func listen(s Handle, backlog int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1469,7 +1469,7 @@ func shutdown(s Handle, how int32) (err error) { ...@@ -1469,7 +1469,7 @@ func shutdown(s Handle, how int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1481,7 +1481,7 @@ func Closesocket(s Handle) (err error) { ...@@ -1481,7 +1481,7 @@ func Closesocket(s Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1493,7 +1493,7 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32 ...@@ -1493,7 +1493,7 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1510,7 +1510,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 ...@@ -1510,7 +1510,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1522,7 +1522,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, ...@@ -1522,7 +1522,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1534,7 +1534,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui ...@@ -1534,7 +1534,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1546,7 +1546,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 ...@@ -1546,7 +1546,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1564,7 +1564,7 @@ func GetHostByName(name string) (h *Hostent, err error) { ...@@ -1564,7 +1564,7 @@ func GetHostByName(name string) (h *Hostent, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1587,7 +1587,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) { ...@@ -1587,7 +1587,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1611,7 +1611,7 @@ func GetProtoByName(name string) (p *Protoent, err error) { ...@@ -1611,7 +1611,7 @@ func GetProtoByName(name string) (p *Protoent, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1670,7 +1670,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) ...@@ -1670,7 +1670,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error)
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1683,7 +1683,7 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL ...@@ -1683,7 +1683,7 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1695,7 +1695,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint ...@@ -1695,7 +1695,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1707,7 +1707,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er ...@@ -1707,7 +1707,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1743,7 +1743,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3 ...@@ -1743,7 +1743,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1755,7 +1755,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen ...@@ -1755,7 +1755,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1767,7 +1767,7 @@ func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { ...@@ -1767,7 +1767,7 @@ func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1779,7 +1779,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { ...@@ -1779,7 +1779,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1797,7 +1797,7 @@ func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { ...@@ -1797,7 +1797,7 @@ func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1809,7 +1809,7 @@ func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { ...@@ -1809,7 +1809,7 @@ func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1821,7 +1821,7 @@ func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, ...@@ -1821,7 +1821,7 @@ func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1833,7 +1833,7 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { ...@@ -1833,7 +1833,7 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
......
...@@ -182,7 +182,7 @@ func LoadLibrary(libname string) (handle Handle, err error) { ...@@ -182,7 +182,7 @@ func LoadLibrary(libname string) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -194,7 +194,7 @@ func FreeLibrary(handle Handle) (err error) { ...@@ -194,7 +194,7 @@ func FreeLibrary(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -212,7 +212,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { ...@@ -212,7 +212,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -225,7 +225,7 @@ func GetVersion() (ver uint32, err error) { ...@@ -225,7 +225,7 @@ func GetVersion() (ver uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -242,7 +242,7 @@ func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf ...@@ -242,7 +242,7 @@ func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -260,7 +260,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes ...@@ -260,7 +260,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -276,7 +276,7 @@ func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( ...@@ -276,7 +276,7 @@ func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -292,7 +292,7 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ...@@ -292,7 +292,7 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped)
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -305,7 +305,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence ...@@ -305,7 +305,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -317,7 +317,7 @@ func CloseHandle(handle Handle) (err error) { ...@@ -317,7 +317,7 @@ func CloseHandle(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -330,7 +330,7 @@ func GetStdHandle(stdhandle int) (handle Handle, err error) { ...@@ -330,7 +330,7 @@ func GetStdHandle(stdhandle int) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -343,7 +343,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro ...@@ -343,7 +343,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -355,7 +355,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) { ...@@ -355,7 +355,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -367,7 +367,7 @@ func FindClose(handle Handle) (err error) { ...@@ -367,7 +367,7 @@ func FindClose(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -379,7 +379,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e ...@@ -379,7 +379,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -392,7 +392,7 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { ...@@ -392,7 +392,7 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -404,7 +404,7 @@ func SetCurrentDirectory(path *uint16) (err error) { ...@@ -404,7 +404,7 @@ func SetCurrentDirectory(path *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -416,7 +416,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { ...@@ -416,7 +416,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -428,7 +428,7 @@ func RemoveDirectory(path *uint16) (err error) { ...@@ -428,7 +428,7 @@ func RemoveDirectory(path *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -440,7 +440,7 @@ func DeleteFile(path *uint16) (err error) { ...@@ -440,7 +440,7 @@ func DeleteFile(path *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -452,7 +452,7 @@ func MoveFile(from *uint16, to *uint16) (err error) { ...@@ -452,7 +452,7 @@ func MoveFile(from *uint16, to *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -464,7 +464,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { ...@@ -464,7 +464,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -476,7 +476,7 @@ func SetEndOfFile(handle Handle) (err error) { ...@@ -476,7 +476,7 @@ func SetEndOfFile(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -494,7 +494,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { ...@@ -494,7 +494,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -507,7 +507,7 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, thre ...@@ -507,7 +507,7 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, thre
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -519,7 +519,7 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overla ...@@ -519,7 +519,7 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overla
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -531,7 +531,7 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlap ...@@ -531,7 +531,7 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlap
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -543,7 +543,7 @@ func CancelIo(s Handle) (err error) { ...@@ -543,7 +543,7 @@ func CancelIo(s Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -555,7 +555,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) { ...@@ -555,7 +555,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -573,7 +573,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA ...@@ -573,7 +573,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -592,7 +592,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err ...@@ -592,7 +592,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -604,7 +604,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) { ...@@ -604,7 +604,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -616,7 +616,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { ...@@ -616,7 +616,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -628,7 +628,7 @@ func GetStartupInfo(startupInfo *StartupInfo) (err error) { ...@@ -628,7 +628,7 @@ func GetStartupInfo(startupInfo *StartupInfo) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -641,7 +641,7 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) { ...@@ -641,7 +641,7 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -653,7 +653,7 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, ...@@ -653,7 +653,7 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -671,7 +671,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP ...@@ -671,7 +671,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -684,7 +684,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, ...@@ -684,7 +684,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -697,7 +697,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { ...@@ -697,7 +697,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -709,7 +709,7 @@ func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, ...@@ -709,7 +709,7 @@ func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -722,7 +722,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) { ...@@ -722,7 +722,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -734,7 +734,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 ...@@ -734,7 +734,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -746,7 +746,7 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { ...@@ -746,7 +746,7 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -758,7 +758,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { ...@@ -758,7 +758,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -771,7 +771,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) { ...@@ -771,7 +771,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -783,7 +783,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) { ...@@ -783,7 +783,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -796,7 +796,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 ...@@ -796,7 +796,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -808,7 +808,7 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { ...@@ -808,7 +808,7 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -820,7 +820,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim ...@@ -820,7 +820,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -833,7 +833,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { ...@@ -833,7 +833,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -845,7 +845,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) { ...@@ -845,7 +845,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -857,7 +857,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { ...@@ -857,7 +857,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -876,7 +876,7 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err ...@@ -876,7 +876,7 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -889,7 +889,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) { ...@@ -889,7 +889,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -901,7 +901,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) ...@@ -901,7 +901,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error)
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -913,7 +913,7 @@ func FlushFileBuffers(handle Handle) (err error) { ...@@ -913,7 +913,7 @@ func FlushFileBuffers(handle Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -926,7 +926,7 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( ...@@ -926,7 +926,7 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -939,7 +939,7 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er ...@@ -939,7 +939,7 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -952,7 +952,7 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin ...@@ -952,7 +952,7 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -965,7 +965,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS ...@@ -965,7 +965,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -978,7 +978,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui ...@@ -978,7 +978,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -990,7 +990,7 @@ func UnmapViewOfFile(addr uintptr) (err error) { ...@@ -990,7 +990,7 @@ func UnmapViewOfFile(addr uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1002,7 +1002,7 @@ func FlushViewOfFile(addr uintptr, length uintptr) (err error) { ...@@ -1002,7 +1002,7 @@ func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1014,7 +1014,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) { ...@@ -1014,7 +1014,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1026,7 +1026,7 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) { ...@@ -1026,7 +1026,7 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1038,7 +1038,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint ...@@ -1038,7 +1038,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1056,7 +1056,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree ...@@ -1056,7 +1056,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1069,7 +1069,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { ...@@ -1069,7 +1069,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1082,7 +1082,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr ...@@ -1082,7 +1082,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1095,7 +1095,7 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex ...@@ -1095,7 +1095,7 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1107,7 +1107,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad ...@@ -1107,7 +1107,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1119,7 +1119,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) { ...@@ -1119,7 +1119,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1131,7 +1131,7 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a ...@@ -1131,7 +1131,7 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1149,7 +1149,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en ...@@ -1149,7 +1149,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1161,7 +1161,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) { ...@@ -1161,7 +1161,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1173,7 +1173,7 @@ func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext ...@@ -1173,7 +1173,7 @@ func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1231,7 +1231,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { ...@@ -1231,7 +1231,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1243,7 +1243,7 @@ func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, ...@@ -1243,7 +1243,7 @@ func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1255,7 +1255,7 @@ func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, input ...@@ -1255,7 +1255,7 @@ func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, input
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1268,7 +1268,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er ...@@ -1268,7 +1268,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1280,7 +1280,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { ...@@ -1280,7 +1280,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1292,7 +1292,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { ...@@ -1292,7 +1292,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1304,7 +1304,7 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff ...@@ -1304,7 +1304,7 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1316,7 +1316,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u ...@@ -1316,7 +1316,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1328,7 +1328,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr ...@@ -1328,7 +1328,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1348,7 +1348,7 @@ func WSACleanup() (err error) { ...@@ -1348,7 +1348,7 @@ func WSACleanup() (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1360,7 +1360,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo ...@@ -1360,7 +1360,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1373,7 +1373,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { ...@@ -1373,7 +1373,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1385,7 +1385,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 ...@@ -1385,7 +1385,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1397,7 +1397,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3 ...@@ -1397,7 +1397,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1409,7 +1409,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { ...@@ -1409,7 +1409,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1421,7 +1421,7 @@ func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { ...@@ -1421,7 +1421,7 @@ func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1433,7 +1433,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { ...@@ -1433,7 +1433,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1445,7 +1445,7 @@ func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { ...@@ -1445,7 +1445,7 @@ func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1457,7 +1457,7 @@ func listen(s Handle, backlog int32) (err error) { ...@@ -1457,7 +1457,7 @@ func listen(s Handle, backlog int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1469,7 +1469,7 @@ func shutdown(s Handle, how int32) (err error) { ...@@ -1469,7 +1469,7 @@ func shutdown(s Handle, how int32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1481,7 +1481,7 @@ func Closesocket(s Handle) (err error) { ...@@ -1481,7 +1481,7 @@ func Closesocket(s Handle) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1493,7 +1493,7 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32 ...@@ -1493,7 +1493,7 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1510,7 +1510,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 ...@@ -1510,7 +1510,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1522,7 +1522,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, ...@@ -1522,7 +1522,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1534,7 +1534,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui ...@@ -1534,7 +1534,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1546,7 +1546,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 ...@@ -1546,7 +1546,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1564,7 +1564,7 @@ func GetHostByName(name string) (h *Hostent, err error) { ...@@ -1564,7 +1564,7 @@ func GetHostByName(name string) (h *Hostent, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1587,7 +1587,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) { ...@@ -1587,7 +1587,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1611,7 +1611,7 @@ func GetProtoByName(name string) (p *Protoent, err error) { ...@@ -1611,7 +1611,7 @@ func GetProtoByName(name string) (p *Protoent, err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1670,7 +1670,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) ...@@ -1670,7 +1670,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error)
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1683,7 +1683,7 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL ...@@ -1683,7 +1683,7 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1695,7 +1695,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint ...@@ -1695,7 +1695,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1707,7 +1707,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er ...@@ -1707,7 +1707,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1743,7 +1743,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3 ...@@ -1743,7 +1743,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1755,7 +1755,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen ...@@ -1755,7 +1755,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1767,7 +1767,7 @@ func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { ...@@ -1767,7 +1767,7 @@ func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1779,7 +1779,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { ...@@ -1779,7 +1779,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1797,7 +1797,7 @@ func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { ...@@ -1797,7 +1797,7 @@ func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1809,7 +1809,7 @@ func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { ...@@ -1809,7 +1809,7 @@ func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1821,7 +1821,7 @@ func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, ...@@ -1821,7 +1821,7 @@ func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32,
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
...@@ -1833,7 +1833,7 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { ...@@ -1833,7 +1833,7 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
if e1 != 0 { if e1 != 0 {
err = error(e1) err = error(e1)
} else { } else {
err = EINVAL err = syscall.EINVAL
} }
} }
return return
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
package windows package windows
import "syscall"
const ( const (
// Windows errors. // Windows errors.
ERROR_FILE_NOT_FOUND syscall.Errno = 2 ERROR_FILE_NOT_FOUND syscall.Errno = 2
...@@ -176,6 +178,9 @@ const ( ...@@ -176,6 +178,9 @@ const (
CTRL_C_EVENT = 0 CTRL_C_EVENT = 0
CTRL_BREAK_EVENT = 1 CTRL_BREAK_EVENT = 1
// Windows reserves errors >= 1<<29 for application use.
APPLICATION_ERROR = 1 << 29
) )
const ( const (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment