$failexpr = "!$name";
} elsif($name eq "err") {
$ret[$i] = "r1";
- $failexpr = "int(r1) $failcond";
+ $failexpr = "r1 $failcond";
} else {
$failexpr = "$name $failcond";
}
// net api calls
+const socket_error = uintptr(^uint32(0))
+
//sys WSAStartup(verreq uint32, data *WSAData) (sockerr error) = ws2_32.WSAStartup
-//sys WSACleanup() (err error) [failretval==-1] = ws2_32.WSACleanup
-//sys WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) [failretval==-1] = ws2_32.WSAIoctl
+//sys WSACleanup() (err error) [failretval==socket_error] = ws2_32.WSACleanup
+//sys WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) [failretval==socket_error] = ws2_32.WSAIoctl
//sys socket(af int32, typ int32, protocol int32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.socket
-//sys Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) [failretval==-1] = ws2_32.setsockopt
-//sys Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) [failretval==-1] = ws2_32.getsockopt
-//sys bind(s Handle, name uintptr, namelen int32) (err error) [failretval==-1] = ws2_32.bind
-//sys connect(s Handle, name uintptr, namelen int32) (err error) [failretval==-1] = ws2_32.connect
-//sys getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==-1] = ws2_32.getsockname
-//sys getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==-1] = ws2_32.getpeername
-//sys listen(s Handle, backlog int32) (err error) [failretval==-1] = ws2_32.listen
-//sys shutdown(s Handle, how int32) (err error) [failretval==-1] = ws2_32.shutdown
-//sys Closesocket(s Handle) (err error) [failretval==-1] = ws2_32.closesocket
+//sys Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) [failretval==socket_error] = ws2_32.setsockopt
+//sys Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) [failretval==socket_error] = ws2_32.getsockopt
+//sys bind(s Handle, name uintptr, namelen int32) (err error) [failretval==socket_error] = ws2_32.bind
+//sys connect(s Handle, name uintptr, namelen int32) (err error) [failretval==socket_error] = ws2_32.connect
+//sys getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==socket_error] = ws2_32.getsockname
+//sys getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==socket_error] = ws2_32.getpeername
+//sys listen(s Handle, backlog int32) (err error) [failretval==socket_error] = ws2_32.listen
+//sys shutdown(s Handle, how int32) (err error) [failretval==socket_error] = ws2_32.shutdown
+//sys Closesocket(s Handle) (err error) [failretval==socket_error] = ws2_32.closesocket
//sys AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) = mswsock.AcceptEx
//sys GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) = mswsock.GetAcceptExSockaddrs
-//sys WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==-1] = ws2_32.WSARecv
-//sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==-1] = ws2_32.WSASend
-//sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==-1] = ws2_32.WSARecvFrom
-//sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==-1] = ws2_32.WSASendTo
+//sys WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecv
+//sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASend
+//sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecvFrom
+//sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASendTo
//sys GetHostByName(name string) (h *Hostent, err error) [failretval==nil] = ws2_32.gethostbyname
//sys GetServByName(name string, proto string) (s *Servent, err error) [failretval==nil] = ws2_32.getservbyname
//sys Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs
func FreeLibrary(handle Handle) (err error) {
r1, _, e1 := Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = &buf[0]
}
r1, _, e1 := Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = &buf[0]
}
r1, _, e1 := Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CloseHandle(handle Handle) (err error) {
r1, _, e1 := Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func findNextFile1(handle Handle, data *win32finddata1) (err error) {
r1, _, e1 := Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FindClose(handle Handle) (err error) {
r1, _, e1 := Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
r1, _, e1 := Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetCurrentDirectory(path *uint16) (err error) {
r1, _, e1 := Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
r1, _, e1 := Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func RemoveDirectory(path *uint16) (err error) {
r1, _, e1 := Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func DeleteFile(path *uint16) (err error) {
r1, _, e1 := Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func MoveFile(from *uint16, to *uint16) (err error) {
r1, _, e1 := Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetComputerName(buf *uint16, n *uint32) (err error) {
r1, _, e1 := Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetEndOfFile(handle Handle) (err error) {
r1, _, e1 := Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
r1, _, e1 := Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
r1, _, e1 := Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CancelIo(s Handle) (err error) {
r1, _, e1 := Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = 0
}
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func TerminateProcess(handle Handle, exitcode uint32) (err error) {
r1, _, e1 := Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
r1, _, e1 := Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetStartupInfo(startupInfo *StartupInfo) (err error) {
r1, _, e1 := Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
r1, _, e1 := Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = 0
}
r1, _, e1 := Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
r1, _, e1 := Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
r1, _, e1 := Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
r1, _, e1 := Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
r1, _, e1 := Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FreeEnvironmentStrings(envs *uint16) (err error) {
r1, _, e1 := Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
r1, _, e1 := Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
r1, _, e1 := Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetFileAttributes(name *uint16, attrs uint32) (err error) {
r1, _, e1 := Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
r1, _, e1 := Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
r1, _, e1 := Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FlushFileBuffers(handle Handle) (err error) {
r1, _, e1 := Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func UnmapViewOfFile(addr uintptr) (err error) {
r1, _, e1 := Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
r1, _, e1 := Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func VirtualLock(addr uintptr, length uintptr) (err error) {
r1, _, e1 := Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func VirtualUnlock(addr uintptr, length uintptr) (err error) {
r1, _, e1 := Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = 0
}
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
r1, _, e1 := Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertCloseStore(store Handle, flags uint32) (err error) {
r1, _, e1 := Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertFreeCertificateContext(ctx *CertContext) (err error) {
r1, _, e1 := Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
r1, _, e1 := Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetConsoleMode(console Handle, mode *uint32) (err error) {
r1, _, e1 := Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
r1, _, e1 := Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func WSACleanup() (err error) {
r1, _, e1 := Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
r1, _, e1 := Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
r1, _, e1 := Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func bind(s Handle, name uintptr, namelen int32) (err error) {
r1, _, e1 := Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func connect(s Handle, name uintptr, namelen int32) (err error) {
r1, _, e1 := Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
r1, _, e1 := Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
r1, _, e1 := Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func listen(s Handle, backlog int32) (err error) {
r1, _, e1 := Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func shutdown(s Handle, how int32) (err error) {
r1, _, e1 := Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func Closesocket(s Handle) (err error) {
r1, _, e1 := Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
r1, _, e1 := Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
- if int(r1)&0xff == 0 {
+ if r1&0xff == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
r1, _, e1 := Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
- if int(r1)&0xff == 0 {
+ if r1&0xff == 0 {
if e1 != 0 {
err = error(e1)
} else {
func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
r1, _, e1 := Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
r1, _, e1 := Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
r1, _, e1 := Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
r1, _, e1 := Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
r1, _, e1 := Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
r1, _, e1 := Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FreeLibrary(handle Handle) (err error) {
r1, _, e1 := Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = &buf[0]
}
r1, _, e1 := Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = &buf[0]
}
r1, _, e1 := Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CloseHandle(handle Handle) (err error) {
r1, _, e1 := Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func findNextFile1(handle Handle, data *win32finddata1) (err error) {
r1, _, e1 := Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FindClose(handle Handle) (err error) {
r1, _, e1 := Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
r1, _, e1 := Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetCurrentDirectory(path *uint16) (err error) {
r1, _, e1 := Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
r1, _, e1 := Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func RemoveDirectory(path *uint16) (err error) {
r1, _, e1 := Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func DeleteFile(path *uint16) (err error) {
r1, _, e1 := Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func MoveFile(from *uint16, to *uint16) (err error) {
r1, _, e1 := Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetComputerName(buf *uint16, n *uint32) (err error) {
r1, _, e1 := Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetEndOfFile(handle Handle) (err error) {
r1, _, e1 := Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
r1, _, e1 := Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
r1, _, e1 := Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CancelIo(s Handle) (err error) {
r1, _, e1 := Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = 0
}
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func TerminateProcess(handle Handle, exitcode uint32) (err error) {
r1, _, e1 := Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
r1, _, e1 := Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetStartupInfo(startupInfo *StartupInfo) (err error) {
r1, _, e1 := Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
r1, _, e1 := Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = 0
}
r1, _, e1 := Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
r1, _, e1 := Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
r1, _, e1 := Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
r1, _, e1 := Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
r1, _, e1 := Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FreeEnvironmentStrings(envs *uint16) (err error) {
r1, _, e1 := Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
r1, _, e1 := Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
r1, _, e1 := Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetFileAttributes(name *uint16, attrs uint32) (err error) {
r1, _, e1 := Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
r1, _, e1 := Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
r1, _, e1 := Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FlushFileBuffers(handle Handle) (err error) {
r1, _, e1 := Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func UnmapViewOfFile(addr uintptr) (err error) {
r1, _, e1 := Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
r1, _, e1 := Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func VirtualLock(addr uintptr, length uintptr) (err error) {
r1, _, e1 := Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func VirtualUnlock(addr uintptr, length uintptr) (err error) {
r1, _, e1 := Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
_p0 = 0
}
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
r1, _, e1 := Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertCloseStore(store Handle, flags uint32) (err error) {
r1, _, e1 := Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertFreeCertificateContext(ctx *CertContext) (err error) {
r1, _, e1 := Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
r1, _, e1 := Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetConsoleMode(console Handle, mode *uint32) (err error) {
r1, _, e1 := Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
r1, _, e1 := Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func WSACleanup() (err error) {
r1, _, e1 := Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
r1, _, e1 := Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
r1, _, e1 := Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func bind(s Handle, name uintptr, namelen int32) (err error) {
r1, _, e1 := Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func connect(s Handle, name uintptr, namelen int32) (err error) {
r1, _, e1 := Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
r1, _, e1 := Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
r1, _, e1 := Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func listen(s Handle, backlog int32) (err error) {
r1, _, e1 := Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func shutdown(s Handle, how int32) (err error) {
r1, _, e1 := Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func Closesocket(s Handle) (err error) {
r1, _, e1 := Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
- if int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
r1, _, e1 := 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 int(r1) == -1 {
+ if r1 == socket_error {
if e1 != 0 {
err = error(e1)
} else {
func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
r1, _, e1 := Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
- if int(r1)&0xff == 0 {
+ if r1&0xff == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
r1, _, e1 := Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
- if int(r1)&0xff == 0 {
+ if r1&0xff == 0 {
if e1 != 0 {
err = error(e1)
} else {
func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
r1, _, e1 := 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 int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
r1, _, e1 := Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
r1, _, e1 := Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
r1, _, e1 := Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
r1, _, e1 := Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
r1, _, e1 := Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {
func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
r1, _, e1 := Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
- if int(r1) == 0 {
+ if r1 == 0 {
if e1 != 0 {
err = error(e1)
} else {