Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6)

Side by Side Diff: src/pkg/syscall/zsyscall_windows_amd64.go

Issue 4641093: code review 4641093: syscall: rearrange windows code so 386 and amd64 can sh... (Closed)
Patch Set: diff -r 0da92255341c https://go.googlecode.com/hg/ Created 13 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/syscall/zsyscall_windows_386.go ('k') | src/pkg/syscall/zsysnum_windows_amd64.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // mksyscall_windows.pl syscall_windows.go syscall_windows_amd64.go
2 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
3
4 package syscall
5
6 import "unsafe"
7
8 var (
9 modkernel32 = loadDll("kernel32.dll")
10 modadvapi32 = loadDll("advapi32.dll")
11 modshell32 = loadDll("shell32.dll")
12 modwsock32 = loadDll("wsock32.dll")
13 modws2_32 = loadDll("ws2_32.dll")
14 moddnsapi = loadDll("dnsapi.dll")
15 modiphlpapi = loadDll("iphlpapi.dll")
16
17 procGetLastError = getSysProcAddr(modkernel32, "GetLastErr or")
18 procLoadLibraryW = getSysProcAddr(modkernel32, "LoadLibrar yW")
19 procFreeLibrary = getSysProcAddr(modkernel32, "FreeLibrar y")
20 procGetProcAddress = getSysProcAddr(modkernel32, "GetProcAdd ress")
21 procGetVersion = getSysProcAddr(modkernel32, "GetVersion ")
22 procFormatMessageW = getSysProcAddr(modkernel32, "FormatMess ageW")
23 procExitProcess = getSysProcAddr(modkernel32, "ExitProces s")
24 procCreateFileW = getSysProcAddr(modkernel32, "CreateFile W")
25 procReadFile = getSysProcAddr(modkernel32, "ReadFile")
26 procWriteFile = getSysProcAddr(modkernel32, "WriteFile" )
27 procSetFilePointer = getSysProcAddr(modkernel32, "SetFilePoi nter")
28 procCloseHandle = getSysProcAddr(modkernel32, "CloseHandl e")
29 procGetStdHandle = getSysProcAddr(modkernel32, "GetStdHand le")
30 procFindFirstFileW = getSysProcAddr(modkernel32, "FindFirstF ileW")
31 procFindNextFileW = getSysProcAddr(modkernel32, "FindNextFi leW")
32 procFindClose = getSysProcAddr(modkernel32, "FindClose" )
33 procGetFileInformationByHandle = getSysProcAddr(modkernel32, "GetFileInf ormationByHandle")
34 procGetCurrentDirectoryW = getSysProcAddr(modkernel32, "GetCurrent DirectoryW")
35 procSetCurrentDirectoryW = getSysProcAddr(modkernel32, "SetCurrent DirectoryW")
36 procCreateDirectoryW = getSysProcAddr(modkernel32, "CreateDire ctoryW")
37 procRemoveDirectoryW = getSysProcAddr(modkernel32, "RemoveDire ctoryW")
38 procDeleteFileW = getSysProcAddr(modkernel32, "DeleteFile W")
39 procMoveFileW = getSysProcAddr(modkernel32, "MoveFileW" )
40 procGetComputerNameW = getSysProcAddr(modkernel32, "GetCompute rNameW")
41 procSetEndOfFile = getSysProcAddr(modkernel32, "SetEndOfFi le")
42 procGetSystemTimeAsFileTime = getSysProcAddr(modkernel32, "GetSystemT imeAsFileTime")
43 procSleep = getSysProcAddr(modkernel32, "Sleep")
44 procGetTimeZoneInformation = getSysProcAddr(modkernel32, "GetTimeZon eInformation")
45 procCreateIoCompletionPort = getSysProcAddr(modkernel32, "CreateIoCo mpletionPort")
46 procGetQueuedCompletionStatus = getSysProcAddr(modkernel32, "GetQueuedC ompletionStatus")
47 procCancelIo = getSysProcAddr(modkernel32, "CancelIo")
48 procCreateProcessW = getSysProcAddr(modkernel32, "CreateProc essW")
49 procOpenProcess = getSysProcAddr(modkernel32, "OpenProces s")
50 procTerminateProcess = getSysProcAddr(modkernel32, "TerminateP rocess")
51 procGetExitCodeProcess = getSysProcAddr(modkernel32, "GetExitCod eProcess")
52 procGetStartupInfoW = getSysProcAddr(modkernel32, "GetStartup InfoW")
53 procGetCurrentProcess = getSysProcAddr(modkernel32, "GetCurrent Process")
54 procDuplicateHandle = getSysProcAddr(modkernel32, "DuplicateH andle")
55 procWaitForSingleObject = getSysProcAddr(modkernel32, "WaitForSin gleObject")
56 procGetTempPathW = getSysProcAddr(modkernel32, "GetTempPat hW")
57 procCreatePipe = getSysProcAddr(modkernel32, "CreatePipe ")
58 procGetFileType = getSysProcAddr(modkernel32, "GetFileTyp e")
59 procCryptAcquireContextW = getSysProcAddr(modadvapi32, "CryptAcqui reContextW")
60 procCryptReleaseContext = getSysProcAddr(modadvapi32, "CryptRelea seContext")
61 procCryptGenRandom = getSysProcAddr(modadvapi32, "CryptGenRa ndom")
62 procGetEnvironmentStringsW = getSysProcAddr(modkernel32, "GetEnviron mentStringsW")
63 procFreeEnvironmentStringsW = getSysProcAddr(modkernel32, "FreeEnviro nmentStringsW")
64 procGetEnvironmentVariableW = getSysProcAddr(modkernel32, "GetEnviron mentVariableW")
65 procSetEnvironmentVariableW = getSysProcAddr(modkernel32, "SetEnviron mentVariableW")
66 procSetFileTime = getSysProcAddr(modkernel32, "SetFileTim e")
67 procGetFileAttributesW = getSysProcAddr(modkernel32, "GetFileAtt ributesW")
68 procSetFileAttributesW = getSysProcAddr(modkernel32, "SetFileAtt ributesW")
69 procGetCommandLineW = getSysProcAddr(modkernel32, "GetCommand LineW")
70 procCommandLineToArgvW = getSysProcAddr(modshell32, "CommandLine ToArgvW")
71 procLocalFree = getSysProcAddr(modkernel32, "LocalFree" )
72 procSetHandleInformation = getSysProcAddr(modkernel32, "SetHandleI nformation")
73 procFlushFileBuffers = getSysProcAddr(modkernel32, "FlushFileB uffers")
74 procGetFullPathNameW = getSysProcAddr(modkernel32, "GetFullPat hNameW")
75 procCreateFileMappingW = getSysProcAddr(modkernel32, "CreateFile MappingW")
76 procMapViewOfFile = getSysProcAddr(modkernel32, "MapViewOfF ile")
77 procUnmapViewOfFile = getSysProcAddr(modkernel32, "UnmapViewO fFile")
78 procFlushViewOfFile = getSysProcAddr(modkernel32, "FlushViewO fFile")
79 procVirtualLock = getSysProcAddr(modkernel32, "VirtualLoc k")
80 procVirtualUnlock = getSysProcAddr(modkernel32, "VirtualUnl ock")
81 procTransmitFile = getSysProcAddr(modwsock32, "TransmitFil e")
82 procWSAStartup = getSysProcAddr(modwsock32, "WSAStartup" )
83 procWSACleanup = getSysProcAddr(modwsock32, "WSACleanup" )
84 procWSAIoctl = getSysProcAddr(modws2_32, "WSAIoctl")
85 procsocket = getSysProcAddr(modwsock32, "socket")
86 procsetsockopt = getSysProcAddr(modwsock32, "setsockopt" )
87 procbind = getSysProcAddr(modwsock32, "bind")
88 procconnect = getSysProcAddr(modwsock32, "connect")
89 procgetsockname = getSysProcAddr(modwsock32, "getsockname ")
90 procgetpeername = getSysProcAddr(modwsock32, "getpeername ")
91 proclisten = getSysProcAddr(modwsock32, "listen")
92 procshutdown = getSysProcAddr(modwsock32, "shutdown")
93 procclosesocket = getSysProcAddr(modwsock32, "closesocket ")
94 procAcceptEx = getSysProcAddr(modwsock32, "AcceptEx")
95 procGetAcceptExSockaddrs = getSysProcAddr(modwsock32, "GetAcceptEx Sockaddrs")
96 procWSARecv = getSysProcAddr(modws2_32, "WSARecv")
97 procWSASend = getSysProcAddr(modws2_32, "WSASend")
98 procWSARecvFrom = getSysProcAddr(modws2_32, "WSARecvFrom" )
99 procWSASendTo = getSysProcAddr(modws2_32, "WSASendTo")
100 procgethostbyname = getSysProcAddr(modws2_32, "gethostbynam e")
101 procgetservbyname = getSysProcAddr(modws2_32, "getservbynam e")
102 procntohs = getSysProcAddr(modws2_32, "ntohs")
103 procDnsQuery_W = getSysProcAddr(moddnsapi, "DnsQuery_W")
104 procDnsRecordListFree = getSysProcAddr(moddnsapi, "DnsRecordLis tFree")
105 procGetIfEntry = getSysProcAddr(modiphlpapi, "GetIfEntry ")
106 procGetAdaptersInfo = getSysProcAddr(modiphlpapi, "GetAdapter sInfo")
107 )
108
109 func GetLastError() (lasterrno int) {
110 r0, _, _ := Syscall(procGetLastError, 0, 0, 0, 0)
111 lasterrno = int(r0)
112 return
113 }
114
115 func LoadLibrary(libname string) (handle Handle, errno int) {
116 r0, _, e1 := Syscall(procLoadLibraryW, 1, uintptr(unsafe.Pointer(StringT oUTF16Ptr(libname))), 0, 0)
117 handle = Handle(r0)
118 if handle == 0 {
119 if e1 != 0 {
120 errno = int(e1)
121 } else {
122 errno = EINVAL
123 }
124 } else {
125 errno = 0
126 }
127 return
128 }
129
130 func FreeLibrary(handle Handle) (errno int) {
131 r1, _, e1 := Syscall(procFreeLibrary, 1, uintptr(handle), 0, 0)
132 if int(r1) == 0 {
133 if e1 != 0 {
134 errno = int(e1)
135 } else {
136 errno = EINVAL
137 }
138 } else {
139 errno = 0
140 }
141 return
142 }
143
144 func GetProcAddress(module Handle, procname string) (proc Handle, errno int) {
145 r0, _, e1 := Syscall(procGetProcAddress, 2, uintptr(module), uintptr(uns afe.Pointer(StringBytePtr(procname))), 0)
146 proc = Handle(r0)
147 if proc == 0 {
148 if e1 != 0 {
149 errno = int(e1)
150 } else {
151 errno = EINVAL
152 }
153 } else {
154 errno = 0
155 }
156 return
157 }
158
159 func GetVersion() (ver uint32, errno int) {
160 r0, _, e1 := Syscall(procGetVersion, 0, 0, 0, 0)
161 ver = uint32(r0)
162 if ver == 0 {
163 if e1 != 0 {
164 errno = int(e1)
165 } else {
166 errno = EINVAL
167 }
168 } else {
169 errno = 0
170 }
171 return
172 }
173
174 func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, errno int) {
175 var _p0 *uint16
176 if len(buf) > 0 {
177 _p0 = &buf[0]
178 }
179 r0, _, e1 := Syscall9(procFormatMessageW, 7, uintptr(flags), uintptr(msg src), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len (buf)), uintptr(unsafe.Pointer(args)), 0, 0)
180 n = uint32(r0)
181 if n == 0 {
182 if e1 != 0 {
183 errno = int(e1)
184 } else {
185 errno = EINVAL
186 }
187 } else {
188 errno = 0
189 }
190 return
191 }
192
193 func ExitProcess(exitcode uint32) {
194 Syscall(procExitProcess, 1, uintptr(exitcode), 0, 0)
195 return
196 }
197
198 func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes , createmode uint32, attrs uint32, templatefile int32) (handle Handle, errno int ) {
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)
200 handle = Handle(r0)
201 if handle == InvalidHandle {
202 if e1 != 0 {
203 errno = int(e1)
204 } else {
205 errno = EINVAL
206 }
207 } else {
208 errno = 0
209 }
210 return
211 }
212
213 func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( errno int) {
214 var _p0 *byte
215 if len(buf) > 0 {
216 _p0 = &buf[0]
217 }
218 r1, _, e1 := Syscall6(procReadFile, 5, uintptr(handle), uintptr(unsafe.P ointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.P ointer(overlapped)), 0)
219 if int(r1) == 0 {
220 if e1 != 0 {
221 errno = int(e1)
222 } else {
223 errno = EINVAL
224 }
225 } else {
226 errno = 0
227 }
228 return
229 }
230
231 func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) {
232 var _p0 *byte
233 if len(buf) > 0 {
234 _p0 = &buf[0]
235 }
236 r1, _, e1 := Syscall6(procWriteFile, 5, uintptr(handle), uintptr(unsafe. Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe. Pointer(overlapped)), 0)
237 if int(r1) == 0 {
238 if e1 != 0 {
239 errno = int(e1)
240 } else {
241 errno = EINVAL
242 }
243 } else {
244 errno = 0
245 }
246 return
247 }
248
249 func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) {
250 r0, _, e1 := Syscall6(procSetFilePointer, 4, uintptr(handle), uintptr(lo woffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
251 newlowoffset = uint32(r0)
252 if newlowoffset == 0xffffffff {
253 if e1 != 0 {
254 errno = int(e1)
255 } else {
256 errno = EINVAL
257 }
258 } else {
259 errno = 0
260 }
261 return
262 }
263
264 func CloseHandle(handle Handle) (errno int) {
265 r1, _, e1 := Syscall(procCloseHandle, 1, uintptr(handle), 0, 0)
266 if int(r1) == 0 {
267 if e1 != 0 {
268 errno = int(e1)
269 } else {
270 errno = EINVAL
271 }
272 } else {
273 errno = 0
274 }
275 return
276 }
277
278 func GetStdHandle(stdhandle int) (handle Handle, errno int) {
279 r0, _, e1 := Syscall(procGetStdHandle, 1, uintptr(stdhandle), 0, 0)
280 handle = Handle(r0)
281 if handle == InvalidHandle {
282 if e1 != 0 {
283 errno = int(e1)
284 } else {
285 errno = EINVAL
286 }
287 } else {
288 errno = 0
289 }
290 return
291 }
292
293 func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, errno int) {
294 r0, _, e1 := Syscall(procFindFirstFileW, 2, uintptr(unsafe.Pointer(name) ), uintptr(unsafe.Pointer(data)), 0)
295 handle = Handle(r0)
296 if handle == InvalidHandle {
297 if e1 != 0 {
298 errno = int(e1)
299 } else {
300 errno = EINVAL
301 }
302 } else {
303 errno = 0
304 }
305 return
306 }
307
308 func FindNextFile(handle Handle, data *Win32finddata) (errno int) {
309 r1, _, e1 := Syscall(procFindNextFileW, 2, uintptr(handle), uintptr(unsa fe.Pointer(data)), 0)
310 if int(r1) == 0 {
311 if e1 != 0 {
312 errno = int(e1)
313 } else {
314 errno = EINVAL
315 }
316 } else {
317 errno = 0
318 }
319 return
320 }
321
322 func FindClose(handle Handle) (errno int) {
323 r1, _, e1 := Syscall(procFindClose, 1, uintptr(handle), 0, 0)
324 if int(r1) == 0 {
325 if e1 != 0 {
326 errno = int(e1)
327 } else {
328 errno = EINVAL
329 }
330 } else {
331 errno = 0
332 }
333 return
334 }
335
336 func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e rrno int) {
337 r1, _, e1 := Syscall(procGetFileInformationByHandle, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
338 if int(r1) == 0 {
339 if e1 != 0 {
340 errno = int(e1)
341 } else {
342 errno = EINVAL
343 }
344 } else {
345 errno = 0
346 }
347 return
348 }
349
350 func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, errno int) {
351 r0, _, e1 := Syscall(procGetCurrentDirectoryW, 2, uintptr(buflen), uintp tr(unsafe.Pointer(buf)), 0)
352 n = uint32(r0)
353 if n == 0 {
354 if e1 != 0 {
355 errno = int(e1)
356 } else {
357 errno = EINVAL
358 }
359 } else {
360 errno = 0
361 }
362 return
363 }
364
365 func SetCurrentDirectory(path *uint16) (errno int) {
366 r1, _, e1 := Syscall(procSetCurrentDirectoryW, 1, uintptr(unsafe.Pointer (path)), 0, 0)
367 if int(r1) == 0 {
368 if e1 != 0 {
369 errno = int(e1)
370 } else {
371 errno = EINVAL
372 }
373 } else {
374 errno = 0
375 }
376 return
377 }
378
379 func CreateDirectory(path *uint16, sa *SecurityAttributes) (errno int) {
380 r1, _, e1 := Syscall(procCreateDirectoryW, 2, uintptr(unsafe.Pointer(pat h)), uintptr(unsafe.Pointer(sa)), 0)
381 if int(r1) == 0 {
382 if e1 != 0 {
383 errno = int(e1)
384 } else {
385 errno = EINVAL
386 }
387 } else {
388 errno = 0
389 }
390 return
391 }
392
393 func RemoveDirectory(path *uint16) (errno int) {
394 r1, _, e1 := Syscall(procRemoveDirectoryW, 1, uintptr(unsafe.Pointer(pat h)), 0, 0)
395 if int(r1) == 0 {
396 if e1 != 0 {
397 errno = int(e1)
398 } else {
399 errno = EINVAL
400 }
401 } else {
402 errno = 0
403 }
404 return
405 }
406
407 func DeleteFile(path *uint16) (errno int) {
408 r1, _, e1 := Syscall(procDeleteFileW, 1, uintptr(unsafe.Pointer(path)), 0, 0)
409 if int(r1) == 0 {
410 if e1 != 0 {
411 errno = int(e1)
412 } else {
413 errno = EINVAL
414 }
415 } else {
416 errno = 0
417 }
418 return
419 }
420
421 func MoveFile(from *uint16, to *uint16) (errno int) {
422 r1, _, e1 := Syscall(procMoveFileW, 2, uintptr(unsafe.Pointer(from)), ui ntptr(unsafe.Pointer(to)), 0)
423 if int(r1) == 0 {
424 if e1 != 0 {
425 errno = int(e1)
426 } else {
427 errno = EINVAL
428 }
429 } else {
430 errno = 0
431 }
432 return
433 }
434
435 func GetComputerName(buf *uint16, n *uint32) (errno int) {
436 r1, _, e1 := Syscall(procGetComputerNameW, 2, uintptr(unsafe.Pointer(buf )), uintptr(unsafe.Pointer(n)), 0)
437 if int(r1) == 0 {
438 if e1 != 0 {
439 errno = int(e1)
440 } else {
441 errno = EINVAL
442 }
443 } else {
444 errno = 0
445 }
446 return
447 }
448
449 func SetEndOfFile(handle Handle) (errno int) {
450 r1, _, e1 := Syscall(procSetEndOfFile, 1, uintptr(handle), 0, 0)
451 if int(r1) == 0 {
452 if e1 != 0 {
453 errno = int(e1)
454 } else {
455 errno = EINVAL
456 }
457 } else {
458 errno = 0
459 }
460 return
461 }
462
463 func GetSystemTimeAsFileTime(time *Filetime) {
464 Syscall(procGetSystemTimeAsFileTime, 1, uintptr(unsafe.Pointer(time)), 0 , 0)
465 return
466 }
467
468 func sleep(msec uint32) {
469 Syscall(procSleep, 1, uintptr(msec), 0, 0)
470 return
471 }
472
473 func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, errno int) {
474 r0, _, e1 := Syscall(procGetTimeZoneInformation, 1, uintptr(unsafe.Point er(tzi)), 0, 0)
475 rc = uint32(r0)
476 if rc == 0xffffffff {
477 if e1 != 0 {
478 errno = int(e1)
479 } else {
480 errno = EINVAL
481 }
482 } else {
483 errno = 0
484 }
485 return
486 }
487
488 func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, thre adcnt uint32) (handle Handle, errno int) {
489 r0, _, e1 := Syscall6(procCreateIoCompletionPort, 4, uintptr(filehandle) , uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
490 handle = Handle(r0)
491 if handle == 0 {
492 if e1 != 0 {
493 errno = int(e1)
494 } else {
495 errno = EINVAL
496 }
497 } else {
498 errno = 0
499 }
500 return
501 }
502
503 func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overla pped **Overlapped, timeout uint32) (errno int) {
504 r1, _, e1 := Syscall6(procGetQueuedCompletionStatus, 5, uintptr(cphandle ), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Po inter(overlapped)), uintptr(timeout), 0)
505 if int(r1) == 0 {
506 if e1 != 0 {
507 errno = int(e1)
508 } else {
509 errno = EINVAL
510 }
511 } else {
512 errno = 0
513 }
514 return
515 }
516
517 func CancelIo(s Handle) (errno int) {
518 r1, _, e1 := Syscall(procCancelIo, 1, uintptr(s), 0, 0)
519 if int(r1) == 0 {
520 if e1 != 0 {
521 errno = int(e1)
522 } else {
523 errno = EINVAL
524 }
525 } else {
526 errno = 0
527 }
528 return
529 }
530
531 func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA ttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlag s uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (errno int) {
532 var _p0 uint32
533 if inheritHandles {
534 _p0 = 1
535 } else {
536 _p0 = 0
537 }
538 r1, _, e1 := Syscall12(procCreateProcessW, 10, uintptr(unsafe.Pointer(ap pName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecuri ty)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFla gs), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr( unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0)
539 if int(r1) == 0 {
540 if e1 != 0 {
541 errno = int(e1)
542 } else {
543 errno = EINVAL
544 }
545 } else {
546 errno = 0
547 }
548 return
549 }
550
551 func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, errn o int) {
552 var _p0 uint32
553 if inheritHandle {
554 _p0 = 1
555 } else {
556 _p0 = 0
557 }
558 r0, _, e1 := Syscall(procOpenProcess, 3, uintptr(da), uintptr(_p0), uint ptr(pid))
559 handle = Handle(r0)
560 if handle == 0 {
561 if e1 != 0 {
562 errno = int(e1)
563 } else {
564 errno = EINVAL
565 }
566 } else {
567 errno = 0
568 }
569 return
570 }
571
572 func TerminateProcess(handle Handle, exitcode uint32) (errno int) {
573 r1, _, e1 := Syscall(procTerminateProcess, 2, uintptr(handle), uintptr(e xitcode), 0)
574 if int(r1) == 0 {
575 if e1 != 0 {
576 errno = int(e1)
577 } else {
578 errno = EINVAL
579 }
580 } else {
581 errno = 0
582 }
583 return
584 }
585
586 func GetExitCodeProcess(handle Handle, exitcode *uint32) (errno int) {
587 r1, _, e1 := Syscall(procGetExitCodeProcess, 2, uintptr(handle), uintptr (unsafe.Pointer(exitcode)), 0)
588 if int(r1) == 0 {
589 if e1 != 0 {
590 errno = int(e1)
591 } else {
592 errno = EINVAL
593 }
594 } else {
595 errno = 0
596 }
597 return
598 }
599
600 func GetStartupInfo(startupInfo *StartupInfo) (errno int) {
601 r1, _, e1 := Syscall(procGetStartupInfoW, 1, uintptr(unsafe.Pointer(star tupInfo)), 0, 0)
602 if int(r1) == 0 {
603 if e1 != 0 {
604 errno = int(e1)
605 } else {
606 errno = EINVAL
607 }
608 } else {
609 errno = 0
610 }
611 return
612 }
613
614 func GetCurrentProcess() (pseudoHandle Handle, errno int) {
615 r0, _, e1 := Syscall(procGetCurrentProcess, 0, 0, 0, 0)
616 pseudoHandle = Handle(r0)
617 if pseudoHandle == 0 {
618 if e1 != 0 {
619 errno = int(e1)
620 } else {
621 errno = EINVAL
622 }
623 } else {
624 errno = 0
625 }
626 return
627 }
628
629 func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP rocessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHan dle bool, dwOptions uint32) (errno int) {
630 var _p0 uint32
631 if bInheritHandle {
632 _p0 = 1
633 } else {
634 _p0 = 0
635 }
636 r1, _, e1 := Syscall9(procDuplicateHandle, 7, uintptr(hSourceProcessHand le), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Point er(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
637 if int(r1) == 0 {
638 if e1 != 0 {
639 errno = int(e1)
640 } else {
641 errno = EINVAL
642 }
643 } else {
644 errno = 0
645 }
646 return
647 }
648
649 func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, errno int) {
650 r0, _, e1 := Syscall(procWaitForSingleObject, 2, uintptr(handle), uintpt r(waitMilliseconds), 0)
651 event = uint32(r0)
652 if event == 0xffffffff {
653 if e1 != 0 {
654 errno = int(e1)
655 } else {
656 errno = EINVAL
657 }
658 } else {
659 errno = 0
660 }
661 return
662 }
663
664 func GetTempPath(buflen uint32, buf *uint16) (n uint32, errno int) {
665 r0, _, e1 := Syscall(procGetTempPathW, 2, uintptr(buflen), uintptr(unsaf e.Pointer(buf)), 0)
666 n = uint32(r0)
667 if n == 0 {
668 if e1 != 0 {
669 errno = int(e1)
670 } else {
671 errno = EINVAL
672 }
673 } else {
674 errno = 0
675 }
676 return
677 }
678
679 func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (errno int) {
680 r1, _, e1 := Syscall6(procCreatePipe, 4, uintptr(unsafe.Pointer(readhand le)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr (size), 0, 0)
681 if int(r1) == 0 {
682 if e1 != 0 {
683 errno = int(e1)
684 } else {
685 errno = EINVAL
686 }
687 } else {
688 errno = 0
689 }
690 return
691 }
692
693 func GetFileType(filehandle Handle) (n uint32, errno int) {
694 r0, _, e1 := Syscall(procGetFileType, 1, uintptr(filehandle), 0, 0)
695 n = uint32(r0)
696 if n == 0 {
697 if e1 != 0 {
698 errno = int(e1)
699 } else {
700 errno = EINVAL
701 }
702 } else {
703 errno = 0
704 }
705 return
706 }
707
708 func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 , provtype uint32, flags uint32) (errno int) {
709 r1, _, e1 := Syscall6(procCryptAcquireContextW, 5, uintptr(unsafe.Pointe r(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provi der)), uintptr(provtype), uintptr(flags), 0)
710 if int(r1) == 0 {
711 if e1 != 0 {
712 errno = int(e1)
713 } else {
714 errno = EINVAL
715 }
716 } else {
717 errno = 0
718 }
719 return
720 }
721
722 func CryptReleaseContext(provhandle Handle, flags uint32) (errno int) {
723 r1, _, e1 := Syscall(procCryptReleaseContext, 2, uintptr(provhandle), ui ntptr(flags), 0)
724 if int(r1) == 0 {
725 if e1 != 0 {
726 errno = int(e1)
727 } else {
728 errno = EINVAL
729 }
730 } else {
731 errno = 0
732 }
733 return
734 }
735
736 func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (errno int) {
737 r1, _, e1 := Syscall(procCryptGenRandom, 3, uintptr(provhandle), uintptr (buflen), uintptr(unsafe.Pointer(buf)))
738 if int(r1) == 0 {
739 if e1 != 0 {
740 errno = int(e1)
741 } else {
742 errno = EINVAL
743 }
744 } else {
745 errno = 0
746 }
747 return
748 }
749
750 func GetEnvironmentStrings() (envs *uint16, errno int) {
751 r0, _, e1 := Syscall(procGetEnvironmentStringsW, 0, 0, 0, 0)
752 envs = (*uint16)(unsafe.Pointer(r0))
753 if envs == nil {
754 if e1 != 0 {
755 errno = int(e1)
756 } else {
757 errno = EINVAL
758 }
759 } else {
760 errno = 0
761 }
762 return
763 }
764
765 func FreeEnvironmentStrings(envs *uint16) (errno int) {
766 r1, _, e1 := Syscall(procFreeEnvironmentStringsW, 1, uintptr(unsafe.Poin ter(envs)), 0, 0)
767 if int(r1) == 0 {
768 if e1 != 0 {
769 errno = int(e1)
770 } else {
771 errno = EINVAL
772 }
773 } else {
774 errno = 0
775 }
776 return
777 }
778
779 func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 , errno int) {
780 r0, _, e1 := Syscall(procGetEnvironmentVariableW, 3, uintptr(unsafe.Poin ter(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size))
781 n = uint32(r0)
782 if n == 0 {
783 if e1 != 0 {
784 errno = int(e1)
785 } else {
786 errno = EINVAL
787 }
788 } else {
789 errno = 0
790 }
791 return
792 }
793
794 func SetEnvironmentVariable(name *uint16, value *uint16) (errno int) {
795 r1, _, e1 := Syscall(procSetEnvironmentVariableW, 2, uintptr(unsafe.Poin ter(name)), uintptr(unsafe.Pointer(value)), 0)
796 if int(r1) == 0 {
797 if e1 != 0 {
798 errno = int(e1)
799 } else {
800 errno = EINVAL
801 }
802 } else {
803 errno = 0
804 }
805 return
806 }
807
808 func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim e) (errno int) {
809 r1, _, e1 := Syscall6(procSetFileTime, 4, uintptr(handle), uintptr(unsaf e.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime) ), 0, 0)
810 if int(r1) == 0 {
811 if e1 != 0 {
812 errno = int(e1)
813 } else {
814 errno = EINVAL
815 }
816 } else {
817 errno = 0
818 }
819 return
820 }
821
822 func GetFileAttributes(name *uint16) (attrs uint32, errno int) {
823 r0, _, e1 := Syscall(procGetFileAttributesW, 1, uintptr(unsafe.Pointer(n ame)), 0, 0)
824 attrs = uint32(r0)
825 if attrs == INVALID_FILE_ATTRIBUTES {
826 if e1 != 0 {
827 errno = int(e1)
828 } else {
829 errno = EINVAL
830 }
831 } else {
832 errno = 0
833 }
834 return
835 }
836
837 func SetFileAttributes(name *uint16, attrs uint32) (errno int) {
838 r1, _, e1 := Syscall(procSetFileAttributesW, 2, uintptr(unsafe.Pointer(n ame)), uintptr(attrs), 0)
839 if int(r1) == 0 {
840 if e1 != 0 {
841 errno = int(e1)
842 } else {
843 errno = EINVAL
844 }
845 } else {
846 errno = 0
847 }
848 return
849 }
850
851 func GetCommandLine() (cmd *uint16) {
852 r0, _, _ := Syscall(procGetCommandLineW, 0, 0, 0, 0)
853 cmd = (*uint16)(unsafe.Pointer(r0))
854 return
855 }
856
857 func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err no int) {
858 r0, _, e1 := Syscall(procCommandLineToArgvW, 2, uintptr(unsafe.Pointer(c md)), uintptr(unsafe.Pointer(argc)), 0)
859 argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0))
860 if argv == nil {
861 if e1 != 0 {
862 errno = int(e1)
863 } else {
864 errno = EINVAL
865 }
866 } else {
867 errno = 0
868 }
869 return
870 }
871
872 func LocalFree(hmem Handle) (handle Handle, errno int) {
873 r0, _, e1 := Syscall(procLocalFree, 1, uintptr(hmem), 0, 0)
874 handle = Handle(r0)
875 if handle != 0 {
876 if e1 != 0 {
877 errno = int(e1)
878 } else {
879 errno = EINVAL
880 }
881 } else {
882 errno = 0
883 }
884 return
885 }
886
887 func SetHandleInformation(handle Handle, mask uint32, flags uint32) (errno int) {
888 r1, _, e1 := Syscall(procSetHandleInformation, 3, uintptr(handle), uintp tr(mask), uintptr(flags))
889 if int(r1) == 0 {
890 if e1 != 0 {
891 errno = int(e1)
892 } else {
893 errno = EINVAL
894 }
895 } else {
896 errno = 0
897 }
898 return
899 }
900
901 func FlushFileBuffers(handle Handle) (errno int) {
902 r1, _, e1 := Syscall(procFlushFileBuffers, 1, uintptr(handle), 0, 0)
903 if int(r1) == 0 {
904 if e1 != 0 {
905 errno = int(e1)
906 } else {
907 errno = EINVAL
908 }
909 } else {
910 errno = 0
911 }
912 return
913 }
914
915 func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( n uint32, errno int) {
916 r0, _, e1 := Syscall6(procGetFullPathNameW, 4, uintptr(unsafe.Pointer(pa th)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fnam e)), 0, 0)
917 n = uint32(r0)
918 if n == 0 {
919 if e1 != 0 {
920 errno = int(e1)
921 } else {
922 errno = EINVAL
923 }
924 } else {
925 errno = 0
926 }
927 return
928 }
929
930 func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS izeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, errno int) {
931 r0, _, e1 := Syscall6(procCreateFileMappingW, 6, uintptr(fhandle), uintp tr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow) , uintptr(unsafe.Pointer(name)))
932 handle = Handle(r0)
933 if handle == 0 {
934 if e1 != 0 {
935 errno = int(e1)
936 } else {
937 errno = EINVAL
938 }
939 } else {
940 errno = 0
941 }
942 return
943 }
944
945 func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui nt32, length uintptr) (addr uintptr, errno int) {
946 r0, _, e1 := Syscall6(procMapViewOfFile, 5, uintptr(handle), uintptr(acc ess), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
947 addr = uintptr(r0)
948 if addr == 0 {
949 if e1 != 0 {
950 errno = int(e1)
951 } else {
952 errno = EINVAL
953 }
954 } else {
955 errno = 0
956 }
957 return
958 }
959
960 func UnmapViewOfFile(addr uintptr) (errno int) {
961 r1, _, e1 := Syscall(procUnmapViewOfFile, 1, uintptr(addr), 0, 0)
962 if int(r1) == 0 {
963 if e1 != 0 {
964 errno = int(e1)
965 } else {
966 errno = EINVAL
967 }
968 } else {
969 errno = 0
970 }
971 return
972 }
973
974 func FlushViewOfFile(addr uintptr, length uintptr) (errno int) {
975 r1, _, e1 := Syscall(procFlushViewOfFile, 2, uintptr(addr), uintptr(leng th), 0)
976 if int(r1) == 0 {
977 if e1 != 0 {
978 errno = int(e1)
979 } else {
980 errno = EINVAL
981 }
982 } else {
983 errno = 0
984 }
985 return
986 }
987
988 func VirtualLock(addr uintptr, length uintptr) (errno int) {
989 r1, _, e1 := Syscall(procVirtualLock, 2, uintptr(addr), uintptr(length), 0)
990 if int(r1) == 0 {
991 if e1 != 0 {
992 errno = int(e1)
993 } else {
994 errno = EINVAL
995 }
996 } else {
997 errno = 0
998 }
999 return
1000 }
1001
1002 func VirtualUnlock(addr uintptr, length uintptr) (errno int) {
1003 r1, _, e1 := Syscall(procVirtualUnlock, 2, uintptr(addr), uintptr(length ), 0)
1004 if int(r1) == 0 {
1005 if e1 != 0 {
1006 errno = int(e1)
1007 } else {
1008 errno = EINVAL
1009 }
1010 } else {
1011 errno = 0
1012 }
1013 return
1014 }
1015
1016 func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint 32, 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
1030 func WSAStartup(verreq uint32, data *WSAData) (sockerrno int) {
1031 r0, _, _ := Syscall(procWSAStartup, 2, uintptr(verreq), uintptr(unsafe.P ointer(data)), 0)
1032 sockerrno = int(r0)
1033 return
1034 }
1035
1036 func WSACleanup() (errno int) {
1037 r1, _, e1 := Syscall(procWSACleanup, 0, 0, 0, 0)
1038 if int(r1) == -1 {
1039 if e1 != 0 {
1040 errno = int(e1)
1041 } else {
1042 errno = EINVAL
1043 }
1044 } else {
1045 errno = 0
1046 }
1047 return
1048 }
1049
1050 func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo b uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (errn o int) {
1051 r1, _, e1 := Syscall9(procWSAIoctl, 9, uintptr(s), uintptr(iocc), uintpt r(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintpt r(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uin tptr(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) {
1065 r0, _, e1 := Syscall(procsocket, 3, uintptr(af), uintptr(typ), uintptr(p rotocol))
1066 handle = Handle(r0)
1067 if handle == InvalidHandle {
1068 if e1 != 0 {
1069 errno = int(e1)
1070 } else {
1071 errno = EINVAL
1072 }
1073 } else {
1074 errno = 0
1075 }
1076 return
1077 }
1078
1079 func setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 ) (errno int) {
1080 r1, _, e1 := Syscall6(procsetsockopt, 5, uintptr(s), uintptr(level), uin tptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
1081 if int(r1) == -1 {
1082 if e1 != 0 {
1083 errno = int(e1)
1084 } else {
1085 errno = EINVAL
1086 }
1087 } else {
1088 errno = 0
1089 }
1090 return
1091 }
1092
1093 func bind(s Handle, name uintptr, namelen int32) (errno int) {
1094 r1, _, e1 := Syscall(procbind, 3, uintptr(s), uintptr(name), uintptr(nam elen))
1095 if int(r1) == -1 {
1096 if e1 != 0 {
1097 errno = int(e1)
1098 } else {
1099 errno = EINVAL
1100 }
1101 } else {
1102 errno = 0
1103 }
1104 return
1105 }
1106
1107 func connect(s Handle, name uintptr, namelen int32) (errno int) {
1108 r1, _, e1 := Syscall(procconnect, 3, uintptr(s), uintptr(name), uintptr( namelen))
1109 if int(r1) == -1 {
1110 if e1 != 0 {
1111 errno = int(e1)
1112 } else {
1113 errno = EINVAL
1114 }
1115 } else {
1116 errno = 0
1117 }
1118 return
1119 }
1120
1121 func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
1122 r1, _, e1 := Syscall(procgetsockname, 3, uintptr(s), uintptr(unsafe.Poin ter(rsa)), uintptr(unsafe.Pointer(addrlen)))
1123 if int(r1) == -1 {
1124 if e1 != 0 {
1125 errno = int(e1)
1126 } else {
1127 errno = EINVAL
1128 }
1129 } else {
1130 errno = 0
1131 }
1132 return
1133 }
1134
1135 func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) {
1136 r1, _, e1 := Syscall(procgetpeername, 3, uintptr(s), uintptr(unsafe.Poin ter(rsa)), uintptr(unsafe.Pointer(addrlen)))
1137 if int(r1) == -1 {
1138 if e1 != 0 {
1139 errno = int(e1)
1140 } else {
1141 errno = EINVAL
1142 }
1143 } else {
1144 errno = 0
1145 }
1146 return
1147 }
1148
1149 func listen(s Handle, backlog int32) (errno int) {
1150 r1, _, e1 := Syscall(proclisten, 2, uintptr(s), uintptr(backlog), 0)
1151 if int(r1) == -1 {
1152 if e1 != 0 {
1153 errno = int(e1)
1154 } else {
1155 errno = EINVAL
1156 }
1157 } else {
1158 errno = 0
1159 }
1160 return
1161 }
1162
1163 func shutdown(s Handle, how int32) (errno int) {
1164 r1, _, e1 := Syscall(procshutdown, 2, uintptr(s), uintptr(how), 0)
1165 if int(r1) == -1 {
1166 if e1 != 0 {
1167 errno = int(e1)
1168 } else {
1169 errno = EINVAL
1170 }
1171 } else {
1172 errno = 0
1173 }
1174 return
1175 }
1176
1177 func Closesocket(s Handle) (errno int) {
1178 r1, _, e1 := Syscall(procclosesocket, 1, uintptr(s), 0, 0)
1179 if int(r1) == -1 {
1180 if e1 != 0 {
1181 errno = int(e1)
1182 } else {
1183 errno = EINVAL
1184 }
1185 } else {
1186 errno = 0
1187 }
1188 return
1189 }
1190
1191 func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32 , raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) {
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)
1193 if int(r1) == 0 {
1194 if e1 != 0 {
1195 errno = int(e1)
1196 } else {
1197 errno = EINVAL
1198 }
1199 } else {
1200 errno = 0
1201 }
1202 return
1203 }
1204
1205 func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen * int32) {
1206 Syscall9(procGetAcceptExSockaddrs, 8, uintptr(unsafe.Pointer(buf)), uint ptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrs a)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(un safe.Pointer(rrsalen)), 0)
1207 return
1208 }
1209
1210 func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 , overlapped *Overlapped, croutine *byte) (errno int) {
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)
1212 if int(r1) == -1 {
1213 if e1 != 0 {
1214 errno = int(e1)
1215 } else {
1216 errno = EINVAL
1217 }
1218 } else {
1219 errno = 0
1220 }
1221 return
1222 }
1223
1224 func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) {
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)
1226 if int(r1) == -1 {
1227 if e1 != 0 {
1228 errno = int(e1)
1229 } else {
1230 errno = EINVAL
1231 }
1232 } else {
1233 errno = 0
1234 }
1235 return
1236 }
1237
1238 func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui nt32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *by te) (errno int) {
1239 r1, _, e1 := Syscall9(procWSARecvFrom, 9, uintptr(s), uintptr(unsafe.Poi nter(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Poi nter(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), u intptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
1240 if int(r1) == -1 {
1241 if e1 != 0 {
1242 errno = int(e1)
1243 } else {
1244 errno = EINVAL
1245 }
1246 } else {
1247 errno = 0
1248 }
1249 return
1250 }
1251
1252 func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 , to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errn o int) {
1253 r1, _, e1 := Syscall9(procWSASendTo, 9, uintptr(s), uintptr(unsafe.Point er(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintp tr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uin tptr(unsafe.Pointer(croutine)))
1254 if int(r1) == -1 {
1255 if e1 != 0 {
1256 errno = int(e1)
1257 } else {
1258 errno = EINVAL
1259 }
1260 } else {
1261 errno = 0
1262 }
1263 return
1264 }
1265
1266 func GetHostByName(name string) (h *Hostent, errno int) {
1267 r0, _, e1 := Syscall(procgethostbyname, 1, uintptr(unsafe.Pointer(String BytePtr(name))), 0, 0)
1268 h = (*Hostent)(unsafe.Pointer(r0))
1269 if h == nil {
1270 if e1 != 0 {
1271 errno = int(e1)
1272 } else {
1273 errno = EINVAL
1274 }
1275 } else {
1276 errno = 0
1277 }
1278 return
1279 }
1280
1281 func GetServByName(name string, proto string) (s *Servent, errno int) {
1282 r0, _, e1 := Syscall(procgetservbyname, 2, uintptr(unsafe.Pointer(String BytePtr(name))), uintptr(unsafe.Pointer(StringBytePtr(proto))), 0)
1283 s = (*Servent)(unsafe.Pointer(r0))
1284 if s == nil {
1285 if e1 != 0 {
1286 errno = int(e1)
1287 } else {
1288 errno = EINVAL
1289 }
1290 } else {
1291 errno = 0
1292 }
1293 return
1294 }
1295
1296 func Ntohs(netshort uint16) (u uint16) {
1297 r0, _, _ := Syscall(procntohs, 1, uintptr(netshort), 0, 0)
1298 u = uint16(r0)
1299 return
1300 }
1301
1302 func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSR ecord, pr *byte) (status uint32) {
1303 r0, _, _ := Syscall6(procDnsQuery_W, 6, uintptr(unsafe.Pointer(StringToU TF16Ptr(name))), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra) ), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
1304 status = uint32(r0)
1305 return
1306 }
1307
1308 func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
1309 Syscall(procDnsRecordListFree, 2, uintptr(unsafe.Pointer(rl)), uintptr(f reetype), 0)
1310 return
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 }
OLDNEW
« no previous file with comments | « src/pkg/syscall/zsyscall_windows_386.go ('k') | src/pkg/syscall/zsysnum_windows_amd64.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b