~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/syscall/zsyscall_windows_386.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        modwsock32  = loadDll("wsock32.dll")
13
13
        modws2_32   = loadDll("ws2_32.dll")
14
14
        moddnsapi   = loadDll("dnsapi.dll")
 
15
        modiphlpapi = loadDll("iphlpapi.dll")
15
16
 
16
17
        procGetLastError               = getSysProcAddr(modkernel32, "GetLastError")
17
18
        procLoadLibraryW               = getSysProcAddr(modkernel32, "LoadLibraryW")
77
78
        procFlushViewOfFile            = getSysProcAddr(modkernel32, "FlushViewOfFile")
78
79
        procVirtualLock                = getSysProcAddr(modkernel32, "VirtualLock")
79
80
        procVirtualUnlock              = getSysProcAddr(modkernel32, "VirtualUnlock")
 
81
        procTransmitFile               = getSysProcAddr(modwsock32, "TransmitFile")
80
82
        procWSAStartup                 = getSysProcAddr(modwsock32, "WSAStartup")
81
83
        procWSACleanup                 = getSysProcAddr(modwsock32, "WSACleanup")
 
84
        procWSAIoctl                   = getSysProcAddr(modws2_32, "WSAIoctl")
82
85
        procsocket                     = getSysProcAddr(modwsock32, "socket")
83
86
        procsetsockopt                 = getSysProcAddr(modwsock32, "setsockopt")
84
87
        procbind                       = getSysProcAddr(modwsock32, "bind")
99
102
        procntohs                      = getSysProcAddr(modws2_32, "ntohs")
100
103
        procDnsQuery_W                 = getSysProcAddr(moddnsapi, "DnsQuery_W")
101
104
        procDnsRecordListFree          = getSysProcAddr(moddnsapi, "DnsRecordListFree")
 
105
        procGetIfEntry                 = getSysProcAddr(modiphlpapi, "GetIfEntry")
 
106
        procGetAdaptersInfo            = getSysProcAddr(modiphlpapi, "GetAdaptersInfo")
102
107
)
103
108
 
104
109
func GetLastError() (lasterrno int) {
107
112
        return
108
113
}
109
114
 
110
 
func LoadLibrary(libname string) (handle uint32, errno int) {
 
115
func LoadLibrary(libname string) (handle Handle, errno int) {
111
116
        r0, _, e1 := Syscall(procLoadLibraryW, 1, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0)
112
 
        handle = uint32(r0)
 
117
        handle = Handle(r0)
113
118
        if handle == 0 {
114
119
                if e1 != 0 {
115
120
                        errno = int(e1)
122
127
        return
123
128
}
124
129
 
125
 
func FreeLibrary(handle uint32) (errno int) {
 
130
func FreeLibrary(handle Handle) (errno int) {
126
131
        r1, _, e1 := Syscall(procFreeLibrary, 1, uintptr(handle), 0, 0)
127
132
        if int(r1) == 0 {
128
133
                if e1 != 0 {
136
141
        return
137
142
}
138
143
 
139
 
func GetProcAddress(module uint32, procname string) (proc uint32, errno int) {
 
144
func GetProcAddress(module Handle, procname string) (proc Handle, errno int) {
140
145
        r0, _, e1 := Syscall(procGetProcAddress, 2, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0)
141
 
        proc = uint32(r0)
 
146
        proc = Handle(r0)
142
147
        if proc == 0 {
143
148
                if e1 != 0 {
144
149
                        errno = int(e1)
190
195
        return
191
196
}
192
197
 
193
 
func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle int32, errno int) {
 
198
func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, errno int) {
194
199
        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)
195
 
        handle = int32(r0)
196
 
        if handle == -1 {
 
200
        handle = Handle(r0)
 
201
        if handle == InvalidHandle {
197
202
                if e1 != 0 {
198
203
                        errno = int(e1)
199
204
                } else {
205
210
        return
206
211
}
207
212
 
208
 
func ReadFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
 
213
func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
209
214
        var _p0 *byte
210
215
        if len(buf) > 0 {
211
216
                _p0 = &buf[0]
223
228
        return
224
229
}
225
230
 
226
 
func WriteFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
 
231
func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
227
232
        var _p0 *byte
228
233
        if len(buf) > 0 {
229
234
                _p0 = &buf[0]
241
246
        return
242
247
}
243
248
 
244
 
func SetFilePointer(handle int32, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) {
 
249
func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) {
245
250
        r0, _, e1 := Syscall6(procSetFilePointer, 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
246
251
        newlowoffset = uint32(r0)
247
252
        if newlowoffset == 0xffffffff {
256
261
        return
257
262
}
258
263
 
259
 
func CloseHandle(handle int32) (errno int) {
 
264
func CloseHandle(handle Handle) (errno int) {
260
265
        r1, _, e1 := Syscall(procCloseHandle, 1, uintptr(handle), 0, 0)
261
266
        if int(r1) == 0 {
262
267
                if e1 != 0 {
270
275
        return
271
276
}
272
277
 
273
 
func GetStdHandle(stdhandle int32) (handle int32, errno int) {
 
278
func GetStdHandle(stdhandle int) (handle Handle, errno int) {
274
279
        r0, _, e1 := Syscall(procGetStdHandle, 1, uintptr(stdhandle), 0, 0)
275
 
        handle = int32(r0)
276
 
        if handle == -1 {
 
280
        handle = Handle(r0)
 
281
        if handle == InvalidHandle {
277
282
                if e1 != 0 {
278
283
                        errno = int(e1)
279
284
                } else {
285
290
        return
286
291
}
287
292
 
288
 
func FindFirstFile(name *uint16, data *Win32finddata) (handle int32, errno int) {
 
293
func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, errno int) {
289
294
        r0, _, e1 := Syscall(procFindFirstFileW, 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
290
 
        handle = int32(r0)
291
 
        if handle == -1 {
 
295
        handle = Handle(r0)
 
296
        if handle == InvalidHandle {
292
297
                if e1 != 0 {
293
298
                        errno = int(e1)
294
299
                } else {
300
305
        return
301
306
}
302
307
 
303
 
func FindNextFile(handle int32, data *Win32finddata) (errno int) {
 
308
func FindNextFile(handle Handle, data *Win32finddata) (errno int) {
304
309
        r1, _, e1 := Syscall(procFindNextFileW, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
305
310
        if int(r1) == 0 {
306
311
                if e1 != 0 {
314
319
        return
315
320
}
316
321
 
317
 
func FindClose(handle int32) (errno int) {
 
322
func FindClose(handle Handle) (errno int) {
318
323
        r1, _, e1 := Syscall(procFindClose, 1, uintptr(handle), 0, 0)
319
324
        if int(r1) == 0 {
320
325
                if e1 != 0 {
328
333
        return
329
334
}
330
335
 
331
 
func GetFileInformationByHandle(handle int32, data *ByHandleFileInformation) (errno int) {
 
336
func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (errno int) {
332
337
        r1, _, e1 := Syscall(procGetFileInformationByHandle, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
333
338
        if int(r1) == 0 {
334
339
                if e1 != 0 {
441
446
        return
442
447
}
443
448
 
444
 
func SetEndOfFile(handle int32) (errno int) {
 
449
func SetEndOfFile(handle Handle) (errno int) {
445
450
        r1, _, e1 := Syscall(procSetEndOfFile, 1, uintptr(handle), 0, 0)
446
451
        if int(r1) == 0 {
447
452
                if e1 != 0 {
480
485
        return
481
486
}
482
487
 
483
 
func CreateIoCompletionPort(filehandle int32, cphandle int32, key uint32, threadcnt uint32) (handle int32, errno int) {
 
488
func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, errno int) {
484
489
        r0, _, e1 := Syscall6(procCreateIoCompletionPort, 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
485
 
        handle = int32(r0)
 
490
        handle = Handle(r0)
486
491
        if handle == 0 {
487
492
                if e1 != 0 {
488
493
                        errno = int(e1)
495
500
        return
496
501
}
497
502
 
498
 
func GetQueuedCompletionStatus(cphandle int32, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) {
 
503
func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) {
499
504
        r1, _, e1 := Syscall6(procGetQueuedCompletionStatus, 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
500
505
        if int(r1) == 0 {
501
506
                if e1 != 0 {
509
514
        return
510
515
}
511
516
 
512
 
func CancelIo(s uint32) (errno int) {
 
517
func CancelIo(s Handle) (errno int) {
513
518
        r1, _, e1 := Syscall(procCancelIo, 1, uintptr(s), 0, 0)
514
519
        if int(r1) == 0 {
515
520
                if e1 != 0 {
543
548
        return
544
549
}
545
550
 
546
 
func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno int) {
 
551
func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, errno int) {
547
552
        var _p0 uint32
548
553
        if inheritHandle {
549
554
                _p0 = 1
551
556
                _p0 = 0
552
557
        }
553
558
        r0, _, e1 := Syscall(procOpenProcess, 3, uintptr(da), uintptr(_p0), uintptr(pid))
554
 
        handle = int32(r0)
 
559
        handle = Handle(r0)
555
560
        if handle == 0 {
556
561
                if e1 != 0 {
557
562
                        errno = int(e1)
564
569
        return
565
570
}
566
571
 
567
 
func TerminateProcess(handle int32, exitcode uint32) (errno int) {
 
572
func TerminateProcess(handle Handle, exitcode uint32) (errno int) {
568
573
        r1, _, e1 := Syscall(procTerminateProcess, 2, uintptr(handle), uintptr(exitcode), 0)
569
574
        if int(r1) == 0 {
570
575
                if e1 != 0 {
578
583
        return
579
584
}
580
585
 
581
 
func GetExitCodeProcess(handle int32, exitcode *uint32) (errno int) {
 
586
func GetExitCodeProcess(handle Handle, exitcode *uint32) (errno int) {
582
587
        r1, _, e1 := Syscall(procGetExitCodeProcess, 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
583
588
        if int(r1) == 0 {
584
589
                if e1 != 0 {
606
611
        return
607
612
}
608
613
 
609
 
func GetCurrentProcess() (pseudoHandle int32, errno int) {
 
614
func GetCurrentProcess() (pseudoHandle Handle, errno int) {
610
615
        r0, _, e1 := Syscall(procGetCurrentProcess, 0, 0, 0, 0)
611
 
        pseudoHandle = int32(r0)
 
616
        pseudoHandle = Handle(r0)
612
617
        if pseudoHandle == 0 {
613
618
                if e1 != 0 {
614
619
                        errno = int(e1)
621
626
        return
622
627
}
623
628
 
624
 
func DuplicateHandle(hSourceProcessHandle int32, hSourceHandle int32, hTargetProcessHandle int32, lpTargetHandle *int32, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) {
 
629
func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) {
625
630
        var _p0 uint32
626
631
        if bInheritHandle {
627
632
                _p0 = 1
641
646
        return
642
647
}
643
648
 
644
 
func WaitForSingleObject(handle int32, waitMilliseconds uint32) (event uint32, errno int) {
 
649
func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, errno int) {
645
650
        r0, _, e1 := Syscall(procWaitForSingleObject, 2, uintptr(handle), uintptr(waitMilliseconds), 0)
646
651
        event = uint32(r0)
647
652
        if event == 0xffffffff {
671
676
        return
672
677
}
673
678
 
674
 
func CreatePipe(readhandle *uint32, writehandle *uint32, sa *SecurityAttributes, size uint32) (errno int) {
 
679
func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (errno int) {
675
680
        r1, _, e1 := Syscall6(procCreatePipe, 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
676
681
        if int(r1) == 0 {
677
682
                if e1 != 0 {
685
690
        return
686
691
}
687
692
 
688
 
func GetFileType(filehandle uint32) (n uint32, errno int) {
 
693
func GetFileType(filehandle Handle) (n uint32, errno int) {
689
694
        r0, _, e1 := Syscall(procGetFileType, 1, uintptr(filehandle), 0, 0)
690
695
        n = uint32(r0)
691
696
        if n == 0 {
700
705
        return
701
706
}
702
707
 
703
 
func CryptAcquireContext(provhandle *uint32, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) {
 
708
func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) {
704
709
        r1, _, e1 := Syscall6(procCryptAcquireContextW, 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
705
710
        if int(r1) == 0 {
706
711
                if e1 != 0 {
714
719
        return
715
720
}
716
721
 
717
 
func CryptReleaseContext(provhandle uint32, flags uint32) (errno int) {
 
722
func CryptReleaseContext(provhandle Handle, flags uint32) (errno int) {
718
723
        r1, _, e1 := Syscall(procCryptReleaseContext, 2, uintptr(provhandle), uintptr(flags), 0)
719
724
        if int(r1) == 0 {
720
725
                if e1 != 0 {
728
733
        return
729
734
}
730
735
 
731
 
func CryptGenRandom(provhandle uint32, buflen uint32, buf *byte) (errno int) {
 
736
func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (errno int) {
732
737
        r1, _, e1 := Syscall(procCryptGenRandom, 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
733
738
        if int(r1) == 0 {
734
739
                if e1 != 0 {
800
805
        return
801
806
}
802
807
 
803
 
func SetFileTime(handle int32, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) {
 
808
func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) {
804
809
        r1, _, e1 := Syscall6(procSetFileTime, 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
805
810
        if int(r1) == 0 {
806
811
                if e1 != 0 {
864
869
        return
865
870
}
866
871
 
867
 
func LocalFree(hmem uint32) (handle uint32, errno int) {
 
872
func LocalFree(hmem Handle) (handle Handle, errno int) {
868
873
        r0, _, e1 := Syscall(procLocalFree, 1, uintptr(hmem), 0, 0)
869
 
        handle = uint32(r0)
 
874
        handle = Handle(r0)
870
875
        if handle != 0 {
871
876
                if e1 != 0 {
872
877
                        errno = int(e1)
879
884
        return
880
885
}
881
886
 
882
 
func SetHandleInformation(handle int32, mask uint32, flags uint32) (errno int) {
 
887
func SetHandleInformation(handle Handle, mask uint32, flags uint32) (errno int) {
883
888
        r1, _, e1 := Syscall(procSetHandleInformation, 3, uintptr(handle), uintptr(mask), uintptr(flags))
884
889
        if int(r1) == 0 {
885
890
                if e1 != 0 {
893
898
        return
894
899
}
895
900
 
896
 
func FlushFileBuffers(handle int32) (errno int) {
 
901
func FlushFileBuffers(handle Handle) (errno int) {
897
902
        r1, _, e1 := Syscall(procFlushFileBuffers, 1, uintptr(handle), 0, 0)
898
903
        if int(r1) == 0 {
899
904
                if e1 != 0 {
922
927
        return
923
928
}
924
929
 
925
 
func CreateFileMapping(fhandle int32, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle int32, errno int) {
 
930
func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, errno int) {
926
931
        r0, _, e1 := Syscall6(procCreateFileMappingW, 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
927
 
        handle = int32(r0)
 
932
        handle = Handle(r0)
928
933
        if handle == 0 {
929
934
                if e1 != 0 {
930
935
                        errno = int(e1)
937
942
        return
938
943
}
939
944
 
940
 
func MapViewOfFile(handle int32, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) {
 
945
func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) {
941
946
        r0, _, e1 := Syscall6(procMapViewOfFile, 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
942
947
        addr = uintptr(r0)
943
948
        if addr == 0 {
1008
1013
        return
1009
1014
}
1010
1015
 
 
1016
func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) {
 
1017
        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)
 
1018
        if int(r1) == 0 {
 
1019
                if e1 != 0 {
 
1020
                        errno = int(e1)
 
1021
                } else {
 
1022
                        errno = EINVAL
 
1023
                }
 
1024
        } else {
 
1025
                errno = 0
 
1026
        }
 
1027
        return
 
1028
}
 
1029
 
1011
1030
func WSAStartup(verreq uint32, data *WSAData) (sockerrno int) {
1012
1031
        r0, _, _ := Syscall(procWSAStartup, 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
1013
1032
        sockerrno = int(r0)
1028
1047
        return
1029
1048
}
1030
1049
 
1031
 
func socket(af int32, typ int32, protocol int32) (handle int32, errno int) {
 
1050
func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (errno int) {
 
1051
        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))
 
1052
        if int(r1) == -1 {
 
1053
                if e1 != 0 {
 
1054
                        errno = int(e1)
 
1055
                } else {
 
1056
                        errno = EINVAL
 
1057
                }
 
1058
        } else {
 
1059
                errno = 0
 
1060
        }
 
1061
        return
 
1062
}
 
1063
 
 
1064
func socket(af int32, typ int32, protocol int32) (handle Handle, errno int) {
1032
1065
        r0, _, e1 := Syscall(procsocket, 3, uintptr(af), uintptr(typ), uintptr(protocol))
1033
 
        handle = int32(r0)
1034
 
        if handle == -1 {
 
1066
        handle = Handle(r0)
 
1067
        if handle == InvalidHandle {
1035
1068
                if e1 != 0 {
1036
1069
                        errno = int(e1)
1037
1070
                } else {
1043
1076
        return
1044
1077
}
1045
1078
 
1046
 
func setsockopt(s int32, level int32, optname int32, optval *byte, optlen int32) (errno int) {
 
1079
func setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) {
1047
1080
        r1, _, e1 := Syscall6(procsetsockopt, 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
1048
1081
        if int(r1) == -1 {
1049
1082
                if e1 != 0 {
1057
1090
        return
1058
1091
}
1059
1092
 
1060
 
func bind(s int32, name uintptr, namelen int32) (errno int) {
 
1093
func bind(s Handle, name uintptr, namelen int32) (errno int) {
1061
1094
        r1, _, e1 := Syscall(procbind, 3, uintptr(s), uintptr(name), uintptr(namelen))
1062
1095
        if int(r1) == -1 {
1063
1096
                if e1 != 0 {
1071
1104
        return
1072
1105
}
1073
1106
 
1074
 
func connect(s int32, name uintptr, namelen int32) (errno int) {
 
1107
func connect(s Handle, name uintptr, namelen int32) (errno int) {
1075
1108
        r1, _, e1 := Syscall(procconnect, 3, uintptr(s), uintptr(name), uintptr(namelen))
1076
1109
        if int(r1) == -1 {
1077
1110
                if e1 != 0 {
1085
1118
        return
1086
1119
}
1087
1120
 
1088
 
func getsockname(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
 
1121
func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
1089
1122
        r1, _, e1 := Syscall(procgetsockname, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1090
1123
        if int(r1) == -1 {
1091
1124
                if e1 != 0 {
1099
1132
        return
1100
1133
}
1101
1134
 
1102
 
func getpeername(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
 
1135
func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
1103
1136
        r1, _, e1 := Syscall(procgetpeername, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1104
1137
        if int(r1) == -1 {
1105
1138
                if e1 != 0 {
1113
1146
        return
1114
1147
}
1115
1148
 
1116
 
func listen(s int32, backlog int32) (errno int) {
 
1149
func listen(s Handle, backlog int32) (errno int) {
1117
1150
        r1, _, e1 := Syscall(proclisten, 2, uintptr(s), uintptr(backlog), 0)
1118
1151
        if int(r1) == -1 {
1119
1152
                if e1 != 0 {
1127
1160
        return
1128
1161
}
1129
1162
 
1130
 
func shutdown(s int32, how int32) (errno int) {
 
1163
func shutdown(s Handle, how int32) (errno int) {
1131
1164
        r1, _, e1 := Syscall(procshutdown, 2, uintptr(s), uintptr(how), 0)
1132
1165
        if int(r1) == -1 {
1133
1166
                if e1 != 0 {
1141
1174
        return
1142
1175
}
1143
1176
 
1144
 
func Closesocket(s int32) (errno int) {
 
1177
func Closesocket(s Handle) (errno int) {
1145
1178
        r1, _, e1 := Syscall(procclosesocket, 1, uintptr(s), 0, 0)
1146
1179
        if int(r1) == -1 {
1147
1180
                if e1 != 0 {
1155
1188
        return
1156
1189
}
1157
1190
 
1158
 
func AcceptEx(ls uint32, as uint32, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) {
 
1191
func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) {
1159
1192
        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)
1160
1193
        if int(r1) == 0 {
1161
1194
                if e1 != 0 {
1174
1207
        return
1175
1208
}
1176
1209
 
1177
 
func WSARecv(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) {
 
1210
func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) {
1178
1211
        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)
1179
1212
        if int(r1) == -1 {
1180
1213
                if e1 != 0 {
1188
1221
        return
1189
1222
}
1190
1223
 
1191
 
func WSASend(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) {
 
1224
func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) {
1192
1225
        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)
1193
1226
        if int(r1) == -1 {
1194
1227
                if e1 != 0 {
1202
1235
        return
1203
1236
}
1204
1237
 
1205
 
func WSARecvFrom(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) {
 
1238
func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) {
1206
1239
        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)))
1207
1240
        if int(r1) == -1 {
1208
1241
                if e1 != 0 {
1216
1249
        return
1217
1250
}
1218
1251
 
1219
 
func WSASendTo(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) {
 
1252
func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) {
1220
1253
        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)))
1221
1254
        if int(r1) == -1 {
1222
1255
                if e1 != 0 {
1276
1309
        Syscall(procDnsRecordListFree, 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
1277
1310
        return
1278
1311
}
 
1312
 
 
1313
func GetIfEntry(pIfRow *MibIfRow) (errcode int) {
 
1314
        r0, _, _ := Syscall(procGetIfEntry, 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
 
1315
        errcode = int(r0)
 
1316
        return
 
1317
}
 
1318
 
 
1319
func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode int) {
 
1320
        r0, _, _ := Syscall(procGetAdaptersInfo, 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
 
1321
        errcode = int(r0)
 
1322
        return
 
1323
}