diff --git a/go.mod b/go.mod index d70610e1f..5ffb7a49c 100644 --- a/go.mod +++ b/go.mod @@ -86,7 +86,7 @@ require ( golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a - golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 + golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf golang.org/x/text v0.3.3 // indirect golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e golang.org/x/tools v0.0.0-20200513154647-78b527d18275 // indirect diff --git a/go.sum b/go.sum index b16c2470b..51f131d3c 100644 --- a/go.sum +++ b/go.sum @@ -613,8 +613,8 @@ golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 h1:bNEHhJCnrwMKNMmOx3yAynp5vs5/gRy+XWFtZFu7NBM= -golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf h1:AvBTl0xbF/KtHyvm61X4gSPF7/dKJ/xQqJwKr1Qu9no= +golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 0d72dbb85..197301fb8 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -94,7 +94,6 @@ includes_DragonFly=' #include #include #include -#include #include #include #include diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index f5e91b7ab..613047174 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -62,7 +62,6 @@ const ( B28800 = 0x7080 B300 = 0x12c B38400 = 0x9600 - B460800 = 0x70800 B4800 = 0x12c0 B50 = 0x32 B57600 = 0xe100 @@ -70,15 +69,12 @@ const ( B7200 = 0x1c20 B75 = 0x4b B76800 = 0x12c00 - B921600 = 0xe1000 B9600 = 0x2580 - BIOCFEEDBACK = 0x8004427d BIOCFLUSH = 0x20004268 BIOCGBLEN = 0x40044266 BIOCGDLT = 0x4004426a BIOCGDLTLIST = 0xc0104279 BIOCGETIF = 0x4020426b - BIOCGFEEDBACK = 0x4004427c BIOCGHDRCMPLT = 0x40044274 BIOCGRSIG = 0x40044272 BIOCGRTIMEOUT = 0x4010426e @@ -92,7 +88,6 @@ const ( BIOCSETF = 0x80104267 BIOCSETIF = 0x8020426c BIOCSETWF = 0x8010427b - BIOCSFEEDBACK = 0x8004427d BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044273 BIOCSRTIMEOUT = 0x8010426d @@ -130,7 +125,6 @@ const ( BPF_MINBUFSIZE = 0x20 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 - BPF_MOD = 0x90 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 @@ -145,7 +139,6 @@ const ( BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XOR = 0xa0 BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 @@ -163,12 +156,6 @@ const ( CLOCK_UPTIME_FAST = 0x8 CLOCK_UPTIME_PRECISE = 0x7 CLOCK_VIRTUAL = 0x1 - CPUSTATES = 0x5 - CP_IDLE = 0x4 - CP_INTR = 0x3 - CP_NICE = 0x1 - CP_SYS = 0x2 - CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 @@ -188,7 +175,6 @@ const ( DLT_A429 = 0xb8 DLT_A653_ICM = 0xb9 DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 DLT_ARCNET_LINUX = 0x81 @@ -198,33 +184,22 @@ const ( DLT_AX25 = 0x3 DLT_AX25_KISS = 0xca DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_BREDR_BB = 0xff DLT_BLUETOOTH_HCI_H4 = 0xbb DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_BLUETOOTH_LE_LL = 0xfb - DLT_BLUETOOTH_LE_LL_WITH_PHDR = 0x100 - DLT_BLUETOOTH_LINUX_MONITOR = 0xfe DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 DLT_CHDLC = 0x68 DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 DLT_ENC = 0x6d - DLT_EPON = 0x103 DLT_ERF = 0xc5 DLT_ERF_ETH = 0xaf DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa DLT_FLEXRAY = 0xd2 DLT_FRELAY = 0x6b @@ -234,8 +209,6 @@ const ( DLT_GPF_F = 0xab DLT_GPF_T = 0xaa DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 DLT_HHDLC = 0x79 DLT_IBM_SN = 0x92 DLT_IBM_SP = 0x91 @@ -245,28 +218,18 @@ const ( DLT_IEEE802_11_RADIO_AVS = 0xa3 DLT_IEEE802_15_4 = 0xc3 DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 DLT_IEEE802_15_4_NONASK_PHY = 0xd7 DLT_IEEE802_16_MAC_CPS = 0xbc DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_INFINIBAND = 0xf7 DLT_IPFILTER = 0x74 DLT_IPMB = 0xc7 DLT_IPMB_LINUX = 0xd1 - DLT_IPMI_HPM_2 = 0x104 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 DLT_IP_OVER_FC = 0x7a - DLT_ISO_14443 = 0x108 DLT_JUNIPER_ATM1 = 0x89 DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee DLT_JUNIPER_CHDLC = 0xb5 DLT_JUNIPER_ES = 0x84 DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea DLT_JUNIPER_FRELAY = 0xb4 DLT_JUNIPER_GGSN = 0x85 DLT_JUNIPER_ISM = 0xc2 @@ -279,40 +242,25 @@ const ( DLT_JUNIPER_PPPOE = 0xa7 DLT_JUNIPER_PPPOE_ATM = 0xa8 DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 DLT_JUNIPER_ST = 0xc8 DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 DLT_LAPB_WITH_DIR = 0xcf DLT_LAPD = 0xcb DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 DLT_LINUX_IRDA = 0x90 DLT_LINUX_LAPD = 0xb1 DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x109 - DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb DLT_MTP2 = 0x8c DLT_MTP2_WITH_PHDR = 0x8b DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NETLINK = 0xfd - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 DLT_NULL = 0x0 DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 - DLT_PKTAP = 0x102 DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0x10 @@ -321,51 +269,22 @@ const ( DLT_PPP_SERIAL = 0x32 DLT_PPP_WITH_DIR = 0xcc DLT_PRISM_HEADER = 0x77 - DLT_PROFIBUS_DL = 0x101 DLT_PRONET = 0x4 DLT_RAIF1 = 0xc6 DLT_RAW = 0xc - DLT_RDS = 0x109 DLT_REDBACK_SMARTEDGE = 0x20 DLT_RIO = 0x7c - DLT_RTAC_SERIAL = 0xfa DLT_SCCP = 0x8e - DLT_SCTP = 0xf8 DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed DLT_SUNATM = 0x7b DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba - DLT_USBPCAP = 0xf9 - DLT_USB_FREEBSD = 0xba DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WATTSTOPPER_DLM = 0x107 - DLT_WIHART = 0xdf - DLT_WIRESHARK_UPPER_PDU = 0xfc DLT_X2E_SERIAL = 0xd5 DLT_X2E_XORAYA = 0xd6 - DLT_ZWAVE_R1_R2 = 0x105 - DLT_ZWAVE_R3 = 0x106 DT_BLK = 0x6 DT_CHR = 0x2 DT_DBF = 0xf @@ -404,11 +323,10 @@ const ( EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG1 = 0x2000 - EV_HUP = 0x800 EV_NODATA = 0x1000 EV_ONESHOT = 0x10 EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf800 + EV_SYSFLAGS = 0xf000 EXTA = 0x4b00 EXTB = 0x9600 EXTEXIT_LWP = 0x10000 @@ -447,9 +365,8 @@ const ( IFF_ALLMULTI = 0x200 IFF_ALTPHYS = 0x4000 IFF_BROADCAST = 0x2 - IFF_CANTCHANGE = 0x318e72 + IFF_CANTCHANGE = 0x118e72 IFF_DEBUG = 0x4 - IFF_IDIRECT = 0x200000 IFF_LINK0 = 0x1000 IFF_LINK1 = 0x2000 IFF_LINK2 = 0x4000 @@ -524,6 +441,7 @@ const ( IFT_EPLRS = 0x57 IFT_ESCON = 0x49 IFT_ETHER = 0x6 + IFT_FAITH = 0xf2 IFT_FAST = 0x7d IFT_FASTETHER = 0x3e IFT_FASTETHERFX = 0x45 @@ -696,7 +614,6 @@ const ( IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c IN_LOOPBACKNET = 0x7f - IN_RFC3021_MASK = 0xfffffffe IPPROTO_3PC = 0x22 IPPROTO_ADFS = 0x44 IPPROTO_AH = 0x33 @@ -818,6 +735,7 @@ const ( IPV6_DEFHLIM = 0x40 IPV6_DONTFRAG = 0x3e IPV6_DSTOPTS = 0x32 + IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FRAGTTL = 0x78 @@ -829,6 +747,7 @@ const ( IPV6_HLIMDEC = 0x1 IPV6_HOPLIMIT = 0x2f IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff @@ -876,22 +795,16 @@ const ( IP_DUMMYNET_DEL = 0x3d IP_DUMMYNET_FLUSH = 0x3e IP_DUMMYNET_GET = 0x40 + IP_FAITH = 0x16 IP_FW_ADD = 0x32 IP_FW_DEL = 0x33 IP_FW_FLUSH = 0x34 IP_FW_GET = 0x36 IP_FW_RESETLOG = 0x37 - IP_FW_TBL_ADD = 0x2a - IP_FW_TBL_CREATE = 0x28 - IP_FW_TBL_DEL = 0x2b - IP_FW_TBL_DESTROY = 0x29 - IP_FW_TBL_EXPIRE = 0x2f - IP_FW_TBL_FLUSH = 0x2c - IP_FW_TBL_GET = 0x2d - IP_FW_TBL_ZERO = 0x2e IP_FW_X = 0x31 IP_FW_ZERO = 0x35 IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x15 IP_MAXPACKET = 0xffff IP_MAX_MEMBERSHIPS = 0x14 IP_MF = 0x2000 @@ -1167,10 +1080,12 @@ const ( RTM_MISS = 0x7 RTM_NEWADDR = 0xc RTM_NEWMADDR = 0xf + RTM_OLDADD = 0x9 + RTM_OLDDEL = 0xa RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x7 + RTM_VERSION = 0x6 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 RTV_IWCAPSEGS = 0x400 @@ -1191,13 +1106,13 @@ const ( SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 + SIOCADDRT = 0x8040720a SIOCAIFADDR = 0x8040691a - SIOCAIFGROUP = 0x80286987 SIOCALIFADDR = 0x8118691b SIOCATMARK = 0x40047307 SIOCDELMULTI = 0x80206932 + SIOCDELRT = 0x8040720b SIOCDIFADDR = 0x80206919 - SIOCDIFGROUP = 0x80286989 SIOCDIFPHYADDR = 0x80206949 SIOCDLIFADDR = 0x8118691d SIOCGDRVSPEC = 0xc028697b @@ -1205,7 +1120,6 @@ const ( SIOCGETVIFCNT = 0xc028720f SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 - SIOCGIFALIAS = 0xc0406929 SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020691f SIOCGIFCONF = 0xc0106924 @@ -1214,7 +1128,6 @@ const ( SIOCGIFFLAGS = 0xc0206911 SIOCGIFGENERIC = 0xc020693a SIOCGIFGMEMB = 0xc028698a - SIOCGIFGROUP = 0xc0286988 SIOCGIFINDEX = 0xc0206920 SIOCGIFMEDIA = 0xc0306938 SIOCGIFMETRIC = 0xc0206917 @@ -1281,7 +1194,6 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 - SO_RERROR = 0x2000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_SNDBUF = 0x1001 @@ -1321,9 +1233,6 @@ const ( S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 - TAB0 = 0x0 - TAB3 = 0x4 - TABDLY = 0x4 TCIFLUSH = 0x1 TCIOFF = 0x3 TCIOFLUSH = 0x3 @@ -1350,8 +1259,6 @@ const ( TCP_NOPUSH = 0x4 TCP_SIGNATURE_ENABLE = 0x10 TCSAFLUSH = 0x2 - TIMER_ABSTIME = 0x1 - TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 @@ -1365,6 +1272,7 @@ const ( TIOCGETD = 0x4004741a TIOCGPGRP = 0x40047477 TIOCGSID = 0x40047463 + TIOCGSIZE = 0x40087468 TIOCGWINSZ = 0x40087468 TIOCISPTMASTER = 0x20007455 TIOCMBIC = 0x8004746b @@ -1409,6 +1317,7 @@ const ( TIOCSETD = 0x8004741b TIOCSIG = 0x2000745f TIOCSPGRP = 0x80047476 + TIOCSSIZE = 0x80087467 TIOCSTART = 0x2000746e TIOCSTAT = 0x20007465 TIOCSTI = 0x80017472 @@ -1417,8 +1326,6 @@ const ( TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 - UTIME_NOW = -0x1 - UTIME_OMIT = -0x2 VCHECKPT = 0x13 VDISCARD = 0xf VDSUSP = 0xb @@ -1443,12 +1350,9 @@ const ( VWERASE = 0x4 WCONTINUED = 0x4 WCOREFLAG = 0x80 - WEXITED = 0x10 WLINUXCLONE = 0x80000000 WNOHANG = 0x1 - WNOWAIT = 0x8 - WSTOPPED = 0x2 - WTRAPPED = 0x20 + WSTOPPED = 0x7f WUNTRACED = 0x2 ) @@ -1548,6 +1452,11 @@ const ( ETIMEDOUT = syscall.Errno(0x3c) ETOOMANYREFS = syscall.Errno(0x3b) ETXTBSY = syscall.Errno(0x1a) + EUNUSED94 = syscall.Errno(0x5e) + EUNUSED95 = syscall.Errno(0x5f) + EUNUSED96 = syscall.Errno(0x60) + EUNUSED97 = syscall.Errno(0x61) + EUNUSED98 = syscall.Errno(0x62) EUSERS = syscall.Errno(0x44) EWOULDBLOCK = syscall.Errno(0x23) EXDEV = syscall.Errno(0x12) @@ -1691,7 +1600,12 @@ var errorList = [...]struct { {91, "ENOLINK", "link has been severed"}, {92, "EPROTO", "protocol error"}, {93, "ENOMEDIUM", "no medium found"}, - {99, "EASYNC", "unknown error: 99"}, + {94, "EUNUSED94", "unknown error: 94"}, + {95, "EUNUSED95", "unknown error: 95"}, + {96, "EUNUSED96", "unknown error: 96"}, + {97, "EUNUSED97", "unknown error: 97"}, + {98, "EUNUSED98", "unknown error: 98"}, + {99, "ELAST", "unknown error: 99"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index aebfe511a..fe1fdd78d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -214,6 +214,22 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimes(path string, timeval *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -423,22 +439,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 9912c6ee3..464c9a983 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -6,125 +6,129 @@ package unix const ( - SYS_EXIT = 1 // { void exit(int rval); } - SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } - SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int - // SYS_NOSYS = 8; // { int nosys(void); } __nosys nosys_args int - SYS_LINK = 9 // { int link(char *path, char *link); } - SYS_UNLINK = 10 // { int unlink(char *path); } - SYS_CHDIR = 12 // { int chdir(char *path); } - SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } - SYS_CHMOD = 15 // { int chmod(char *path, int mode); } - SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int - SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } - SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } - SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } - SYS_SETUID = 23 // { int setuid(uid_t uid); } - SYS_GETUID = 24 // { uid_t getuid(void); } - SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, int *anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, int *alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, int *alen); } - SYS_ACCESS = 33 // { int access(char *path, int flags); } - SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } - SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } - SYS_SYNC = 36 // { int sync(void); } - SYS_KILL = 37 // { int kill(int pid, int signum); } - SYS_GETPPID = 39 // { pid_t getppid(void); } - SYS_DUP = 41 // { int dup(int fd); } - SYS_PIPE = 42 // { int pipe(void); } - SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, u_long offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } - SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, size_t namelen); } - SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } - SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } - SYS_REBOOT = 55 // { int reboot(int opt); } - SYS_REVOKE = 56 // { int revoke(char *path); } - SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int - SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } - SYS_VFORK = 66 // { pid_t vfork(void); } - SYS_SBRK = 69 // { caddr_t sbrk(size_t incr); } - SYS_SSTK = 70 // { int sstk(size_t incr); } - SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } - SYS_GETPGRP = 81 // { int getpgrp(void); } - SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } - SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } - SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } - SYS_DUP2 = 90 // { int dup2(int from, int to); } - SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } - SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } - SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } - SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } - SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } - SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } - SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } - SYS_RENAME = 128 // { int rename(char *from, char *to); } - SYS_FLOCK = 131 // { int flock(int fd, int how); } - SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } - SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } - SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } - SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } - SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } - SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } - SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } - SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); } - SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); } - SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } - SYS_SETGID = 181 // { int setgid(gid_t gid); } - SYS_SETEGID = 182 // { int setegid(gid_t egid); } - SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } - SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } + // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int + SYS_EXIT = 1 // { void exit(int rval); } + SYS_FORK = 2 // { int fork(void); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } + SYS_CLOSE = 6 // { int close(int fd); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int + SYS_LINK = 9 // { int link(char *path, char *link); } + SYS_UNLINK = 10 // { int unlink(char *path); } + SYS_CHDIR = 12 // { int chdir(char *path); } + SYS_FCHDIR = 13 // { int fchdir(int fd); } + SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } + SYS_CHMOD = 15 // { int chmod(char *path, int mode); } + SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } + SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } + SYS_GETPID = 20 // { pid_t getpid(void); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } + SYS_SETUID = 23 // { int setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t getuid(void); } + SYS_GETEUID = 25 // { uid_t geteuid(void); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); } + SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, int *anamelen); } + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, int *alen); } + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, int *alen); } + SYS_ACCESS = 33 // { int access(char *path, int flags); } + SYS_CHFLAGS = 34 // { int chflags(char *path, int flags); } + SYS_FCHFLAGS = 35 // { int fchflags(int fd, int flags); } + SYS_SYNC = 36 // { int sync(void); } + SYS_KILL = 37 // { int kill(int pid, int signum); } + SYS_GETPPID = 39 // { pid_t getppid(void); } + SYS_DUP = 41 // { int dup(int fd); } + SYS_PIPE = 42 // { int pipe(void); } + SYS_GETEGID = 43 // { gid_t getegid(void); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_GETGID = 47 // { gid_t getgid(void); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } + SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } + SYS_ACCT = 51 // { int acct(char *path); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_REBOOT = 55 // { int reboot(int opt); } + SYS_REVOKE = 56 // { int revoke(char *path); } + SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } + SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_CHROOT = 61 // { int chroot(char *path); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_VFORK = 66 // { pid_t vfork(void); } + SYS_SBRK = 69 // { int sbrk(int incr); } + SYS_SSTK = 70 // { int sstk(int incr); } + SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_GETPGRP = 81 // { int getpgrp(void); } + SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SWAPON = 85 // { int swapon(char *name); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } + SYS_DUP2 = 90 // { int dup2(int from, int to); } + SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_FSYNC = 95 // { int fsync(int fd); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } + SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_LISTEN = 106 // { int listen(int s, int backlog); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } + SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } + SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } + SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } + SYS_RENAME = 128 // { int rename(char *from, char *to); } + SYS_FLOCK = 131 // { int flock(int fd, int how); } + SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } + SYS_RMDIR = 137 // { int rmdir(char *path); } + SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_SETSID = 147 // { int setsid(void); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_GETDOMAINNAME = 162 // { int getdomainname(char *domainname, int len); } + SYS_SETDOMAINNAME = 163 // { int setdomainname(char *domainname, int len); } + SYS_UNAME = 164 // { int uname(struct utsname *name); } + SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } + SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); } + SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); } + SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } + SYS_SETGID = 181 // { int setgid(gid_t gid); } + SYS_SETEGID = 182 // { int setegid(gid_t egid); } + SYS_SETEUID = 183 // { int seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } + SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int + SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } + // SYS_NOSYS = 198; // { int nosys(void); } __syscall __syscall_args int SYS_LSEEK = 199 // { off_t lseek(int fd, int pad, off_t offset, int whence); } SYS_TRUNCATE = 200 // { int truncate(char *path, int pad, off_t length); } SYS_FTRUNCATE = 201 // { int ftruncate(int fd, int pad, off_t length); } @@ -157,8 +161,8 @@ const ( SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); } - SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); } + SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, struct iovec *iovp, u_int iovcnt, int flags, off_t offset); } + SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, struct iovec *iovp,u_int iovcnt, int flags, off_t offset); } SYS_FHSTATFS = 297 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } SYS_MODNEXT = 300 // { int modnext(int modid); } @@ -221,7 +225,7 @@ const ( SYS_KQUEUE = 362 // { int kqueue(void); } SYS_KEVENT = 363 // { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } - SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } + SYS_LCHFLAGS = 391 // { int lchflags(char *path, int flags); } SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_VARSYM_SET = 450 // { int varsym_set(int level, const char *name, const char *data); } @@ -298,7 +302,7 @@ const ( SYS_VMM_GUEST_CTL = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); } SYS_VMM_GUEST_SYNC_ADDR = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); } SYS_PROCCTL = 536 // { int procctl(idtype_t idtype, id_t id, int cmd, void *data); } - SYS_CHFLAGSAT = 537 // { int chflagsat(int fd, const char *path, u_long flags, int atflags);} + SYS_CHFLAGSAT = 537 // { int chflagsat(int fd, const char *path, int flags, int atflags);} SYS_PIPE2 = 538 // { int pipe2(int *fildes, int flags); } SYS_UTIMENSAT = 539 // { int utimensat(int fd, const char *path, const struct timespec *ts, int flags); } SYS_FUTIMENS = 540 // { int futimens(int fd, const struct timespec *ts); } @@ -308,9 +312,4 @@ const ( SYS_LWP_SETAFFINITY = 544 // { int lwp_setaffinity(pid_t pid, lwpid_t tid, const cpumask_t *mask); } SYS_LWP_GETAFFINITY = 545 // { int lwp_getaffinity(pid_t pid, lwpid_t tid, cpumask_t *mask); } SYS_LWP_CREATE2 = 546 // { int lwp_create2(struct lwp_params *params, const cpumask_t *mask); } - SYS_GETCPUCLOCKID = 547 // { int getcpuclockid(pid_t pid, lwpid_t lwp_id, clockid_t *clock_id); } - SYS_WAIT6 = 548 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } - SYS_LWP_GETNAME = 549 // { int lwp_getname(lwpid_t tid, char *name, size_t len); } - SYS_GETRANDOM = 550 // { ssize_t getrandom(void *buf, size_t len, unsigned flags); } - SYS___REALPATH = 551 // { ssize_t __realpath(const char *path, char *buf, size_t len); } ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go index dd56ab84a..6103f2150 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go @@ -92,9 +92,9 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]byte - Mntonname [1024]byte - Mntfromname [1024]byte + Fstypename [16]int8 + Mntonname [1024]int8 + Mntfromname [1024]int8 Reserved [8]uint32 } @@ -305,6 +305,7 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Data IfData } @@ -347,6 +348,7 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Metric int32 } @@ -367,6 +369,7 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Refcount int32 } @@ -375,6 +378,7 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 + _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -396,8 +400,7 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - State uint32 - Filler [3]uint32 + Filler [4]uint32 } const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 1f82f2b51..e6576d1c4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -70,6 +70,7 @@ type Stat_t struct { Uid uint32 Gid uint32 Rdev int32 + _ [4]byte Atim Timespec Mtim Timespec Ctim Timespec @@ -96,11 +97,10 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]byte - Mntonname [1024]byte - Mntfromname [1024]byte - Flags_ext uint32 - Reserved [7]uint32 + Fstypename [16]int8 + Mntonname [1024]int8 + Mntfromname [1024]int8 + Reserved [8]uint32 } type Flock_t struct { @@ -133,7 +133,8 @@ type Fbootstraptransfer_t struct { type Log2phys_t struct { Flags uint32 - _ [16]byte + _ [8]byte + _ [8]byte } type Fsid struct { @@ -224,8 +225,10 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen int32 + _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -310,6 +313,7 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Data IfData } @@ -352,6 +356,7 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Metric int32 } @@ -372,6 +377,7 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Refcount int32 } @@ -380,6 +386,7 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 + _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -401,8 +408,7 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - State uint32 - Filler [3]uint32 + Filler [4]uint32 } const ( @@ -425,6 +431,7 @@ type BpfStat struct { type BpfProgram struct { Len uint32 + _ [4]byte Insns *BpfInsn } @@ -449,6 +456,7 @@ type Termios struct { Cflag uint64 Lflag uint64 Cc [20]uint8 + _ [4]byte Ispeed uint64 Ospeed uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go index 3af01a49f..af9560fa1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go @@ -1,5 +1,6 @@ -// cgo -godefs types_darwin.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. +// NOTE: cgo can't generate struct Stat_t and struct Statfs_t yet +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_darwin.go // +build arm,darwin @@ -30,7 +31,7 @@ type Timeval struct { Usec int32 } -type Timeval32 struct{} +type Timeval32 [0]byte type Rusage struct { Utime Timeval @@ -92,9 +93,9 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]byte - Mntonname [1024]byte - Mntfromname [1024]byte + Fstypename [16]int8 + Mntonname [1024]int8 + Mntfromname [1024]int8 Reserved [8]uint32 } @@ -305,6 +306,7 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Data IfData } @@ -347,6 +349,7 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Metric int32 } @@ -367,6 +370,7 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Refcount int32 } @@ -375,6 +379,7 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 + _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -396,8 +401,7 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - State uint32 - Filler [3]uint32 + Filler [4]uint32 } const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index ff437386b..a09c0f942 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -70,6 +70,7 @@ type Stat_t struct { Uid uint32 Gid uint32 Rdev int32 + _ [4]byte Atim Timespec Mtim Timespec Ctim Timespec @@ -96,11 +97,10 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]byte - Mntonname [1024]byte - Mntfromname [1024]byte - Flags_ext uint32 - Reserved [7]uint32 + Fstypename [16]int8 + Mntonname [1024]int8 + Mntfromname [1024]int8 + Reserved [8]uint32 } type Flock_t struct { @@ -133,7 +133,8 @@ type Fbootstraptransfer_t struct { type Log2phys_t struct { Flags uint32 - _ [16]byte + _ [8]byte + _ [8]byte } type Fsid struct { @@ -224,8 +225,10 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen int32 + _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -310,6 +313,7 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Data IfData } @@ -352,6 +356,7 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Metric int32 } @@ -372,6 +377,7 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 + _ [2]byte Refcount int32 } @@ -380,6 +386,7 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 + _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -401,8 +408,7 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - State uint32 - Filler [3]uint32 + Filler [4]uint32 } const ( @@ -425,6 +431,7 @@ type BpfStat struct { type BpfProgram struct { Len uint32 + _ [4]byte Insns *BpfInsn } @@ -449,6 +456,7 @@ type Termios struct { Cflag uint64 Lflag uint64 Cc [20]uint8 + _ [4]byte Ispeed uint64 Ospeed uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index c4772df23..71ea1d6d2 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -70,11 +70,11 @@ type Stat_t struct { Ctim Timespec Size int64 Blocks int64 - _ uint32 + Blksize uint32 Flags uint32 Gen uint32 Lspare int32 - Blksize int64 + Qspare1 int64 Qspare2 int64 } @@ -91,15 +91,17 @@ type Statfs_t struct { Owner uint32 Type int32 Flags int32 + _ [4]byte Syncwrites int64 Asyncwrites int64 - Fstypename [16]byte - Mntonname [80]byte + Fstypename [16]int8 + Mntonname [80]int8 Syncreads int64 Asyncreads int64 Spares1 int16 - Mntfromname [80]byte + Mntfromname [80]int8 Spares2 int16 + _ [4]byte Spare [2]int64 } @@ -200,8 +202,10 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen int32 + _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -265,7 +269,7 @@ type FdSet struct { const ( SizeofIfMsghdr = 0xb0 SizeofIfData = 0xa0 - SizeofIfaMsghdr = 0x18 + SizeofIfaMsghdr = 0x14 SizeofIfmaMsghdr = 0x10 SizeofIfAnnounceMsghdr = 0x18 SizeofRtMsghdr = 0x98 @@ -276,9 +280,10 @@ type IfMsghdr struct { Msglen uint16 Version uint8 Type uint8 - Index uint16 - Flags int32 Addrs int32 + Flags int32 + Index uint16 + _ [2]byte Data IfData } @@ -289,6 +294,7 @@ type IfData struct { Hdrlen uint8 Recvquota uint8 Xmitquota uint8 + _ [2]byte Mtu uint64 Metric uint64 Link_state uint64 @@ -310,23 +316,24 @@ type IfData struct { } type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Flags int32 - Addrs int32 - Addrflags int32 - Metric int32 + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + _ [2]byte + Metric int32 } type IfmaMsghdr struct { Msglen uint16 Version uint8 Type uint8 - Index uint16 - Flags int32 Addrs int32 + Flags int32 + Index uint16 + _ [2]byte } type IfAnnounceMsghdr struct { @@ -343,6 +350,7 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 + _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -366,6 +374,7 @@ type RtMetrics struct { Hopcount uint64 Mssopt uint16 Pad uint16 + _ [4]byte Msl uint64 Iwmaxsegs uint64 Iwcapsegs uint64 @@ -391,6 +400,7 @@ type BpfStat struct { type BpfProgram struct { Len uint32 + _ [4]byte Insns *BpfInsn } diff --git a/vendor/golang.org/x/sys/windows/svc/security.go b/vendor/golang.org/x/sys/windows/svc/security.go index da6df1d3c..65025998d 100644 --- a/vendor/golang.org/x/sys/windows/svc/security.go +++ b/vendor/golang.org/x/sys/windows/svc/security.go @@ -7,10 +7,6 @@ package svc import ( - "errors" - "syscall" - "unsafe" - "golang.org/x/sys/windows" ) @@ -27,8 +23,6 @@ func allocSid(subAuth0 uint32) (*windows.SID, error) { // IsAnInteractiveSession determines if calling process is running interactively. // It queries the process token for membership in the Interactive group. // http://stackoverflow.com/questions/2668851/how-do-i-detect-that-my-application-is-running-as-service-or-in-an-interactive-s -// -// Deprecated: Use IsWindowsService instead. func IsAnInteractiveSession() (bool, error) { interSid, err := allocSid(windows.SECURITY_INTERACTIVE_RID) if err != nil { @@ -63,95 +57,3 @@ func IsAnInteractiveSession() (bool, error) { } return false, nil } - -var ( - ntdll = windows.NewLazySystemDLL("ntdll.dll") - _NtQueryInformationProcess = ntdll.NewProc("NtQueryInformationProcess") - - kernel32 = windows.NewLazySystemDLL("kernel32.dll") - _QueryFullProcessImageNameA = kernel32.NewProc("QueryFullProcessImageNameA") -) - -// IsWindowsService reports whether the process is currently executing -// as a Windows service. -func IsWindowsService() (bool, error) { - // This code was copied from runtime.isWindowsService function. - - // The below technique looks a bit hairy, but it's actually - // exactly what the .NET framework does for the similarly named function: - // https://github.com/dotnet/extensions/blob/f4066026ca06984b07e90e61a6390ac38152ba93/src/Hosting/WindowsServices/src/WindowsServiceHelpers.cs#L26-L31 - // Specifically, it looks up whether the parent process has session ID zero - // and is called "services". - const _CURRENT_PROCESS = ^uintptr(0) - // pbi is a PROCESS_BASIC_INFORMATION struct, where we just care about - // the 6th pointer inside of it, which contains the pid of the process - // parent: - // https://github.com/wine-mirror/wine/blob/42cb7d2ad1caba08de235e6319b9967296b5d554/include/winternl.h#L1294 - var pbi [6]uintptr - var pbiLen uint32 - r0, _, _ := syscall.Syscall6(_NtQueryInformationProcess.Addr(), 5, _CURRENT_PROCESS, 0, uintptr(unsafe.Pointer(&pbi[0])), uintptr(unsafe.Sizeof(pbi)), uintptr(unsafe.Pointer(&pbiLen)), 0) - if r0 != 0 { - return false, errors.New("NtQueryInformationProcess failed: error=" + itoa(int(r0))) - } - var psid uint32 - err := windows.ProcessIdToSessionId(uint32(pbi[5]), &psid) - if err != nil { - return false, err - } - if psid != 0 { - // parent session id should be 0 for service process - return false, nil - } - - pproc, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pbi[5])) - if err != nil { - return false, err - } - defer windows.CloseHandle(pproc) - - // exeName gets the path to the executable image of the parent process - var exeName [261]byte - exeNameLen := uint32(len(exeName) - 1) - r0, _, e0 := syscall.Syscall6(_QueryFullProcessImageNameA.Addr(), 4, uintptr(pproc), 0, uintptr(unsafe.Pointer(&exeName[0])), uintptr(unsafe.Pointer(&exeNameLen)), 0, 0) - if r0 == 0 { - if e0 != 0 { - return false, e0 - } else { - return false, syscall.EINVAL - } - } - const ( - servicesLower = "services.exe" - servicesUpper = "SERVICES.EXE" - ) - i := int(exeNameLen) - 1 - j := len(servicesLower) - 1 - if i < j { - return false, nil - } - for { - if j == -1 { - return i == -1 || exeName[i] == '\\', nil - } - if exeName[i] != servicesLower[j] && exeName[i] != servicesUpper[j] { - return false, nil - } - i-- - j-- - } -} - -func itoa(val int) string { // do it here rather than with fmt to avoid dependency - if val < 0 { - return "-" + itoa(-val) - } - var buf [32]byte // big enough for int64 - i := len(buf) - 1 - for val >= 10 { - buf[i] = byte(val%10 + '0') - i-- - val /= 10 - } - buf[i] = byte(val + '0') - return string(buf[i:]) -} diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index bbd075dfe..30ef6410f 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -270,7 +270,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW //sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW //sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId -//sys ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId //sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo @@ -390,7 +389,11 @@ func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), ordinal, 0) proc = uintptr(r0) if proc == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1087,7 +1090,11 @@ func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlap } r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return err } @@ -1099,7 +1106,11 @@ func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overl } r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return err } diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 17133e600..f1ae76b38 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -24,7 +24,7 @@ var ( func errnoErr(e syscall.Errno) error { switch e { case 0: - return syscall.EINVAL + return nil case errnoERROR_IO_PENDING: return errERROR_IO_PENDING } @@ -180,7 +180,6 @@ var ( procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW") procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW") procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") - procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId") procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") @@ -365,7 +364,11 @@ func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Hand r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -373,7 +376,11 @@ func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Hand func DeregisterEventSource(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -381,7 +388,11 @@ func DeregisterEventSource(handle Handle) (err error) { func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) { r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -390,7 +401,11 @@ func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (ha r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -398,7 +413,11 @@ func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (ha func CloseServiceHandle(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -407,7 +426,11 @@ func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -416,7 +439,11 @@ func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -424,7 +451,11 @@ func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, func DeleteService(service Handle) (err error) { r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -432,7 +463,11 @@ func DeleteService(service Handle) (err error) { func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) { r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -440,7 +475,11 @@ func StartService(service Handle, numArgs uint32, argVectors **uint16) (err erro func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -448,7 +487,11 @@ func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -456,7 +499,11 @@ func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, b func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -464,7 +511,11 @@ func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -472,7 +523,11 @@ func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) { r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -480,7 +535,11 @@ func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) { r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -488,7 +547,11 @@ func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, e func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -496,7 +559,11 @@ func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, buf func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) { r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -504,7 +571,11 @@ func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err err func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -512,7 +583,11 @@ func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -520,7 +595,11 @@ func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serv func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -554,7 +633,11 @@ func _LoadLibrary(libname *uint16) (handle Handle, err error) { r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -572,7 +655,11 @@ func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -580,7 +667,11 @@ func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, func FreeLibrary(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -598,7 +689,11 @@ func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) proc = uintptr(r0) if proc == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -607,7 +702,11 @@ func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -615,7 +714,11 @@ func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) { r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -624,7 +727,11 @@ func GetVersion() (ver uint32, err error) { r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0) ver = uint32(r0) if ver == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -637,7 +744,11 @@ func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -651,11 +762,17 @@ func IsWow64Process(handle Handle, isWow64 *bool) (err error) { var _p0 uint32 if *isWow64 { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0) *isWow64 = _p0 != 0 if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -664,7 +781,11 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -676,7 +797,11 @@ func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( } r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -688,7 +813,11 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) } r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -697,10 +826,16 @@ func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wa var _p0 uint32 if wait { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -709,7 +844,11 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) newlowoffset = uint32(r0) if newlowoffset == 0xffffffff { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -717,7 +856,11 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence func CloseHandle(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -726,7 +869,11 @@ func GetStdHandle(stdhandle uint32) (handle Handle, err error) { r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -734,7 +881,11 @@ func GetStdHandle(stdhandle uint32) (handle Handle, err error) { func SetStdHandle(stdhandle uint32, handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -743,7 +894,11 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -751,7 +906,11 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro func findNextFile1(handle Handle, data *win32finddata1) (err error) { r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -759,7 +918,11 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) { func FindClose(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -767,7 +930,11 @@ func FindClose(handle Handle) (err error) { func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -775,7 +942,11 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -784,7 +955,11 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -792,7 +967,11 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { func SetCurrentDirectory(path *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -800,7 +979,11 @@ func SetCurrentDirectory(path *uint16) (err error) { func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -808,7 +991,11 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { func RemoveDirectory(path *uint16) (err error) { r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -816,7 +1003,11 @@ func RemoveDirectory(path *uint16) (err error) { func DeleteFile(path *uint16) (err error) { r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -824,7 +1015,11 @@ func DeleteFile(path *uint16) (err error) { func MoveFile(from *uint16, to *uint16) (err error) { r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -832,7 +1027,11 @@ func MoveFile(from *uint16, to *uint16) (err error) { func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -840,7 +1039,11 @@ func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -848,7 +1051,11 @@ func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, byt func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -856,7 +1063,11 @@ func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint3 func GetComputerName(buf *uint16, n *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -864,7 +1075,11 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -872,7 +1087,11 @@ func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { func SetEndOfFile(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -891,7 +1110,11 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) rc = uint32(r0) if rc == 0xffffffff { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -900,7 +1123,11 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, thre r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -908,7 +1135,11 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, thre func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -916,7 +1147,11 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overla func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -924,7 +1159,11 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlap func CancelIo(s Handle) (err error) { r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -932,7 +1171,11 @@ func CancelIo(s Handle) (err error) { func CancelIoEx(s Handle, o *Overlapped) (err error) { r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -941,10 +1184,16 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA var _p0 uint32 if inheritHandles { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -953,11 +1202,17 @@ func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (ha var _p0 uint32 if inheritHandle { _p0 = 1 + } else { + _p0 = 0 } r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -965,7 +1220,11 @@ func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (ha func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) if r1 <= 32 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -981,7 +1240,11 @@ func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **u func TerminateProcess(handle Handle, exitcode uint32) (err error) { r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -989,7 +1252,11 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) { func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -997,7 +1264,11 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { func GetStartupInfo(startupInfo *StartupInfo) (err error) { r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1005,7 +1276,11 @@ func GetStartupInfo(startupInfo *StartupInfo) (err error) { func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1014,10 +1289,16 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP var _p0 uint32 if bInheritHandle { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1026,7 +1307,11 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) event = uint32(r0) if event == 0xffffffff { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1035,11 +1320,17 @@ func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMil var _p0 uint32 if waitAll { _p0 = 1 + } else { + _p0 = 0 } r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) event = uint32(r0) if event == 0xffffffff { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1048,7 +1339,11 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1056,7 +1351,11 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1065,7 +1364,11 @@ func GetFileType(filehandle Handle) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1073,7 +1376,11 @@ func GetFileType(filehandle Handle) (n uint32, err error) { func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1081,7 +1388,11 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1089,7 +1400,11 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1098,7 +1413,11 @@ func GetEnvironmentStrings() (envs *uint16, err error) { r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) envs = (*uint16)(unsafe.Pointer(r0)) if envs == nil { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1106,7 +1425,11 @@ func GetEnvironmentStrings() (envs *uint16, err error) { func FreeEnvironmentStrings(envs *uint16) (err error) { r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1115,7 +1438,11 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1123,7 +1450,11 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1132,10 +1463,16 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( var _p0 uint32 if inheritExisting { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1143,7 +1480,11 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( func DestroyEnvironmentBlock(block *uint16) (err error) { r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1157,7 +1498,11 @@ func getTickCount64() (ms uint64) { func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1166,7 +1511,11 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) attrs = uint32(r0) if attrs == INVALID_FILE_ATTRIBUTES { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1174,7 +1523,11 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { func SetFileAttributes(name *uint16, attrs uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1182,7 +1535,11 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) { func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1197,7 +1554,11 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) if argv == nil { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1206,7 +1567,11 @@ func LocalFree(hmem Handle) (handle Handle, err error) { r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) handle = Handle(r0) if handle != 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1214,7 +1579,11 @@ func LocalFree(hmem Handle) (handle Handle, err error) { func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1222,7 +1591,11 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) func FlushFileBuffers(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1231,7 +1604,11 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1240,7 +1617,11 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1249,7 +1630,11 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1258,7 +1643,11 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1267,7 +1656,11 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) addr = uintptr(r0) if addr == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1275,7 +1668,11 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui func UnmapViewOfFile(addr uintptr) (err error) { r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1283,7 +1680,11 @@ func UnmapViewOfFile(addr uintptr) (err error) { func FlushViewOfFile(addr uintptr, length uintptr) (err error) { r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1291,7 +1692,11 @@ func FlushViewOfFile(addr uintptr, length uintptr) (err error) { func VirtualLock(addr uintptr, length uintptr) (err error) { r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1299,7 +1704,11 @@ func VirtualLock(addr uintptr, length uintptr) (err error) { func VirtualUnlock(addr uintptr, length uintptr) (err error) { r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1308,7 +1717,11 @@ func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint3 r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) value = uintptr(r0) if value == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1316,7 +1729,11 @@ func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint3 func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1324,7 +1741,11 @@ func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1332,7 +1753,11 @@ func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1341,10 +1766,16 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree var _p0 uint32 if watchSubTree { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1353,7 +1784,11 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) store = Handle(r0) if store == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1362,7 +1797,11 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1371,7 +1810,11 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1379,7 +1822,11 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1387,7 +1834,11 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad func CertCloseStore(store Handle, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1395,7 +1846,11 @@ func CertCloseStore(store Handle, flags uint32) (err error) { func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1409,7 +1864,11 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1417,7 +1876,11 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en func CertFreeCertificateContext(ctx *CertContext) (err error) { r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1425,7 +1888,11 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) { func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1476,18 +1943,14 @@ func GetCurrentProcessId() (pid uint32) { return } -func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - func GetConsoleMode(console Handle, mode *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1495,7 +1958,11 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { func SetConsoleMode(console Handle, mode uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1503,7 +1970,11 @@ func SetConsoleMode(console Handle, mode uint32) (err error) { func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1511,7 +1982,11 @@ func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) ( func SetConsoleCursorPosition(console Handle, position Coord) (err error) { r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(*((*uint32)(unsafe.Pointer(&position)))), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1519,7 +1994,11 @@ func SetConsoleCursorPosition(console Handle, position Coord) (err error) { func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1527,7 +2006,11 @@ func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1536,7 +2019,11 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1544,7 +2031,11 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1552,7 +2043,11 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1560,7 +2055,11 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1568,7 +2067,11 @@ func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1576,7 +2079,11 @@ func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1584,7 +2091,11 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) if r1&0xff == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1592,7 +2103,11 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) if r1&0xff == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1607,7 +2122,11 @@ func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialStat r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1616,7 +2135,11 @@ func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, d r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1625,11 +2148,17 @@ func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H var _p0 uint32 if inheritHandle { _p0 = 1 + } else { + _p0 = 0 } r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1637,7 +2166,11 @@ func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H func SetEvent(event Handle) (err error) { r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1645,7 +2178,11 @@ func SetEvent(event Handle) (err error) { func ResetEvent(event Handle) (err error) { r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1653,7 +2190,11 @@ func ResetEvent(event Handle) (err error) { func PulseEvent(event Handle) (err error) { r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1662,11 +2203,17 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 var _p0 uint32 if initialOwner { _p0 = 1 + } else { + _p0 = 0 } r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1675,7 +2222,11 @@ func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, d r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1684,11 +2235,17 @@ func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H var _p0 uint32 if inheritHandle { _p0 = 1 + } else { + _p0 = 0 } r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1696,7 +2253,11 @@ func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H func ReleaseMutex(mutex Handle) (err error) { r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1705,6 +2266,8 @@ func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { var _p0 uint32 if alertable { _p0 = 1 + } else { + _p0 = 0 } r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) ret = uint32(r0) @@ -1715,7 +2278,11 @@ func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1723,7 +2290,11 @@ func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, func AssignProcessToJobObject(job Handle, process Handle) (err error) { r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1731,7 +2302,11 @@ func AssignProcessToJobObject(job Handle, process Handle) (err error) { func TerminateJobObject(job Handle, exitCode uint32) (err error) { r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1746,7 +2321,11 @@ func ResumeThread(thread Handle) (ret uint32, err error) { r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) ret = uint32(r0) if ret == 0xffffffff { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1754,7 +2333,11 @@ func ResumeThread(thread Handle) (ret uint32, err error) { func SetPriorityClass(process Handle, priorityClass uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1763,7 +2346,11 @@ func GetPriorityClass(process Handle) (ret uint32, err error) { r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) ret = uint32(r0) if ret == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1771,7 +2358,11 @@ func GetPriorityClass(process Handle) (ret uint32, err error) { func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1780,7 +2371,11 @@ func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobOb r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) ret = int(r0) if ret == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1788,7 +2383,11 @@ func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobOb func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1797,7 +2396,11 @@ func GetProcessId(process Handle) (id uint32, err error) { r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) id = uint32(r0) if id == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1806,11 +2409,17 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand var _p0 uint32 if inheritHandle { _p0 = 1 + } else { + _p0 = 0 } r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) handle = Handle(r0) if handle == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1819,10 +2428,16 @@ func SetProcessPriorityBoost(process Handle, disable bool) (err error) { var _p0 uint32 if disable { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1835,7 +2450,11 @@ func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintpt func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) { r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1843,7 +2462,11 @@ func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1851,7 +2474,11 @@ func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1860,7 +2487,11 @@ func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, er r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1869,7 +2500,11 @@ func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, b r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1877,7 +2512,11 @@ func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, b func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1885,7 +2524,11 @@ func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1893,7 +2536,11 @@ func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uin func FindVolumeClose(findVolume Handle) (err error) { r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1901,7 +2548,11 @@ func FindVolumeClose(findVolume Handle) (err error) { func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1909,7 +2560,11 @@ func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1924,7 +2579,11 @@ func GetLogicalDrives() (drivesBitMask uint32, err error) { r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0) drivesBitMask = uint32(r0) if drivesBitMask == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1933,7 +2592,11 @@ func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1941,7 +2604,11 @@ func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1949,7 +2616,11 @@ func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volume func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1957,7 +2628,11 @@ func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeN func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1965,7 +2640,11 @@ func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1973,7 +2652,11 @@ func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength ui func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1982,7 +2665,11 @@ func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint3 r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) n = uint32(r0) if n == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1990,7 +2677,11 @@ func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint3 func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -1998,7 +2689,11 @@ func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2007,7 +2702,11 @@ func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) ret = int32(r0) if ret == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2015,7 +2714,11 @@ func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret func ExitWindowsEx(flags uint32, reason uint32) (err error) { r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2024,14 +2727,22 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint var _p0 uint32 if forceAppsClosed { _p0 = 1 + } else { + _p0 = 0 } var _p1 uint32 if rebootAfterShutdown { _p1 = 1 + } else { + _p1 = 0 } r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2039,7 +2750,11 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2047,7 +2762,11 @@ func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2095,7 +2814,11 @@ func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNum func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2103,7 +2826,11 @@ func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uin func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2111,7 +2838,11 @@ func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2119,7 +2850,11 @@ func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16 func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2131,7 +2866,11 @@ func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { } r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2147,7 +2886,11 @@ func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { func WSACleanup() (err error) { r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2155,7 +2898,11 @@ func WSACleanup() (err error) { func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2164,7 +2911,11 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) handle = Handle(r0) if handle == InvalidHandle { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2176,7 +2927,11 @@ func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) ( } r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2189,7 +2944,11 @@ func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen * r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int32(r0) if n == -1 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2197,7 +2956,11 @@ func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen * func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2205,7 +2968,11 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2213,7 +2980,11 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3 func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2221,7 +2992,11 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2229,7 +3004,11 @@ func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2237,7 +3016,11 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2245,7 +3028,11 @@ func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { func listen(s Handle, backlog int32) (err error) { r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2253,7 +3040,11 @@ func listen(s Handle, backlog int32) (err error) { func shutdown(s Handle, how int32) (err error) { r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2261,7 +3052,11 @@ func shutdown(s Handle, how int32) (err error) { func Closesocket(s Handle) (err error) { r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2269,7 +3064,11 @@ func Closesocket(s Handle) (err error) { func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2282,7 +3081,11 @@ func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2290,7 +3093,11 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2298,7 +3105,11 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2306,7 +3117,11 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2324,7 +3139,11 @@ func _GetHostByName(name *byte) (h *Hostent, err error) { r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) h = (*Hostent)(unsafe.Pointer(r0)) if h == nil { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2347,7 +3166,11 @@ func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) s = (*Servent)(unsafe.Pointer(r0)) if s == nil { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2371,7 +3194,11 @@ func _GetProtoByName(name *byte) (p *Protoent, err error) { r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) p = (*Protoent)(unsafe.Pointer(r0)) if p == nil { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2436,7 +3263,11 @@ func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2445,7 +3276,11 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) n = int32(r0) if n == -1 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2468,7 +3303,11 @@ func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) nwrite = int32(r0) if nwrite == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2476,7 +3315,11 @@ func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) if r1&0xff == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2484,7 +3327,11 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2516,7 +3363,11 @@ func NetApiBufferFree(buf *byte) (neterr error) { func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2524,7 +3375,11 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3 func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2532,7 +3387,11 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2540,7 +3399,11 @@ func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2554,7 +3417,11 @@ func GetLengthSid(sid *SID) (len uint32) { func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2562,7 +3429,11 @@ func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2570,7 +3441,11 @@ func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, s func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2584,7 +3459,11 @@ func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { func FreeSid(sid *SID) (err error) { r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) if r1 != 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2622,7 +3501,11 @@ func isValidSid(sid *SID) (isValid bool) { func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2630,7 +3513,11 @@ func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) ( func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2639,10 +3526,16 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token var _p0 uint32 if openAsSelf { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2650,7 +3543,11 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token func ImpersonateSelf(impersonationlevel uint32) (err error) { r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2658,7 +3555,11 @@ func ImpersonateSelf(impersonationlevel uint32) (err error) { func RevertToSelf() (err error) { r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2666,7 +3567,11 @@ func RevertToSelf() (err error) { func SetThreadToken(thread *Handle, token Token) (err error) { r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2674,7 +3579,11 @@ func SetThreadToken(thread *Handle, token Token) (err error) { func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2683,10 +3592,16 @@ func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tok var _p0 uint32 if disableAllPrivileges { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2695,10 +3610,16 @@ func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, var _p0 uint32 if resetToDefault { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2706,7 +3627,11 @@ func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2714,7 +3639,11 @@ func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2722,7 +3651,11 @@ func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2730,7 +3663,11 @@ func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2739,7 +3676,11 @@ func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) len = uint32(r0) if len == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2748,7 +3689,11 @@ func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) len = uint32(r0) if len == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2757,7 +3702,11 @@ func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err erro r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) len = uint32(r0) if len == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2765,7 +3714,11 @@ func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err erro func WTSQueryUserToken(session uint32, token *Token) (err error) { r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2773,7 +3726,11 @@ func WTSQueryUserToken(session uint32, token *Token) (err error) { func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2841,7 +3798,11 @@ func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) { r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2849,7 +3810,11 @@ func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) { r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2858,16 +3823,24 @@ func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl var _p0 uint32 if *daclPresent { _p0 = 1 + } else { + _p0 = 0 } var _p1 uint32 if *daclDefaulted { _p1 = 1 + } else { + _p1 = 0 } r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) *daclPresent = _p0 != 0 *daclDefaulted = _p1 != 0 if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2876,16 +3849,24 @@ func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl var _p0 uint32 if *saclPresent { _p0 = 1 + } else { + _p0 = 0 } var _p1 uint32 if *saclDefaulted { _p1 = 1 + } else { + _p1 = 0 } r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) *saclPresent = _p0 != 0 *saclDefaulted = _p1 != 0 if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2894,11 +3875,17 @@ func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefau var _p0 uint32 if *ownerDefaulted { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) *ownerDefaulted = _p0 != 0 if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2907,11 +3894,17 @@ func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefau var _p0 uint32 if *groupDefaulted { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) *groupDefaulted = _p0 != 0 if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2939,7 +3932,11 @@ func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) { func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) { r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2948,14 +3945,22 @@ func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl * var _p0 uint32 if daclPresent { _p0 = 1 + } else { + _p0 = 0 } var _p1 uint32 if daclDefaulted { _p1 = 1 + } else { + _p1 = 0 } r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2964,14 +3969,22 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl * var _p0 uint32 if saclPresent { _p0 = 1 + } else { + _p0 = 0 } var _p1 uint32 if saclDefaulted { _p1 = 1 + } else { + _p1 = 0 } r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2980,10 +3993,16 @@ func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaul var _p0 uint32 if ownerDefaulted { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -2992,10 +4011,16 @@ func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaul var _p0 uint32 if groupDefaulted { _p0 = 1 + } else { + _p0 = 0 } r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -3017,7 +4042,11 @@ func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision ui func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -3025,7 +4054,11 @@ func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -3033,7 +4066,11 @@ func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) { r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } @@ -3041,7 +4078,11 @@ func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DE func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) { r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) if r1 == 0 { - err = errnoErr(e1) + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } } return } diff --git a/vendor/modules.txt b/vendor/modules.txt index 56498b4fc..a991a7a5d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -504,7 +504,7 @@ golang.org/x/oauth2/jwt # golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a golang.org/x/sync/errgroup golang.org/x/sync/singleflight -# golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 +# golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf golang.org/x/sys/cpu golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix