summaryrefslogtreecommitdiff
path: root/src/pkg/syscall/zsyscall_windows_386.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-08-03 16:54:30 +0200
committerOndřej Surý <ondrej@sury.org>2011-08-03 16:54:30 +0200
commit28592ee1ea1f5cdffcf85472f9de0285d928cf12 (patch)
tree32944e18b23f7fe4a0818a694aa2a6dfb1835463 /src/pkg/syscall/zsyscall_windows_386.go
parente836bee4716dc0d4d913537ad3ad1925a7ac32d0 (diff)
downloadgolang-upstream/59.tar.gz
Imported Upstream version 59upstream/59
Diffstat (limited to 'src/pkg/syscall/zsyscall_windows_386.go')
-rw-r--r--src/pkg/syscall/zsyscall_windows_386.go171
1 files changed, 108 insertions, 63 deletions
diff --git a/src/pkg/syscall/zsyscall_windows_386.go b/src/pkg/syscall/zsyscall_windows_386.go
index 447b09043..350ad232a 100644
--- a/src/pkg/syscall/zsyscall_windows_386.go
+++ b/src/pkg/syscall/zsyscall_windows_386.go
@@ -12,6 +12,7 @@ var (
modwsock32 = loadDll("wsock32.dll")
modws2_32 = loadDll("ws2_32.dll")
moddnsapi = loadDll("dnsapi.dll")
+ modiphlpapi = loadDll("iphlpapi.dll")
procGetLastError = getSysProcAddr(modkernel32, "GetLastError")
procLoadLibraryW = getSysProcAddr(modkernel32, "LoadLibraryW")
@@ -77,8 +78,10 @@ var (
procFlushViewOfFile = getSysProcAddr(modkernel32, "FlushViewOfFile")
procVirtualLock = getSysProcAddr(modkernel32, "VirtualLock")
procVirtualUnlock = getSysProcAddr(modkernel32, "VirtualUnlock")
+ procTransmitFile = getSysProcAddr(modwsock32, "TransmitFile")
procWSAStartup = getSysProcAddr(modwsock32, "WSAStartup")
procWSACleanup = getSysProcAddr(modwsock32, "WSACleanup")
+ procWSAIoctl = getSysProcAddr(modws2_32, "WSAIoctl")
procsocket = getSysProcAddr(modwsock32, "socket")
procsetsockopt = getSysProcAddr(modwsock32, "setsockopt")
procbind = getSysProcAddr(modwsock32, "bind")
@@ -99,6 +102,8 @@ var (
procntohs = getSysProcAddr(modws2_32, "ntohs")
procDnsQuery_W = getSysProcAddr(moddnsapi, "DnsQuery_W")
procDnsRecordListFree = getSysProcAddr(moddnsapi, "DnsRecordListFree")
+ procGetIfEntry = getSysProcAddr(modiphlpapi, "GetIfEntry")
+ procGetAdaptersInfo = getSysProcAddr(modiphlpapi, "GetAdaptersInfo")
)
func GetLastError() (lasterrno int) {
@@ -107,9 +112,9 @@ func GetLastError() (lasterrno int) {
return
}
-func LoadLibrary(libname string) (handle uint32, errno int) {
+func LoadLibrary(libname string) (handle Handle, errno int) {
r0, _, e1 := Syscall(procLoadLibraryW, 1, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0)
- handle = uint32(r0)
+ handle = Handle(r0)
if handle == 0 {
if e1 != 0 {
errno = int(e1)
@@ -122,7 +127,7 @@ func LoadLibrary(libname string) (handle uint32, errno int) {
return
}
-func FreeLibrary(handle uint32) (errno int) {
+func FreeLibrary(handle Handle) (errno int) {
r1, _, e1 := Syscall(procFreeLibrary, 1, uintptr(handle), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -136,9 +141,9 @@ func FreeLibrary(handle uint32) (errno int) {
return
}
-func GetProcAddress(module uint32, procname string) (proc uint32, errno int) {
+func GetProcAddress(module Handle, procname string) (proc Handle, errno int) {
r0, _, e1 := Syscall(procGetProcAddress, 2, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0)
- proc = uint32(r0)
+ proc = Handle(r0)
if proc == 0 {
if e1 != 0 {
errno = int(e1)
@@ -190,10 +195,10 @@ func ExitProcess(exitcode uint32) {
return
}
-func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle int32, errno int) {
+func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, errno int) {
r0, _, e1 := Syscall9(procCreateFileW, 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
- handle = int32(r0)
- if handle == -1 {
+ handle = Handle(r0)
+ if handle == InvalidHandle {
if e1 != 0 {
errno = int(e1)
} else {
@@ -205,7 +210,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes
return
}
-func ReadFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
+func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
var _p0 *byte
if len(buf) > 0 {
_p0 = &buf[0]
@@ -223,7 +228,7 @@ func ReadFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (e
return
}
-func WriteFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
+func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
var _p0 *byte
if len(buf) > 0 {
_p0 = &buf[0]
@@ -241,7 +246,7 @@ func WriteFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (
return
}
-func SetFilePointer(handle int32, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) {
+func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) {
r0, _, e1 := Syscall6(procSetFilePointer, 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
newlowoffset = uint32(r0)
if newlowoffset == 0xffffffff {
@@ -256,7 +261,7 @@ func SetFilePointer(handle int32, lowoffset int32, highoffsetptr *int32, whence
return
}
-func CloseHandle(handle int32) (errno int) {
+func CloseHandle(handle Handle) (errno int) {
r1, _, e1 := Syscall(procCloseHandle, 1, uintptr(handle), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -270,10 +275,10 @@ func CloseHandle(handle int32) (errno int) {
return
}
-func GetStdHandle(stdhandle int32) (handle int32, errno int) {
+func GetStdHandle(stdhandle int) (handle Handle, errno int) {
r0, _, e1 := Syscall(procGetStdHandle, 1, uintptr(stdhandle), 0, 0)
- handle = int32(r0)
- if handle == -1 {
+ handle = Handle(r0)
+ if handle == InvalidHandle {
if e1 != 0 {
errno = int(e1)
} else {
@@ -285,10 +290,10 @@ func GetStdHandle(stdhandle int32) (handle int32, errno int) {
return
}
-func FindFirstFile(name *uint16, data *Win32finddata) (handle int32, errno int) {
+func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, errno int) {
r0, _, e1 := Syscall(procFindFirstFileW, 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
- handle = int32(r0)
- if handle == -1 {
+ handle = Handle(r0)
+ if handle == InvalidHandle {
if e1 != 0 {
errno = int(e1)
} else {
@@ -300,7 +305,7 @@ func FindFirstFile(name *uint16, data *Win32finddata) (handle int32, errno int)
return
}
-func FindNextFile(handle int32, data *Win32finddata) (errno int) {
+func FindNextFile(handle Handle, data *Win32finddata) (errno int) {
r1, _, e1 := Syscall(procFindNextFileW, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -314,7 +319,7 @@ func FindNextFile(handle int32, data *Win32finddata) (errno int) {
return
}
-func FindClose(handle int32) (errno int) {
+func FindClose(handle Handle) (errno int) {
r1, _, e1 := Syscall(procFindClose, 1, uintptr(handle), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -328,7 +333,7 @@ func FindClose(handle int32) (errno int) {
return
}
-func GetFileInformationByHandle(handle int32, data *ByHandleFileInformation) (errno int) {
+func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (errno int) {
r1, _, e1 := Syscall(procGetFileInformationByHandle, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -441,7 +446,7 @@ func GetComputerName(buf *uint16, n *uint32) (errno int) {
return
}
-func SetEndOfFile(handle int32) (errno int) {
+func SetEndOfFile(handle Handle) (errno int) {
r1, _, e1 := Syscall(procSetEndOfFile, 1, uintptr(handle), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -480,9 +485,9 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, errno int) {
return
}
-func CreateIoCompletionPort(filehandle int32, cphandle int32, key uint32, threadcnt uint32) (handle int32, errno int) {
+func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, errno int) {
r0, _, e1 := Syscall6(procCreateIoCompletionPort, 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
- handle = int32(r0)
+ handle = Handle(r0)
if handle == 0 {
if e1 != 0 {
errno = int(e1)
@@ -495,7 +500,7 @@ func CreateIoCompletionPort(filehandle int32, cphandle int32, key uint32, thread
return
}
-func GetQueuedCompletionStatus(cphandle int32, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) {
+func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) {
r1, _, e1 := Syscall6(procGetQueuedCompletionStatus, 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -509,7 +514,7 @@ func GetQueuedCompletionStatus(cphandle int32, qty *uint32, key *uint32, overlap
return
}
-func CancelIo(s uint32) (errno int) {
+func CancelIo(s Handle) (errno int) {
r1, _, e1 := Syscall(procCancelIo, 1, uintptr(s), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -543,7 +548,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA
return
}
-func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno int) {
+func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, errno int) {
var _p0 uint32
if inheritHandle {
_p0 = 1
@@ -551,7 +556,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno
_p0 = 0
}
r0, _, e1 := Syscall(procOpenProcess, 3, uintptr(da), uintptr(_p0), uintptr(pid))
- handle = int32(r0)
+ handle = Handle(r0)
if handle == 0 {
if e1 != 0 {
errno = int(e1)
@@ -564,7 +569,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno
return
}
-func TerminateProcess(handle int32, exitcode uint32) (errno int) {
+func TerminateProcess(handle Handle, exitcode uint32) (errno int) {
r1, _, e1 := Syscall(procTerminateProcess, 2, uintptr(handle), uintptr(exitcode), 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -578,7 +583,7 @@ func TerminateProcess(handle int32, exitcode uint32) (errno int) {
return
}
-func GetExitCodeProcess(handle int32, exitcode *uint32) (errno int) {
+func GetExitCodeProcess(handle Handle, exitcode *uint32) (errno int) {
r1, _, e1 := Syscall(procGetExitCodeProcess, 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -606,9 +611,9 @@ func GetStartupInfo(startupInfo *StartupInfo) (errno int) {
return
}
-func GetCurrentProcess() (pseudoHandle int32, errno int) {
+func GetCurrentProcess() (pseudoHandle Handle, errno int) {
r0, _, e1 := Syscall(procGetCurrentProcess, 0, 0, 0, 0)
- pseudoHandle = int32(r0)
+ pseudoHandle = Handle(r0)
if pseudoHandle == 0 {
if e1 != 0 {
errno = int(e1)
@@ -621,7 +626,7 @@ func GetCurrentProcess() (pseudoHandle int32, errno int) {
return
}
-func DuplicateHandle(hSourceProcessHandle int32, hSourceHandle int32, hTargetProcessHandle int32, lpTargetHandle *int32, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) {
+func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) {
var _p0 uint32
if bInheritHandle {
_p0 = 1
@@ -641,7 +646,7 @@ func DuplicateHandle(hSourceProcessHandle int32, hSourceHandle int32, hTargetPro
return
}
-func WaitForSingleObject(handle int32, waitMilliseconds uint32) (event uint32, errno int) {
+func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, errno int) {
r0, _, e1 := Syscall(procWaitForSingleObject, 2, uintptr(handle), uintptr(waitMilliseconds), 0)
event = uint32(r0)
if event == 0xffffffff {
@@ -671,7 +676,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, errno int) {
return
}
-func CreatePipe(readhandle *uint32, writehandle *uint32, sa *SecurityAttributes, size uint32) (errno int) {
+func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (errno int) {
r1, _, e1 := Syscall6(procCreatePipe, 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -685,7 +690,7 @@ func CreatePipe(readhandle *uint32, writehandle *uint32, sa *SecurityAttributes,
return
}
-func GetFileType(filehandle uint32) (n uint32, errno int) {
+func GetFileType(filehandle Handle) (n uint32, errno int) {
r0, _, e1 := Syscall(procGetFileType, 1, uintptr(filehandle), 0, 0)
n = uint32(r0)
if n == 0 {
@@ -700,7 +705,7 @@ func GetFileType(filehandle uint32) (n uint32, errno int) {
return
}
-func CryptAcquireContext(provhandle *uint32, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) {
+func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) {
r1, _, e1 := Syscall6(procCryptAcquireContextW, 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -714,7 +719,7 @@ func CryptAcquireContext(provhandle *uint32, container *uint16, provider *uint16
return
}
-func CryptReleaseContext(provhandle uint32, flags uint32) (errno int) {
+func CryptReleaseContext(provhandle Handle, flags uint32) (errno int) {
r1, _, e1 := Syscall(procCryptReleaseContext, 2, uintptr(provhandle), uintptr(flags), 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -728,7 +733,7 @@ func CryptReleaseContext(provhandle uint32, flags uint32) (errno int) {
return
}
-func CryptGenRandom(provhandle uint32, buflen uint32, buf *byte) (errno int) {
+func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (errno int) {
r1, _, e1 := Syscall(procCryptGenRandom, 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
if int(r1) == 0 {
if e1 != 0 {
@@ -800,7 +805,7 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (errno int) {
return
}
-func SetFileTime(handle int32, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) {
+func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) {
r1, _, e1 := Syscall6(procSetFileTime, 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -864,9 +869,9 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err
return
}
-func LocalFree(hmem uint32) (handle uint32, errno int) {
+func LocalFree(hmem Handle) (handle Handle, errno int) {
r0, _, e1 := Syscall(procLocalFree, 1, uintptr(hmem), 0, 0)
- handle = uint32(r0)
+ handle = Handle(r0)
if handle != 0 {
if e1 != 0 {
errno = int(e1)
@@ -879,7 +884,7 @@ func LocalFree(hmem uint32) (handle uint32, errno int) {
return
}
-func SetHandleInformation(handle int32, mask uint32, flags uint32) (errno int) {
+func SetHandleInformation(handle Handle, mask uint32, flags uint32) (errno int) {
r1, _, e1 := Syscall(procSetHandleInformation, 3, uintptr(handle), uintptr(mask), uintptr(flags))
if int(r1) == 0 {
if e1 != 0 {
@@ -893,7 +898,7 @@ func SetHandleInformation(handle int32, mask uint32, flags uint32) (errno int) {
return
}
-func FlushFileBuffers(handle int32) (errno int) {
+func FlushFileBuffers(handle Handle) (errno int) {
r1, _, e1 := Syscall(procFlushFileBuffers, 1, uintptr(handle), 0, 0)
if int(r1) == 0 {
if e1 != 0 {
@@ -922,9 +927,9 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (
return
}
-func CreateFileMapping(fhandle int32, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle int32, errno int) {
+func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, errno int) {
r0, _, e1 := Syscall6(procCreateFileMappingW, 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
- handle = int32(r0)
+ handle = Handle(r0)
if handle == 0 {
if e1 != 0 {
errno = int(e1)
@@ -937,7 +942,7 @@ func CreateFileMapping(fhandle int32, sa *SecurityAttributes, prot uint32, maxSi
return
}
-func MapViewOfFile(handle int32, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) {
+func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) {
r0, _, e1 := Syscall6(procMapViewOfFile, 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
addr = uintptr(r0)
if addr == 0 {
@@ -1008,6 +1013,20 @@ func VirtualUnlock(addr uintptr, length uintptr) (errno int) {
return
}
+func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) {
+ r1, _, e1 := Syscall9(procTransmitFile, 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 e1 != 0 {
+ errno = int(e1)
+ } else {
+ errno = EINVAL
+ }
+ } else {
+ errno = 0
+ }
+ return
+}
+
func WSAStartup(verreq uint32, data *WSAData) (sockerrno int) {
r0, _, _ := Syscall(procWSAStartup, 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
sockerrno = int(r0)
@@ -1028,10 +1047,24 @@ func WSACleanup() (errno int) {
return
}
-func socket(af int32, typ int32, protocol int32) (handle int32, errno int) {
+func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (errno int) {
+ r1, _, e1 := Syscall9(procWSAIoctl, 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 e1 != 0 {
+ errno = int(e1)
+ } else {
+ errno = EINVAL
+ }
+ } else {
+ errno = 0
+ }
+ return
+}
+
+func socket(af int32, typ int32, protocol int32) (handle Handle, errno int) {
r0, _, e1 := Syscall(procsocket, 3, uintptr(af), uintptr(typ), uintptr(protocol))
- handle = int32(r0)
- if handle == -1 {
+ handle = Handle(r0)
+ if handle == InvalidHandle {
if e1 != 0 {
errno = int(e1)
} else {
@@ -1043,7 +1076,7 @@ func socket(af int32, typ int32, protocol int32) (handle int32, errno int) {
return
}
-func setsockopt(s int32, level int32, optname int32, optval *byte, optlen int32) (errno int) {
+func setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) {
r1, _, e1 := Syscall6(procsetsockopt, 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
if int(r1) == -1 {
if e1 != 0 {
@@ -1057,7 +1090,7 @@ func setsockopt(s int32, level int32, optname int32, optval *byte, optlen int32)
return
}
-func bind(s int32, name uintptr, namelen int32) (errno int) {
+func bind(s Handle, name uintptr, namelen int32) (errno int) {
r1, _, e1 := Syscall(procbind, 3, uintptr(s), uintptr(name), uintptr(namelen))
if int(r1) == -1 {
if e1 != 0 {
@@ -1071,7 +1104,7 @@ func bind(s int32, name uintptr, namelen int32) (errno int) {
return
}
-func connect(s int32, name uintptr, namelen int32) (errno int) {
+func connect(s Handle, name uintptr, namelen int32) (errno int) {
r1, _, e1 := Syscall(procconnect, 3, uintptr(s), uintptr(name), uintptr(namelen))
if int(r1) == -1 {
if e1 != 0 {
@@ -1085,7 +1118,7 @@ func connect(s int32, name uintptr, namelen int32) (errno int) {
return
}
-func getsockname(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
+func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
r1, _, e1 := Syscall(procgetsockname, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if int(r1) == -1 {
if e1 != 0 {
@@ -1099,7 +1132,7 @@ func getsockname(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
return
}
-func getpeername(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
+func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
r1, _, e1 := Syscall(procgetpeername, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if int(r1) == -1 {
if e1 != 0 {
@@ -1113,7 +1146,7 @@ func getpeername(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
return
}
-func listen(s int32, backlog int32) (errno int) {
+func listen(s Handle, backlog int32) (errno int) {
r1, _, e1 := Syscall(proclisten, 2, uintptr(s), uintptr(backlog), 0)
if int(r1) == -1 {
if e1 != 0 {
@@ -1127,7 +1160,7 @@ func listen(s int32, backlog int32) (errno int) {
return
}
-func shutdown(s int32, how int32) (errno int) {
+func shutdown(s Handle, how int32) (errno int) {
r1, _, e1 := Syscall(procshutdown, 2, uintptr(s), uintptr(how), 0)
if int(r1) == -1 {
if e1 != 0 {
@@ -1141,7 +1174,7 @@ func shutdown(s int32, how int32) (errno int) {
return
}
-func Closesocket(s int32) (errno int) {
+func Closesocket(s Handle) (errno int) {
r1, _, e1 := Syscall(procclosesocket, 1, uintptr(s), 0, 0)
if int(r1) == -1 {
if e1 != 0 {
@@ -1155,7 +1188,7 @@ func Closesocket(s int32) (errno int) {
return
}
-func AcceptEx(ls uint32, as uint32, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) {
+func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) {
r1, _, e1 := Syscall9(procAcceptEx, 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 e1 != 0 {
@@ -1174,7 +1207,7 @@ func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen
return
}
-func WSARecv(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) {
+func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) {
r1, _, e1 := Syscall9(procWSARecv, 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 e1 != 0 {
@@ -1188,7 +1221,7 @@ func WSARecv(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32
return
}
-func WSASend(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) {
+func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) {
r1, _, e1 := Syscall9(procWSASend, 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 e1 != 0 {
@@ -1202,7 +1235,7 @@ func WSASend(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32,
return
}
-func WSARecvFrom(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) {
+func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) {
r1, _, e1 := Syscall9(procWSARecvFrom, 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 e1 != 0 {
@@ -1216,7 +1249,7 @@ func WSARecvFrom(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui
return
}
-func WSASendTo(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) {
+func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) {
r1, _, e1 := Syscall9(procWSASendTo, 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 e1 != 0 {
@@ -1276,3 +1309,15 @@ func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
Syscall(procDnsRecordListFree, 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
return
}
+
+func GetIfEntry(pIfRow *MibIfRow) (errcode int) {
+ r0, _, _ := Syscall(procGetIfEntry, 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
+ errcode = int(r0)
+ return
+}
+
+func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode int) {
+ r0, _, _ := Syscall(procGetAdaptersInfo, 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
+ errcode = int(r0)
+ return
+}