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