github.com/hbdrawn/golang@v0.0.0-20141214014649-6b835209aba2/src/syscall/zsyscall_windows.go (about) 1 // go build mksyscall_windows.go && ./mksyscall_windows syscall_windows.go security_windows.go 2 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT 3 4 package syscall 5 6 import "unsafe" 7 8 var ( 9 modkernel32 = NewLazyDLL("kernel32.dll") 10 modadvapi32 = NewLazyDLL("advapi32.dll") 11 modshell32 = NewLazyDLL("shell32.dll") 12 modmswsock = NewLazyDLL("mswsock.dll") 13 modcrypt32 = NewLazyDLL("crypt32.dll") 14 modws2_32 = NewLazyDLL("ws2_32.dll") 15 moddnsapi = NewLazyDLL("dnsapi.dll") 16 modiphlpapi = NewLazyDLL("iphlpapi.dll") 17 modsecur32 = NewLazyDLL("secur32.dll") 18 modnetapi32 = NewLazyDLL("netapi32.dll") 19 moduserenv = NewLazyDLL("userenv.dll") 20 21 procGetLastError = modkernel32.NewProc("GetLastError") 22 procLoadLibraryW = modkernel32.NewProc("LoadLibraryW") 23 procFreeLibrary = modkernel32.NewProc("FreeLibrary") 24 procGetProcAddress = modkernel32.NewProc("GetProcAddress") 25 procGetVersion = modkernel32.NewProc("GetVersion") 26 procFormatMessageW = modkernel32.NewProc("FormatMessageW") 27 procExitProcess = modkernel32.NewProc("ExitProcess") 28 procCreateFileW = modkernel32.NewProc("CreateFileW") 29 procReadFile = modkernel32.NewProc("ReadFile") 30 procWriteFile = modkernel32.NewProc("WriteFile") 31 procSetFilePointer = modkernel32.NewProc("SetFilePointer") 32 procCloseHandle = modkernel32.NewProc("CloseHandle") 33 procGetStdHandle = modkernel32.NewProc("GetStdHandle") 34 procFindFirstFileW = modkernel32.NewProc("FindFirstFileW") 35 procFindNextFileW = modkernel32.NewProc("FindNextFileW") 36 procFindClose = modkernel32.NewProc("FindClose") 37 procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle") 38 procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") 39 procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") 40 procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW") 41 procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW") 42 procDeleteFileW = modkernel32.NewProc("DeleteFileW") 43 procMoveFileW = modkernel32.NewProc("MoveFileW") 44 procGetComputerNameW = modkernel32.NewProc("GetComputerNameW") 45 procSetEndOfFile = modkernel32.NewProc("SetEndOfFile") 46 procGetSystemTimeAsFileTime = modkernel32.NewProc("GetSystemTimeAsFileTime") 47 procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation") 48 procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") 49 procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus") 50 procPostQueuedCompletionStatus = modkernel32.NewProc("PostQueuedCompletionStatus") 51 procCancelIo = modkernel32.NewProc("CancelIo") 52 procCancelIoEx = modkernel32.NewProc("CancelIoEx") 53 procCreateProcessW = modkernel32.NewProc("CreateProcessW") 54 procOpenProcess = modkernel32.NewProc("OpenProcess") 55 procTerminateProcess = modkernel32.NewProc("TerminateProcess") 56 procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess") 57 procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW") 58 procGetCurrentProcess = modkernel32.NewProc("GetCurrentProcess") 59 procGetProcessTimes = modkernel32.NewProc("GetProcessTimes") 60 procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") 61 procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") 62 procGetTempPathW = modkernel32.NewProc("GetTempPathW") 63 procCreatePipe = modkernel32.NewProc("CreatePipe") 64 procGetFileType = modkernel32.NewProc("GetFileType") 65 procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW") 66 procCryptReleaseContext = modadvapi32.NewProc("CryptReleaseContext") 67 procCryptGenRandom = modadvapi32.NewProc("CryptGenRandom") 68 procGetEnvironmentStringsW = modkernel32.NewProc("GetEnvironmentStringsW") 69 procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW") 70 procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW") 71 procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") 72 procSetFileTime = modkernel32.NewProc("SetFileTime") 73 procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW") 74 procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW") 75 procGetFileAttributesExW = modkernel32.NewProc("GetFileAttributesExW") 76 procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") 77 procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW") 78 procLocalFree = modkernel32.NewProc("LocalFree") 79 procSetHandleInformation = modkernel32.NewProc("SetHandleInformation") 80 procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers") 81 procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW") 82 procGetLongPathNameW = modkernel32.NewProc("GetLongPathNameW") 83 procGetShortPathNameW = modkernel32.NewProc("GetShortPathNameW") 84 procCreateFileMappingW = modkernel32.NewProc("CreateFileMappingW") 85 procMapViewOfFile = modkernel32.NewProc("MapViewOfFile") 86 procUnmapViewOfFile = modkernel32.NewProc("UnmapViewOfFile") 87 procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile") 88 procVirtualLock = modkernel32.NewProc("VirtualLock") 89 procVirtualUnlock = modkernel32.NewProc("VirtualUnlock") 90 procTransmitFile = modmswsock.NewProc("TransmitFile") 91 procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW") 92 procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW") 93 procCertOpenStore = modcrypt32.NewProc("CertOpenStore") 94 procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore") 95 procCertAddCertificateContextToStore = modcrypt32.NewProc("CertAddCertificateContextToStore") 96 procCertCloseStore = modcrypt32.NewProc("CertCloseStore") 97 procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain") 98 procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain") 99 procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext") 100 procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext") 101 procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy") 102 procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW") 103 procRegCloseKey = modadvapi32.NewProc("RegCloseKey") 104 procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW") 105 procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW") 106 procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW") 107 procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") 108 procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") 109 procWriteConsoleW = modkernel32.NewProc("WriteConsoleW") 110 procReadConsoleW = modkernel32.NewProc("ReadConsoleW") 111 procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") 112 procProcess32FirstW = modkernel32.NewProc("Process32FirstW") 113 procProcess32NextW = modkernel32.NewProc("Process32NextW") 114 procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") 115 procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW") 116 procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW") 117 procWSAStartup = modws2_32.NewProc("WSAStartup") 118 procWSACleanup = modws2_32.NewProc("WSACleanup") 119 procWSAIoctl = modws2_32.NewProc("WSAIoctl") 120 procsocket = modws2_32.NewProc("socket") 121 procsetsockopt = modws2_32.NewProc("setsockopt") 122 procgetsockopt = modws2_32.NewProc("getsockopt") 123 procbind = modws2_32.NewProc("bind") 124 procconnect = modws2_32.NewProc("connect") 125 procgetsockname = modws2_32.NewProc("getsockname") 126 procgetpeername = modws2_32.NewProc("getpeername") 127 proclisten = modws2_32.NewProc("listen") 128 procshutdown = modws2_32.NewProc("shutdown") 129 procclosesocket = modws2_32.NewProc("closesocket") 130 procAcceptEx = modmswsock.NewProc("AcceptEx") 131 procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs") 132 procWSARecv = modws2_32.NewProc("WSARecv") 133 procWSASend = modws2_32.NewProc("WSASend") 134 procWSARecvFrom = modws2_32.NewProc("WSARecvFrom") 135 procWSASendTo = modws2_32.NewProc("WSASendTo") 136 procgethostbyname = modws2_32.NewProc("gethostbyname") 137 procgetservbyname = modws2_32.NewProc("getservbyname") 138 procntohs = modws2_32.NewProc("ntohs") 139 procgetprotobyname = modws2_32.NewProc("getprotobyname") 140 procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W") 141 procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree") 142 procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W") 143 procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW") 144 procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW") 145 procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") 146 procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") 147 procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes") 148 procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW") 149 procTranslateNameW = modsecur32.NewProc("TranslateNameW") 150 procGetUserNameExW = modsecur32.NewProc("GetUserNameExW") 151 procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo") 152 procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation") 153 procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree") 154 procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW") 155 procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW") 156 procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW") 157 procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW") 158 procGetLengthSid = modadvapi32.NewProc("GetLengthSid") 159 procCopySid = modadvapi32.NewProc("CopySid") 160 procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken") 161 procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation") 162 procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") 163 ) 164 165 func GetLastError() (lasterr error) { 166 r0, _, _ := Syscall(procGetLastError.Addr(), 0, 0, 0, 0) 167 if r0 != 0 { 168 lasterr = Errno(r0) 169 } 170 return 171 } 172 173 func LoadLibrary(libname string) (handle Handle, err error) { 174 var _p0 *uint16 175 _p0, err = UTF16PtrFromString(libname) 176 if err != nil { 177 return 178 } 179 return _LoadLibrary(_p0) 180 } 181 182 func _LoadLibrary(libname *uint16) (handle Handle, err error) { 183 r0, _, e1 := Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) 184 handle = Handle(r0) 185 if handle == 0 { 186 if e1 != 0 { 187 err = error(e1) 188 } else { 189 err = EINVAL 190 } 191 } 192 return 193 } 194 195 func FreeLibrary(handle Handle) (err error) { 196 r1, _, e1 := Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) 197 if r1 == 0 { 198 if e1 != 0 { 199 err = error(e1) 200 } else { 201 err = EINVAL 202 } 203 } 204 return 205 } 206 207 func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { 208 var _p0 *byte 209 _p0, err = BytePtrFromString(procname) 210 if err != nil { 211 return 212 } 213 return _GetProcAddress(module, _p0) 214 } 215 216 func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { 217 r0, _, e1 := Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) 218 proc = uintptr(r0) 219 if proc == 0 { 220 if e1 != 0 { 221 err = error(e1) 222 } else { 223 err = EINVAL 224 } 225 } 226 return 227 } 228 229 func GetVersion() (ver uint32, err error) { 230 r0, _, e1 := Syscall(procGetVersion.Addr(), 0, 0, 0, 0) 231 ver = uint32(r0) 232 if ver == 0 { 233 if e1 != 0 { 234 err = error(e1) 235 } else { 236 err = EINVAL 237 } 238 } 239 return 240 } 241 242 func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) { 243 var _p0 *uint16 244 if len(buf) > 0 { 245 _p0 = &buf[0] 246 } 247 r0, _, e1 := Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) 248 n = uint32(r0) 249 if n == 0 { 250 if e1 != 0 { 251 err = error(e1) 252 } else { 253 err = EINVAL 254 } 255 } 256 return 257 } 258 259 func ExitProcess(exitcode uint32) { 260 Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) 261 return 262 } 263 264 func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) { 265 r0, _, e1 := Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) 266 handle = Handle(r0) 267 if handle == InvalidHandle { 268 if e1 != 0 { 269 err = error(e1) 270 } else { 271 err = EINVAL 272 } 273 } 274 return 275 } 276 277 func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { 278 var _p0 *byte 279 if len(buf) > 0 { 280 _p0 = &buf[0] 281 } 282 r1, _, e1 := Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) 283 if r1 == 0 { 284 if e1 != 0 { 285 err = error(e1) 286 } else { 287 err = EINVAL 288 } 289 } 290 return 291 } 292 293 func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { 294 var _p0 *byte 295 if len(buf) > 0 { 296 _p0 = &buf[0] 297 } 298 r1, _, e1 := Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) 299 if r1 == 0 { 300 if e1 != 0 { 301 err = error(e1) 302 } else { 303 err = EINVAL 304 } 305 } 306 return 307 } 308 309 func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { 310 r0, _, e1 := Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) 311 newlowoffset = uint32(r0) 312 if newlowoffset == 0xffffffff { 313 if e1 != 0 { 314 err = error(e1) 315 } else { 316 err = EINVAL 317 } 318 } 319 return 320 } 321 322 func CloseHandle(handle Handle) (err error) { 323 r1, _, e1 := Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) 324 if r1 == 0 { 325 if e1 != 0 { 326 err = error(e1) 327 } else { 328 err = EINVAL 329 } 330 } 331 return 332 } 333 334 func GetStdHandle(stdhandle int) (handle Handle, err error) { 335 r0, _, e1 := Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) 336 handle = Handle(r0) 337 if handle == InvalidHandle { 338 if e1 != 0 { 339 err = error(e1) 340 } else { 341 err = EINVAL 342 } 343 } 344 return 345 } 346 347 func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { 348 r0, _, e1 := Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) 349 handle = Handle(r0) 350 if handle == InvalidHandle { 351 if e1 != 0 { 352 err = error(e1) 353 } else { 354 err = EINVAL 355 } 356 } 357 return 358 } 359 360 func findNextFile1(handle Handle, data *win32finddata1) (err error) { 361 r1, _, e1 := Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) 362 if r1 == 0 { 363 if e1 != 0 { 364 err = error(e1) 365 } else { 366 err = EINVAL 367 } 368 } 369 return 370 } 371 372 func FindClose(handle Handle) (err error) { 373 r1, _, e1 := Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) 374 if r1 == 0 { 375 if e1 != 0 { 376 err = error(e1) 377 } else { 378 err = EINVAL 379 } 380 } 381 return 382 } 383 384 func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { 385 r1, _, e1 := Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) 386 if r1 == 0 { 387 if e1 != 0 { 388 err = error(e1) 389 } else { 390 err = EINVAL 391 } 392 } 393 return 394 } 395 396 func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { 397 r0, _, e1 := Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) 398 n = uint32(r0) 399 if n == 0 { 400 if e1 != 0 { 401 err = error(e1) 402 } else { 403 err = EINVAL 404 } 405 } 406 return 407 } 408 409 func SetCurrentDirectory(path *uint16) (err error) { 410 r1, _, e1 := Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) 411 if r1 == 0 { 412 if e1 != 0 { 413 err = error(e1) 414 } else { 415 err = EINVAL 416 } 417 } 418 return 419 } 420 421 func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { 422 r1, _, e1 := Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) 423 if r1 == 0 { 424 if e1 != 0 { 425 err = error(e1) 426 } else { 427 err = EINVAL 428 } 429 } 430 return 431 } 432 433 func RemoveDirectory(path *uint16) (err error) { 434 r1, _, e1 := Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) 435 if r1 == 0 { 436 if e1 != 0 { 437 err = error(e1) 438 } else { 439 err = EINVAL 440 } 441 } 442 return 443 } 444 445 func DeleteFile(path *uint16) (err error) { 446 r1, _, e1 := Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) 447 if r1 == 0 { 448 if e1 != 0 { 449 err = error(e1) 450 } else { 451 err = EINVAL 452 } 453 } 454 return 455 } 456 457 func MoveFile(from *uint16, to *uint16) (err error) { 458 r1, _, e1 := Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) 459 if r1 == 0 { 460 if e1 != 0 { 461 err = error(e1) 462 } else { 463 err = EINVAL 464 } 465 } 466 return 467 } 468 469 func GetComputerName(buf *uint16, n *uint32) (err error) { 470 r1, _, e1 := Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) 471 if r1 == 0 { 472 if e1 != 0 { 473 err = error(e1) 474 } else { 475 err = EINVAL 476 } 477 } 478 return 479 } 480 481 func SetEndOfFile(handle Handle) (err error) { 482 r1, _, e1 := Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) 483 if r1 == 0 { 484 if e1 != 0 { 485 err = error(e1) 486 } else { 487 err = EINVAL 488 } 489 } 490 return 491 } 492 493 func GetSystemTimeAsFileTime(time *Filetime) { 494 Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) 495 return 496 } 497 498 func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { 499 r0, _, e1 := Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) 500 rc = uint32(r0) 501 if rc == 0xffffffff { 502 if e1 != 0 { 503 err = error(e1) 504 } else { 505 err = EINVAL 506 } 507 } 508 return 509 } 510 511 func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) { 512 r0, _, e1 := Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) 513 handle = Handle(r0) 514 if handle == 0 { 515 if e1 != 0 { 516 err = error(e1) 517 } else { 518 err = EINVAL 519 } 520 } 521 return 522 } 523 524 func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) { 525 r1, _, e1 := Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) 526 if r1 == 0 { 527 if e1 != 0 { 528 err = error(e1) 529 } else { 530 err = EINVAL 531 } 532 } 533 return 534 } 535 536 func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) { 537 r1, _, e1 := Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) 538 if r1 == 0 { 539 if e1 != 0 { 540 err = error(e1) 541 } else { 542 err = EINVAL 543 } 544 } 545 return 546 } 547 548 func CancelIo(s Handle) (err error) { 549 r1, _, e1 := Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) 550 if r1 == 0 { 551 if e1 != 0 { 552 err = error(e1) 553 } else { 554 err = EINVAL 555 } 556 } 557 return 558 } 559 560 func CancelIoEx(s Handle, o *Overlapped) (err error) { 561 r1, _, e1 := Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) 562 if r1 == 0 { 563 if e1 != 0 { 564 err = error(e1) 565 } else { 566 err = EINVAL 567 } 568 } 569 return 570 } 571 572 func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { 573 var _p0 uint32 574 if inheritHandles { 575 _p0 = 1 576 } else { 577 _p0 = 0 578 } 579 r1, _, e1 := Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) 580 if r1 == 0 { 581 if e1 != 0 { 582 err = error(e1) 583 } else { 584 err = EINVAL 585 } 586 } 587 return 588 } 589 590 func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) { 591 var _p0 uint32 592 if inheritHandle { 593 _p0 = 1 594 } else { 595 _p0 = 0 596 } 597 r0, _, e1 := Syscall(procOpenProcess.Addr(), 3, uintptr(da), uintptr(_p0), uintptr(pid)) 598 handle = Handle(r0) 599 if handle == 0 { 600 if e1 != 0 { 601 err = error(e1) 602 } else { 603 err = EINVAL 604 } 605 } 606 return 607 } 608 609 func TerminateProcess(handle Handle, exitcode uint32) (err error) { 610 r1, _, e1 := Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) 611 if r1 == 0 { 612 if e1 != 0 { 613 err = error(e1) 614 } else { 615 err = EINVAL 616 } 617 } 618 return 619 } 620 621 func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { 622 r1, _, e1 := Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) 623 if r1 == 0 { 624 if e1 != 0 { 625 err = error(e1) 626 } else { 627 err = EINVAL 628 } 629 } 630 return 631 } 632 633 func GetStartupInfo(startupInfo *StartupInfo) (err error) { 634 r1, _, e1 := Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) 635 if r1 == 0 { 636 if e1 != 0 { 637 err = error(e1) 638 } else { 639 err = EINVAL 640 } 641 } 642 return 643 } 644 645 func GetCurrentProcess() (pseudoHandle Handle, err error) { 646 r0, _, e1 := Syscall(procGetCurrentProcess.Addr(), 0, 0, 0, 0) 647 pseudoHandle = Handle(r0) 648 if pseudoHandle == 0 { 649 if e1 != 0 { 650 err = error(e1) 651 } else { 652 err = EINVAL 653 } 654 } 655 return 656 } 657 658 func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { 659 r1, _, e1 := Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) 660 if r1 == 0 { 661 if e1 != 0 { 662 err = error(e1) 663 } else { 664 err = EINVAL 665 } 666 } 667 return 668 } 669 670 func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) { 671 var _p0 uint32 672 if bInheritHandle { 673 _p0 = 1 674 } else { 675 _p0 = 0 676 } 677 r1, _, e1 := Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) 678 if r1 == 0 { 679 if e1 != 0 { 680 err = error(e1) 681 } else { 682 err = EINVAL 683 } 684 } 685 return 686 } 687 688 func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { 689 r0, _, e1 := Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) 690 event = uint32(r0) 691 if event == 0xffffffff { 692 if e1 != 0 { 693 err = error(e1) 694 } else { 695 err = EINVAL 696 } 697 } 698 return 699 } 700 701 func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { 702 r0, _, e1 := Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) 703 n = uint32(r0) 704 if n == 0 { 705 if e1 != 0 { 706 err = error(e1) 707 } else { 708 err = EINVAL 709 } 710 } 711 return 712 } 713 714 func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { 715 r1, _, e1 := Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) 716 if r1 == 0 { 717 if e1 != 0 { 718 err = error(e1) 719 } else { 720 err = EINVAL 721 } 722 } 723 return 724 } 725 726 func GetFileType(filehandle Handle) (n uint32, err error) { 727 r0, _, e1 := Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) 728 n = uint32(r0) 729 if n == 0 { 730 if e1 != 0 { 731 err = error(e1) 732 } else { 733 err = EINVAL 734 } 735 } 736 return 737 } 738 739 func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { 740 r1, _, e1 := Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) 741 if r1 == 0 { 742 if e1 != 0 { 743 err = error(e1) 744 } else { 745 err = EINVAL 746 } 747 } 748 return 749 } 750 751 func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { 752 r1, _, e1 := Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) 753 if r1 == 0 { 754 if e1 != 0 { 755 err = error(e1) 756 } else { 757 err = EINVAL 758 } 759 } 760 return 761 } 762 763 func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { 764 r1, _, e1 := Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) 765 if r1 == 0 { 766 if e1 != 0 { 767 err = error(e1) 768 } else { 769 err = EINVAL 770 } 771 } 772 return 773 } 774 775 func GetEnvironmentStrings() (envs *uint16, err error) { 776 r0, _, e1 := Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) 777 envs = (*uint16)(unsafe.Pointer(r0)) 778 if envs == nil { 779 if e1 != 0 { 780 err = error(e1) 781 } else { 782 err = EINVAL 783 } 784 } 785 return 786 } 787 788 func FreeEnvironmentStrings(envs *uint16) (err error) { 789 r1, _, e1 := Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) 790 if r1 == 0 { 791 if e1 != 0 { 792 err = error(e1) 793 } else { 794 err = EINVAL 795 } 796 } 797 return 798 } 799 800 func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) { 801 r0, _, e1 := Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) 802 n = uint32(r0) 803 if n == 0 { 804 if e1 != 0 { 805 err = error(e1) 806 } else { 807 err = EINVAL 808 } 809 } 810 return 811 } 812 813 func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { 814 r1, _, e1 := Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) 815 if r1 == 0 { 816 if e1 != 0 { 817 err = error(e1) 818 } else { 819 err = EINVAL 820 } 821 } 822 return 823 } 824 825 func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { 826 r1, _, e1 := Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) 827 if r1 == 0 { 828 if e1 != 0 { 829 err = error(e1) 830 } else { 831 err = EINVAL 832 } 833 } 834 return 835 } 836 837 func GetFileAttributes(name *uint16) (attrs uint32, err error) { 838 r0, _, e1 := Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) 839 attrs = uint32(r0) 840 if attrs == INVALID_FILE_ATTRIBUTES { 841 if e1 != 0 { 842 err = error(e1) 843 } else { 844 err = EINVAL 845 } 846 } 847 return 848 } 849 850 func SetFileAttributes(name *uint16, attrs uint32) (err error) { 851 r1, _, e1 := Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) 852 if r1 == 0 { 853 if e1 != 0 { 854 err = error(e1) 855 } else { 856 err = EINVAL 857 } 858 } 859 return 860 } 861 862 func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { 863 r1, _, e1 := Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) 864 if r1 == 0 { 865 if e1 != 0 { 866 err = error(e1) 867 } else { 868 err = EINVAL 869 } 870 } 871 return 872 } 873 874 func GetCommandLine() (cmd *uint16) { 875 r0, _, _ := Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) 876 cmd = (*uint16)(unsafe.Pointer(r0)) 877 return 878 } 879 880 func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { 881 r0, _, e1 := Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) 882 argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) 883 if argv == nil { 884 if e1 != 0 { 885 err = error(e1) 886 } else { 887 err = EINVAL 888 } 889 } 890 return 891 } 892 893 func LocalFree(hmem Handle) (handle Handle, err error) { 894 r0, _, e1 := Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) 895 handle = Handle(r0) 896 if handle != 0 { 897 if e1 != 0 { 898 err = error(e1) 899 } else { 900 err = EINVAL 901 } 902 } 903 return 904 } 905 906 func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { 907 r1, _, e1 := Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) 908 if r1 == 0 { 909 if e1 != 0 { 910 err = error(e1) 911 } else { 912 err = EINVAL 913 } 914 } 915 return 916 } 917 918 func FlushFileBuffers(handle Handle) (err error) { 919 r1, _, e1 := Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) 920 if r1 == 0 { 921 if e1 != 0 { 922 err = error(e1) 923 } else { 924 err = EINVAL 925 } 926 } 927 return 928 } 929 930 func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { 931 r0, _, e1 := Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) 932 n = uint32(r0) 933 if n == 0 { 934 if e1 != 0 { 935 err = error(e1) 936 } else { 937 err = EINVAL 938 } 939 } 940 return 941 } 942 943 func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) { 944 r0, _, e1 := Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) 945 n = uint32(r0) 946 if n == 0 { 947 if e1 != 0 { 948 err = error(e1) 949 } else { 950 err = EINVAL 951 } 952 } 953 return 954 } 955 956 func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { 957 r0, _, e1 := Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) 958 n = uint32(r0) 959 if n == 0 { 960 if e1 != 0 { 961 err = error(e1) 962 } else { 963 err = EINVAL 964 } 965 } 966 return 967 } 968 969 func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { 970 r0, _, e1 := Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) 971 handle = Handle(r0) 972 if handle == 0 { 973 if e1 != 0 { 974 err = error(e1) 975 } else { 976 err = EINVAL 977 } 978 } 979 return 980 } 981 982 func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { 983 r0, _, e1 := Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) 984 addr = uintptr(r0) 985 if addr == 0 { 986 if e1 != 0 { 987 err = error(e1) 988 } else { 989 err = EINVAL 990 } 991 } 992 return 993 } 994 995 func UnmapViewOfFile(addr uintptr) (err error) { 996 r1, _, e1 := Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) 997 if r1 == 0 { 998 if e1 != 0 { 999 err = error(e1) 1000 } else { 1001 err = EINVAL 1002 } 1003 } 1004 return 1005 } 1006 1007 func FlushViewOfFile(addr uintptr, length uintptr) (err error) { 1008 r1, _, e1 := Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) 1009 if r1 == 0 { 1010 if e1 != 0 { 1011 err = error(e1) 1012 } else { 1013 err = EINVAL 1014 } 1015 } 1016 return 1017 } 1018 1019 func VirtualLock(addr uintptr, length uintptr) (err error) { 1020 r1, _, e1 := Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) 1021 if r1 == 0 { 1022 if e1 != 0 { 1023 err = error(e1) 1024 } else { 1025 err = EINVAL 1026 } 1027 } 1028 return 1029 } 1030 1031 func VirtualUnlock(addr uintptr, length uintptr) (err error) { 1032 r1, _, e1 := Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) 1033 if r1 == 0 { 1034 if e1 != 0 { 1035 err = error(e1) 1036 } else { 1037 err = EINVAL 1038 } 1039 } 1040 return 1041 } 1042 1043 func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { 1044 r1, _, e1 := Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) 1045 if r1 == 0 { 1046 if e1 != 0 { 1047 err = error(e1) 1048 } else { 1049 err = EINVAL 1050 } 1051 } 1052 return 1053 } 1054 1055 func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { 1056 var _p0 uint32 1057 if watchSubTree { 1058 _p0 = 1 1059 } else { 1060 _p0 = 0 1061 } 1062 r1, _, e1 := Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) 1063 if r1 == 0 { 1064 if e1 != 0 { 1065 err = error(e1) 1066 } else { 1067 err = EINVAL 1068 } 1069 } 1070 return 1071 } 1072 1073 func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { 1074 r0, _, e1 := Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) 1075 store = Handle(r0) 1076 if store == 0 { 1077 if e1 != 0 { 1078 err = error(e1) 1079 } else { 1080 err = EINVAL 1081 } 1082 } 1083 return 1084 } 1085 1086 func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { 1087 r0, _, e1 := Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) 1088 handle = Handle(r0) 1089 if handle == InvalidHandle { 1090 if e1 != 0 { 1091 err = error(e1) 1092 } else { 1093 err = EINVAL 1094 } 1095 } 1096 return 1097 } 1098 1099 func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { 1100 r0, _, e1 := Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) 1101 context = (*CertContext)(unsafe.Pointer(r0)) 1102 if context == nil { 1103 if e1 != 0 { 1104 err = error(e1) 1105 } else { 1106 err = EINVAL 1107 } 1108 } 1109 return 1110 } 1111 1112 func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { 1113 r1, _, e1 := Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) 1114 if r1 == 0 { 1115 if e1 != 0 { 1116 err = error(e1) 1117 } else { 1118 err = EINVAL 1119 } 1120 } 1121 return 1122 } 1123 1124 func CertCloseStore(store Handle, flags uint32) (err error) { 1125 r1, _, e1 := Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) 1126 if r1 == 0 { 1127 if e1 != 0 { 1128 err = error(e1) 1129 } else { 1130 err = EINVAL 1131 } 1132 } 1133 return 1134 } 1135 1136 func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { 1137 r1, _, e1 := Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) 1138 if r1 == 0 { 1139 if e1 != 0 { 1140 err = error(e1) 1141 } else { 1142 err = EINVAL 1143 } 1144 } 1145 return 1146 } 1147 1148 func CertFreeCertificateChain(ctx *CertChainContext) { 1149 Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) 1150 return 1151 } 1152 1153 func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { 1154 r0, _, e1 := Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) 1155 context = (*CertContext)(unsafe.Pointer(r0)) 1156 if context == nil { 1157 if e1 != 0 { 1158 err = error(e1) 1159 } else { 1160 err = EINVAL 1161 } 1162 } 1163 return 1164 } 1165 1166 func CertFreeCertificateContext(ctx *CertContext) (err error) { 1167 r1, _, e1 := Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) 1168 if r1 == 0 { 1169 if e1 != 0 { 1170 err = error(e1) 1171 } else { 1172 err = EINVAL 1173 } 1174 } 1175 return 1176 } 1177 1178 func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { 1179 r1, _, e1 := Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) 1180 if r1 == 0 { 1181 if e1 != 0 { 1182 err = error(e1) 1183 } else { 1184 err = EINVAL 1185 } 1186 } 1187 return 1188 } 1189 1190 func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { 1191 r0, _, _ := Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) 1192 if r0 != 0 { 1193 regerrno = Errno(r0) 1194 } 1195 return 1196 } 1197 1198 func RegCloseKey(key Handle) (regerrno error) { 1199 r0, _, _ := Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) 1200 if r0 != 0 { 1201 regerrno = Errno(r0) 1202 } 1203 return 1204 } 1205 1206 func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { 1207 r0, _, _ := Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) 1208 if r0 != 0 { 1209 regerrno = Errno(r0) 1210 } 1211 return 1212 } 1213 1214 func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { 1215 r0, _, _ := Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0) 1216 if r0 != 0 { 1217 regerrno = Errno(r0) 1218 } 1219 return 1220 } 1221 1222 func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { 1223 r0, _, _ := Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) 1224 if r0 != 0 { 1225 regerrno = Errno(r0) 1226 } 1227 return 1228 } 1229 1230 func getCurrentProcessId() (pid uint32) { 1231 r0, _, _ := Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) 1232 pid = uint32(r0) 1233 return 1234 } 1235 1236 func GetConsoleMode(console Handle, mode *uint32) (err error) { 1237 r1, _, e1 := Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) 1238 if r1 == 0 { 1239 if e1 != 0 { 1240 err = error(e1) 1241 } else { 1242 err = EINVAL 1243 } 1244 } 1245 return 1246 } 1247 1248 func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { 1249 r1, _, e1 := Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) 1250 if r1 == 0 { 1251 if e1 != 0 { 1252 err = error(e1) 1253 } else { 1254 err = EINVAL 1255 } 1256 } 1257 return 1258 } 1259 1260 func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { 1261 r1, _, e1 := Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) 1262 if r1 == 0 { 1263 if e1 != 0 { 1264 err = error(e1) 1265 } else { 1266 err = EINVAL 1267 } 1268 } 1269 return 1270 } 1271 1272 func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { 1273 r0, _, e1 := Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) 1274 handle = Handle(r0) 1275 if handle == InvalidHandle { 1276 if e1 != 0 { 1277 err = error(e1) 1278 } else { 1279 err = EINVAL 1280 } 1281 } 1282 return 1283 } 1284 1285 func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { 1286 r1, _, e1 := Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) 1287 if r1 == 0 { 1288 if e1 != 0 { 1289 err = error(e1) 1290 } else { 1291 err = EINVAL 1292 } 1293 } 1294 return 1295 } 1296 1297 func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { 1298 r1, _, e1 := Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) 1299 if r1 == 0 { 1300 if e1 != 0 { 1301 err = error(e1) 1302 } else { 1303 err = EINVAL 1304 } 1305 } 1306 return 1307 } 1308 1309 func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { 1310 r1, _, e1 := Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) 1311 if r1 == 0 { 1312 if e1 != 0 { 1313 err = error(e1) 1314 } else { 1315 err = EINVAL 1316 } 1317 } 1318 return 1319 } 1320 1321 func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { 1322 r1, _, e1 := Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) 1323 if r1&0xff == 0 { 1324 if e1 != 0 { 1325 err = error(e1) 1326 } else { 1327 err = EINVAL 1328 } 1329 } 1330 return 1331 } 1332 1333 func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { 1334 r1, _, e1 := Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) 1335 if r1&0xff == 0 { 1336 if e1 != 0 { 1337 err = error(e1) 1338 } else { 1339 err = EINVAL 1340 } 1341 } 1342 return 1343 } 1344 1345 func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { 1346 r0, _, _ := Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) 1347 if r0 != 0 { 1348 sockerr = Errno(r0) 1349 } 1350 return 1351 } 1352 1353 func WSACleanup() (err error) { 1354 r1, _, e1 := Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) 1355 if r1 == socket_error { 1356 if e1 != 0 { 1357 err = error(e1) 1358 } else { 1359 err = EINVAL 1360 } 1361 } 1362 return 1363 } 1364 1365 func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { 1366 r1, _, e1 := Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) 1367 if r1 == socket_error { 1368 if e1 != 0 { 1369 err = error(e1) 1370 } else { 1371 err = EINVAL 1372 } 1373 } 1374 return 1375 } 1376 1377 func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { 1378 r0, _, e1 := Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) 1379 handle = Handle(r0) 1380 if handle == InvalidHandle { 1381 if e1 != 0 { 1382 err = error(e1) 1383 } else { 1384 err = EINVAL 1385 } 1386 } 1387 return 1388 } 1389 1390 func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { 1391 r1, _, e1 := Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) 1392 if r1 == socket_error { 1393 if e1 != 0 { 1394 err = error(e1) 1395 } else { 1396 err = EINVAL 1397 } 1398 } 1399 return 1400 } 1401 1402 func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { 1403 r1, _, e1 := Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) 1404 if r1 == socket_error { 1405 if e1 != 0 { 1406 err = error(e1) 1407 } else { 1408 err = EINVAL 1409 } 1410 } 1411 return 1412 } 1413 1414 func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { 1415 r1, _, e1 := Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) 1416 if r1 == socket_error { 1417 if e1 != 0 { 1418 err = error(e1) 1419 } else { 1420 err = EINVAL 1421 } 1422 } 1423 return 1424 } 1425 1426 func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { 1427 r1, _, e1 := Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) 1428 if r1 == socket_error { 1429 if e1 != 0 { 1430 err = error(e1) 1431 } else { 1432 err = EINVAL 1433 } 1434 } 1435 return 1436 } 1437 1438 func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { 1439 r1, _, e1 := Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) 1440 if r1 == socket_error { 1441 if e1 != 0 { 1442 err = error(e1) 1443 } else { 1444 err = EINVAL 1445 } 1446 } 1447 return 1448 } 1449 1450 func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { 1451 r1, _, e1 := Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) 1452 if r1 == socket_error { 1453 if e1 != 0 { 1454 err = error(e1) 1455 } else { 1456 err = EINVAL 1457 } 1458 } 1459 return 1460 } 1461 1462 func listen(s Handle, backlog int32) (err error) { 1463 r1, _, e1 := Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) 1464 if r1 == socket_error { 1465 if e1 != 0 { 1466 err = error(e1) 1467 } else { 1468 err = EINVAL 1469 } 1470 } 1471 return 1472 } 1473 1474 func shutdown(s Handle, how int32) (err error) { 1475 r1, _, e1 := Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) 1476 if r1 == socket_error { 1477 if e1 != 0 { 1478 err = error(e1) 1479 } else { 1480 err = EINVAL 1481 } 1482 } 1483 return 1484 } 1485 1486 func Closesocket(s Handle) (err error) { 1487 r1, _, e1 := Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) 1488 if r1 == socket_error { 1489 if e1 != 0 { 1490 err = error(e1) 1491 } else { 1492 err = EINVAL 1493 } 1494 } 1495 return 1496 } 1497 1498 func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { 1499 r1, _, e1 := Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) 1500 if r1 == 0 { 1501 if e1 != 0 { 1502 err = error(e1) 1503 } else { 1504 err = EINVAL 1505 } 1506 } 1507 return 1508 } 1509 1510 func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { 1511 Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) 1512 return 1513 } 1514 1515 func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { 1516 r1, _, e1 := Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) 1517 if r1 == socket_error { 1518 if e1 != 0 { 1519 err = error(e1) 1520 } else { 1521 err = EINVAL 1522 } 1523 } 1524 return 1525 } 1526 1527 func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { 1528 r1, _, e1 := Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) 1529 if r1 == socket_error { 1530 if e1 != 0 { 1531 err = error(e1) 1532 } else { 1533 err = EINVAL 1534 } 1535 } 1536 return 1537 } 1538 1539 func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { 1540 r1, _, e1 := Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) 1541 if r1 == socket_error { 1542 if e1 != 0 { 1543 err = error(e1) 1544 } else { 1545 err = EINVAL 1546 } 1547 } 1548 return 1549 } 1550 1551 func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { 1552 r1, _, e1 := Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) 1553 if r1 == socket_error { 1554 if e1 != 0 { 1555 err = error(e1) 1556 } else { 1557 err = EINVAL 1558 } 1559 } 1560 return 1561 } 1562 1563 func GetHostByName(name string) (h *Hostent, err error) { 1564 var _p0 *byte 1565 _p0, err = BytePtrFromString(name) 1566 if err != nil { 1567 return 1568 } 1569 return _GetHostByName(_p0) 1570 } 1571 1572 func _GetHostByName(name *byte) (h *Hostent, err error) { 1573 r0, _, e1 := Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) 1574 h = (*Hostent)(unsafe.Pointer(r0)) 1575 if h == nil { 1576 if e1 != 0 { 1577 err = error(e1) 1578 } else { 1579 err = EINVAL 1580 } 1581 } 1582 return 1583 } 1584 1585 func GetServByName(name string, proto string) (s *Servent, err error) { 1586 var _p0 *byte 1587 _p0, err = BytePtrFromString(name) 1588 if err != nil { 1589 return 1590 } 1591 var _p1 *byte 1592 _p1, err = BytePtrFromString(proto) 1593 if err != nil { 1594 return 1595 } 1596 return _GetServByName(_p0, _p1) 1597 } 1598 1599 func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { 1600 r0, _, e1 := Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) 1601 s = (*Servent)(unsafe.Pointer(r0)) 1602 if s == nil { 1603 if e1 != 0 { 1604 err = error(e1) 1605 } else { 1606 err = EINVAL 1607 } 1608 } 1609 return 1610 } 1611 1612 func Ntohs(netshort uint16) (u uint16) { 1613 r0, _, _ := Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) 1614 u = uint16(r0) 1615 return 1616 } 1617 1618 func GetProtoByName(name string) (p *Protoent, err error) { 1619 var _p0 *byte 1620 _p0, err = BytePtrFromString(name) 1621 if err != nil { 1622 return 1623 } 1624 return _GetProtoByName(_p0) 1625 } 1626 1627 func _GetProtoByName(name *byte) (p *Protoent, err error) { 1628 r0, _, e1 := Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) 1629 p = (*Protoent)(unsafe.Pointer(r0)) 1630 if p == nil { 1631 if e1 != 0 { 1632 err = error(e1) 1633 } else { 1634 err = EINVAL 1635 } 1636 } 1637 return 1638 } 1639 1640 func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { 1641 var _p0 *uint16 1642 _p0, status = UTF16PtrFromString(name) 1643 if status != nil { 1644 return 1645 } 1646 return _DnsQuery(_p0, qtype, options, extra, qrs, pr) 1647 } 1648 1649 func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { 1650 r0, _, _ := Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) 1651 if r0 != 0 { 1652 status = Errno(r0) 1653 } 1654 return 1655 } 1656 1657 func DnsRecordListFree(rl *DNSRecord, freetype uint32) { 1658 Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) 1659 return 1660 } 1661 1662 func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { 1663 r0, _, _ := Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) 1664 same = r0 != 0 1665 return 1666 } 1667 1668 func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { 1669 r0, _, _ := Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) 1670 if r0 != 0 { 1671 sockerr = Errno(r0) 1672 } 1673 return 1674 } 1675 1676 func FreeAddrInfoW(addrinfo *AddrinfoW) { 1677 Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) 1678 return 1679 } 1680 1681 func GetIfEntry(pIfRow *MibIfRow) (errcode error) { 1682 r0, _, _ := Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) 1683 if r0 != 0 { 1684 errcode = Errno(r0) 1685 } 1686 return 1687 } 1688 1689 func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { 1690 r0, _, _ := Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) 1691 if r0 != 0 { 1692 errcode = Errno(r0) 1693 } 1694 return 1695 } 1696 1697 func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { 1698 r1, _, e1 := Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) 1699 if r1 == 0 { 1700 if e1 != 0 { 1701 err = error(e1) 1702 } else { 1703 err = EINVAL 1704 } 1705 } 1706 return 1707 } 1708 1709 func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { 1710 r0, _, e1 := Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) 1711 n = int32(r0) 1712 if n == -1 { 1713 if e1 != 0 { 1714 err = error(e1) 1715 } else { 1716 err = EINVAL 1717 } 1718 } 1719 return 1720 } 1721 1722 func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { 1723 r1, _, e1 := Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) 1724 if r1&0xff == 0 { 1725 if e1 != 0 { 1726 err = error(e1) 1727 } else { 1728 err = EINVAL 1729 } 1730 } 1731 return 1732 } 1733 1734 func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { 1735 r1, _, e1 := Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) 1736 if r1&0xff == 0 { 1737 if e1 != 0 { 1738 err = error(e1) 1739 } else { 1740 err = EINVAL 1741 } 1742 } 1743 return 1744 } 1745 1746 func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { 1747 r0, _, _ := Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) 1748 if r0 != 0 { 1749 neterr = Errno(r0) 1750 } 1751 return 1752 } 1753 1754 func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { 1755 r0, _, _ := Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) 1756 if r0 != 0 { 1757 neterr = Errno(r0) 1758 } 1759 return 1760 } 1761 1762 func NetApiBufferFree(buf *byte) (neterr error) { 1763 r0, _, _ := Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) 1764 if r0 != 0 { 1765 neterr = Errno(r0) 1766 } 1767 return 1768 } 1769 1770 func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { 1771 r1, _, e1 := Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) 1772 if r1 == 0 { 1773 if e1 != 0 { 1774 err = error(e1) 1775 } else { 1776 err = EINVAL 1777 } 1778 } 1779 return 1780 } 1781 1782 func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { 1783 r1, _, e1 := Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) 1784 if r1 == 0 { 1785 if e1 != 0 { 1786 err = error(e1) 1787 } else { 1788 err = EINVAL 1789 } 1790 } 1791 return 1792 } 1793 1794 func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { 1795 r1, _, e1 := Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) 1796 if r1 == 0 { 1797 if e1 != 0 { 1798 err = error(e1) 1799 } else { 1800 err = EINVAL 1801 } 1802 } 1803 return 1804 } 1805 1806 func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { 1807 r1, _, e1 := Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) 1808 if r1 == 0 { 1809 if e1 != 0 { 1810 err = error(e1) 1811 } else { 1812 err = EINVAL 1813 } 1814 } 1815 return 1816 } 1817 1818 func GetLengthSid(sid *SID) (len uint32) { 1819 r0, _, _ := Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) 1820 len = uint32(r0) 1821 return 1822 } 1823 1824 func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { 1825 r1, _, e1 := Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) 1826 if r1 == 0 { 1827 if e1 != 0 { 1828 err = error(e1) 1829 } else { 1830 err = EINVAL 1831 } 1832 } 1833 return 1834 } 1835 1836 func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { 1837 r1, _, e1 := Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token))) 1838 if r1 == 0 { 1839 if e1 != 0 { 1840 err = error(e1) 1841 } else { 1842 err = EINVAL 1843 } 1844 } 1845 return 1846 } 1847 1848 func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { 1849 r1, _, e1 := Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) 1850 if r1 == 0 { 1851 if e1 != 0 { 1852 err = error(e1) 1853 } else { 1854 err = EINVAL 1855 } 1856 } 1857 return 1858 } 1859 1860 func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { 1861 r1, _, e1 := Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) 1862 if r1 == 0 { 1863 if e1 != 0 { 1864 err = error(e1) 1865 } else { 1866 err = EINVAL 1867 } 1868 } 1869 return 1870 }