1 // MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
12 // Do the interface allocations only once for common
15 errnoERROR_IO_PENDING = 997
19 errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
22 // errnoErr returns common boxed Errno values, to prevent
23 // allocations at runtime.
24 func errnoErr(e syscall.Errno) error {
28 case errnoERROR_IO_PENDING:
29 return errERROR_IO_PENDING
31 // TODO: add more here, after collecting data on the common
32 // error values see on Windows. (perhaps when running
38 modadvapi32 = NewLazySystemDLL("advapi32.dll")
39 modkernel32 = NewLazySystemDLL("kernel32.dll")
40 modshell32 = NewLazySystemDLL("shell32.dll")
41 modmswsock = NewLazySystemDLL("mswsock.dll")
42 modcrypt32 = NewLazySystemDLL("crypt32.dll")
43 modws2_32 = NewLazySystemDLL("ws2_32.dll")
44 moddnsapi = NewLazySystemDLL("dnsapi.dll")
45 modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
46 modsecur32 = NewLazySystemDLL("secur32.dll")
47 modnetapi32 = NewLazySystemDLL("netapi32.dll")
48 moduserenv = NewLazySystemDLL("userenv.dll")
50 procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW")
51 procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource")
52 procReportEventW = modadvapi32.NewProc("ReportEventW")
53 procOpenSCManagerW = modadvapi32.NewProc("OpenSCManagerW")
54 procCloseServiceHandle = modadvapi32.NewProc("CloseServiceHandle")
55 procCreateServiceW = modadvapi32.NewProc("CreateServiceW")
56 procOpenServiceW = modadvapi32.NewProc("OpenServiceW")
57 procDeleteService = modadvapi32.NewProc("DeleteService")
58 procStartServiceW = modadvapi32.NewProc("StartServiceW")
59 procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus")
60 procControlService = modadvapi32.NewProc("ControlService")
61 procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
62 procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus")
63 procChangeServiceConfigW = modadvapi32.NewProc("ChangeServiceConfigW")
64 procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW")
65 procChangeServiceConfig2W = modadvapi32.NewProc("ChangeServiceConfig2W")
66 procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W")
67 procGetLastError = modkernel32.NewProc("GetLastError")
68 procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
69 procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
70 procFreeLibrary = modkernel32.NewProc("FreeLibrary")
71 procGetProcAddress = modkernel32.NewProc("GetProcAddress")
72 procGetVersion = modkernel32.NewProc("GetVersion")
73 procFormatMessageW = modkernel32.NewProc("FormatMessageW")
74 procExitProcess = modkernel32.NewProc("ExitProcess")
75 procCreateFileW = modkernel32.NewProc("CreateFileW")
76 procReadFile = modkernel32.NewProc("ReadFile")
77 procWriteFile = modkernel32.NewProc("WriteFile")
78 procSetFilePointer = modkernel32.NewProc("SetFilePointer")
79 procCloseHandle = modkernel32.NewProc("CloseHandle")
80 procGetStdHandle = modkernel32.NewProc("GetStdHandle")
81 procSetStdHandle = modkernel32.NewProc("SetStdHandle")
82 procFindFirstFileW = modkernel32.NewProc("FindFirstFileW")
83 procFindNextFileW = modkernel32.NewProc("FindNextFileW")
84 procFindClose = modkernel32.NewProc("FindClose")
85 procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle")
86 procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
87 procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
88 procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW")
89 procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
90 procDeleteFileW = modkernel32.NewProc("DeleteFileW")
91 procMoveFileW = modkernel32.NewProc("MoveFileW")
92 procMoveFileExW = modkernel32.NewProc("MoveFileExW")
93 procGetComputerNameW = modkernel32.NewProc("GetComputerNameW")
94 procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
95 procSetEndOfFile = modkernel32.NewProc("SetEndOfFile")
96 procGetSystemTimeAsFileTime = modkernel32.NewProc("GetSystemTimeAsFileTime")
97 procGetSystemTimePreciseAsFileTime = modkernel32.NewProc("GetSystemTimePreciseAsFileTime")
98 procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation")
99 procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort")
100 procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus")
101 procPostQueuedCompletionStatus = modkernel32.NewProc("PostQueuedCompletionStatus")
102 procCancelIo = modkernel32.NewProc("CancelIo")
103 procCancelIoEx = modkernel32.NewProc("CancelIoEx")
104 procCreateProcessW = modkernel32.NewProc("CreateProcessW")
105 procOpenProcess = modkernel32.NewProc("OpenProcess")
106 procTerminateProcess = modkernel32.NewProc("TerminateProcess")
107 procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess")
108 procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW")
109 procGetCurrentProcess = modkernel32.NewProc("GetCurrentProcess")
110 procGetProcessTimes = modkernel32.NewProc("GetProcessTimes")
111 procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
112 procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
113 procGetTempPathW = modkernel32.NewProc("GetTempPathW")
114 procCreatePipe = modkernel32.NewProc("CreatePipe")
115 procGetFileType = modkernel32.NewProc("GetFileType")
116 procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW")
117 procCryptReleaseContext = modadvapi32.NewProc("CryptReleaseContext")
118 procCryptGenRandom = modadvapi32.NewProc("CryptGenRandom")
119 procGetEnvironmentStringsW = modkernel32.NewProc("GetEnvironmentStringsW")
120 procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW")
121 procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW")
122 procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
123 procSetFileTime = modkernel32.NewProc("SetFileTime")
124 procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW")
125 procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW")
126 procGetFileAttributesExW = modkernel32.NewProc("GetFileAttributesExW")
127 procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
128 procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW")
129 procLocalFree = modkernel32.NewProc("LocalFree")
130 procSetHandleInformation = modkernel32.NewProc("SetHandleInformation")
131 procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers")
132 procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW")
133 procGetLongPathNameW = modkernel32.NewProc("GetLongPathNameW")
134 procGetShortPathNameW = modkernel32.NewProc("GetShortPathNameW")
135 procCreateFileMappingW = modkernel32.NewProc("CreateFileMappingW")
136 procMapViewOfFile = modkernel32.NewProc("MapViewOfFile")
137 procUnmapViewOfFile = modkernel32.NewProc("UnmapViewOfFile")
138 procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile")
139 procVirtualLock = modkernel32.NewProc("VirtualLock")
140 procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
141 procTransmitFile = modmswsock.NewProc("TransmitFile")
142 procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW")
143 procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW")
144 procCertOpenStore = modcrypt32.NewProc("CertOpenStore")
145 procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore")
146 procCertAddCertificateContextToStore = modcrypt32.NewProc("CertAddCertificateContextToStore")
147 procCertCloseStore = modcrypt32.NewProc("CertCloseStore")
148 procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain")
149 procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain")
150 procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext")
151 procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext")
152 procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy")
153 procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW")
154 procRegCloseKey = modadvapi32.NewProc("RegCloseKey")
155 procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW")
156 procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW")
157 procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW")
158 procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId")
159 procGetConsoleMode = modkernel32.NewProc("GetConsoleMode")
160 procWriteConsoleW = modkernel32.NewProc("WriteConsoleW")
161 procReadConsoleW = modkernel32.NewProc("ReadConsoleW")
162 procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
163 procProcess32FirstW = modkernel32.NewProc("Process32FirstW")
164 procProcess32NextW = modkernel32.NewProc("Process32NextW")
165 procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
166 procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
167 procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW")
168 procGetCurrentThreadId = modkernel32.NewProc("GetCurrentThreadId")
169 procCreateEventW = modkernel32.NewProc("CreateEventW")
170 procSetEvent = modkernel32.NewProc("SetEvent")
171 procWSAStartup = modws2_32.NewProc("WSAStartup")
172 procWSACleanup = modws2_32.NewProc("WSACleanup")
173 procWSAIoctl = modws2_32.NewProc("WSAIoctl")
174 procsocket = modws2_32.NewProc("socket")
175 procsetsockopt = modws2_32.NewProc("setsockopt")
176 procgetsockopt = modws2_32.NewProc("getsockopt")
177 procbind = modws2_32.NewProc("bind")
178 procconnect = modws2_32.NewProc("connect")
179 procgetsockname = modws2_32.NewProc("getsockname")
180 procgetpeername = modws2_32.NewProc("getpeername")
181 proclisten = modws2_32.NewProc("listen")
182 procshutdown = modws2_32.NewProc("shutdown")
183 procclosesocket = modws2_32.NewProc("closesocket")
184 procAcceptEx = modmswsock.NewProc("AcceptEx")
185 procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs")
186 procWSARecv = modws2_32.NewProc("WSARecv")
187 procWSASend = modws2_32.NewProc("WSASend")
188 procWSARecvFrom = modws2_32.NewProc("WSARecvFrom")
189 procWSASendTo = modws2_32.NewProc("WSASendTo")
190 procgethostbyname = modws2_32.NewProc("gethostbyname")
191 procgetservbyname = modws2_32.NewProc("getservbyname")
192 procntohs = modws2_32.NewProc("ntohs")
193 procgetprotobyname = modws2_32.NewProc("getprotobyname")
194 procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W")
195 procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
196 procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W")
197 procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW")
198 procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW")
199 procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
200 procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
201 procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes")
202 procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW")
203 procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
204 procGetACP = modkernel32.NewProc("GetACP")
205 procMultiByteToWideChar = modkernel32.NewProc("MultiByteToWideChar")
206 procTranslateNameW = modsecur32.NewProc("TranslateNameW")
207 procGetUserNameExW = modsecur32.NewProc("GetUserNameExW")
208 procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
209 procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation")
210 procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree")
211 procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW")
212 procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW")
213 procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW")
214 procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW")
215 procGetLengthSid = modadvapi32.NewProc("GetLengthSid")
216 procCopySid = modadvapi32.NewProc("CopySid")
217 procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid")
218 procFreeSid = modadvapi32.NewProc("FreeSid")
219 procEqualSid = modadvapi32.NewProc("EqualSid")
220 procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
221 procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
222 procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
225 func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
226 r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0)
238 func DeregisterEventSource(handle Handle) (err error) {
239 r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0)
250 func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) {
251 r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData)))
262 func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) {
263 r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
275 func CloseServiceHandle(handle Handle) (err error) {
276 r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0)
287 func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) {
288 r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0)
300 func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) {
301 r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
313 func DeleteService(service Handle) (err error) {
314 r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0)
325 func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) {
326 r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors)))
337 func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) {
338 r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0)
349 func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
350 r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
361 func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) {
362 r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0)
373 func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) {
374 r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0)
385 func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) {
386 r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0)
397 func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) {
398 r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
409 func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) {
410 r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info)))
421 func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
422 r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
433 func GetLastError() (lasterr error) {
434 r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
436 lasterr = syscall.Errno(r0)
441 func LoadLibrary(libname string) (handle Handle, err error) {
443 _p0, err = syscall.UTF16PtrFromString(libname)
447 return _LoadLibrary(_p0)
450 func _LoadLibrary(libname *uint16) (handle Handle, err error) {
451 r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0)
463 func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) {
465 _p0, err = syscall.UTF16PtrFromString(libname)
469 return _LoadLibraryEx(_p0, zero, flags)
472 func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) {
473 r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags))
485 func FreeLibrary(handle Handle) (err error) {
486 r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
497 func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
499 _p0, err = syscall.BytePtrFromString(procname)
503 return _GetProcAddress(module, _p0)
506 func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) {
507 r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0)
519 func GetVersion() (ver uint32, err error) {
520 r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0)
532 func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) {
537 r0, _, e1 := syscall.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)
549 func ExitProcess(exitcode uint32) {
550 syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
554 func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) {
555 r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
557 if handle == InvalidHandle {
567 func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
572 r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
583 func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
588 r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
599 func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
600 r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
601 newlowoffset = uint32(r0)
602 if newlowoffset == 0xffffffff {
612 func CloseHandle(handle Handle) (err error) {
613 r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
624 func GetStdHandle(stdhandle uint32) (handle Handle, err error) {
625 r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0)
627 if handle == InvalidHandle {
637 func SetStdHandle(stdhandle uint32, handle Handle) (err error) {
638 r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0)
649 func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) {
650 r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
652 if handle == InvalidHandle {
662 func findNextFile1(handle Handle, data *win32finddata1) (err error) {
663 r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
674 func FindClose(handle Handle) (err error) {
675 r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
686 func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
687 r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
698 func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
699 r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
711 func SetCurrentDirectory(path *uint16) (err error) {
712 r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
723 func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
724 r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
735 func RemoveDirectory(path *uint16) (err error) {
736 r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
747 func DeleteFile(path *uint16) (err error) {
748 r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
759 func MoveFile(from *uint16, to *uint16) (err error) {
760 r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
771 func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
772 r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
783 func GetComputerName(buf *uint16, n *uint32) (err error) {
784 r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
795 func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) {
796 r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
807 func SetEndOfFile(handle Handle) (err error) {
808 r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
819 func GetSystemTimeAsFileTime(time *Filetime) {
820 syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
824 func GetSystemTimePreciseAsFileTime(time *Filetime) {
825 syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
829 func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
830 r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0)
832 if rc == 0xffffffff {
842 func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) {
843 r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
855 func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
856 r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
867 func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
868 r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
879 func CancelIo(s Handle) (err error) {
880 r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
891 func CancelIoEx(s Handle, o *Overlapped) (err error) {
892 r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0)
903 func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
910 r1, _, e1 := syscall.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)
921 func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) {
928 r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(da), uintptr(_p0), uintptr(pid))
940 func TerminateProcess(handle Handle, exitcode uint32) (err error) {
941 r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
952 func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
953 r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
964 func GetStartupInfo(startupInfo *StartupInfo) (err error) {
965 r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
976 func GetCurrentProcess() (pseudoHandle Handle, err error) {
977 r0, _, e1 := syscall.Syscall(procGetCurrentProcess.Addr(), 0, 0, 0, 0)
978 pseudoHandle = Handle(r0)
979 if pseudoHandle == 0 {
989 func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
990 r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
1001 func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
1008 r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
1013 err = syscall.EINVAL
1019 func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) {
1020 r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0)
1022 if event == 0xffffffff {
1026 err = syscall.EINVAL
1032 func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
1033 r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
1039 err = syscall.EINVAL
1045 func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
1046 r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
1051 err = syscall.EINVAL
1057 func GetFileType(filehandle Handle) (n uint32, err error) {
1058 r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0)
1064 err = syscall.EINVAL
1070 func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
1071 r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
1076 err = syscall.EINVAL
1082 func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
1083 r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
1088 err = syscall.EINVAL
1094 func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
1095 r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
1100 err = syscall.EINVAL
1106 func GetEnvironmentStrings() (envs *uint16, err error) {
1107 r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0)
1108 envs = (*uint16)(unsafe.Pointer(r0))
1113 err = syscall.EINVAL
1119 func FreeEnvironmentStrings(envs *uint16) (err error) {
1120 r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
1125 err = syscall.EINVAL
1131 func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) {
1132 r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size))
1138 err = syscall.EINVAL
1144 func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
1145 r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
1150 err = syscall.EINVAL
1156 func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
1157 r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
1162 err = syscall.EINVAL
1168 func GetFileAttributes(name *uint16) (attrs uint32, err error) {
1169 r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
1171 if attrs == INVALID_FILE_ATTRIBUTES {
1175 err = syscall.EINVAL
1181 func SetFileAttributes(name *uint16, attrs uint32) (err error) {
1182 r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
1187 err = syscall.EINVAL
1193 func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
1194 r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
1199 err = syscall.EINVAL
1205 func GetCommandLine() (cmd *uint16) {
1206 r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0)
1207 cmd = (*uint16)(unsafe.Pointer(r0))
1211 func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
1212 r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0)
1213 argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0))
1218 err = syscall.EINVAL
1224 func LocalFree(hmem Handle) (handle Handle, err error) {
1225 r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0)
1231 err = syscall.EINVAL
1237 func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
1238 r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
1243 err = syscall.EINVAL
1249 func FlushFileBuffers(handle Handle) (err error) {
1250 r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
1255 err = syscall.EINVAL
1261 func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) {
1262 r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0)
1268 err = syscall.EINVAL
1274 func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) {
1275 r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen))
1281 err = syscall.EINVAL
1287 func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) {
1288 r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen))
1294 err = syscall.EINVAL
1300 func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) {
1301 r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
1307 err = syscall.EINVAL
1313 func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) {
1314 r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
1320 err = syscall.EINVAL
1326 func UnmapViewOfFile(addr uintptr) (err error) {
1327 r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
1332 err = syscall.EINVAL
1338 func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
1339 r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
1344 err = syscall.EINVAL
1350 func VirtualLock(addr uintptr, length uintptr) (err error) {
1351 r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
1356 err = syscall.EINVAL
1362 func VirtualUnlock(addr uintptr, length uintptr) (err error) {
1363 r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
1368 err = syscall.EINVAL
1374 func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
1375 r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0)
1380 err = syscall.EINVAL
1386 func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
1393 r1, _, e1 := syscall.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)
1398 err = syscall.EINVAL
1404 func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
1405 r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0)
1411 err = syscall.EINVAL
1417 func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
1418 r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
1420 if handle == InvalidHandle {
1424 err = syscall.EINVAL
1430 func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) {
1431 r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0)
1432 context = (*CertContext)(unsafe.Pointer(r0))
1437 err = syscall.EINVAL
1443 func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
1444 r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
1449 err = syscall.EINVAL
1455 func CertCloseStore(store Handle, flags uint32) (err error) {
1456 r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
1461 err = syscall.EINVAL
1467 func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
1468 r1, _, e1 := syscall.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)
1473 err = syscall.EINVAL
1479 func CertFreeCertificateChain(ctx *CertChainContext) {
1480 syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1484 func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) {
1485 r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen))
1486 context = (*CertContext)(unsafe.Pointer(r0))
1491 err = syscall.EINVAL
1497 func CertFreeCertificateContext(ctx *CertContext) (err error) {
1498 r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1503 err = syscall.EINVAL
1509 func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
1510 r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
1515 err = syscall.EINVAL
1521 func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) {
1522 r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0)
1524 regerrno = syscall.Errno(r0)
1529 func RegCloseKey(key Handle) (regerrno error) {
1530 r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0)
1532 regerrno = syscall.Errno(r0)
1537 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) {
1538 r0, _, _ := syscall.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)))
1540 regerrno = syscall.Errno(r0)
1545 func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) {
1546 r0, _, _ := syscall.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)
1548 regerrno = syscall.Errno(r0)
1553 func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
1554 r0, _, _ := syscall.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)))
1556 regerrno = syscall.Errno(r0)
1561 func getCurrentProcessId() (pid uint32) {
1562 r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
1567 func GetConsoleMode(console Handle, mode *uint32) (err error) {
1568 r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
1573 err = syscall.EINVAL
1579 func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
1580 r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
1585 err = syscall.EINVAL
1591 func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) {
1592 r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0)
1597 err = syscall.EINVAL
1603 func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) {
1604 r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0)
1606 if handle == InvalidHandle {
1610 err = syscall.EINVAL
1616 func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
1617 r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
1622 err = syscall.EINVAL
1628 func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
1629 r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
1634 err = syscall.EINVAL
1640 func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
1641 r1, _, e1 := syscall.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)
1646 err = syscall.EINVAL
1652 func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) {
1653 r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags))
1658 err = syscall.EINVAL
1664 func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) {
1665 r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved))
1670 err = syscall.EINVAL
1676 func GetCurrentThreadId() (id uint32) {
1677 r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0)
1682 func CreateEvent(eventAttrs *syscall.SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) {
1683 r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
1689 err = syscall.EINVAL
1695 func SetEvent(event Handle) (err error) {
1696 r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0)
1701 err = syscall.EINVAL
1707 func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
1708 r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
1710 sockerr = syscall.Errno(r0)
1715 func WSACleanup() (err error) {
1716 r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
1717 if r1 == socket_error {
1721 err = syscall.EINVAL
1727 func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
1728 r1, _, e1 := syscall.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))
1729 if r1 == socket_error {
1733 err = syscall.EINVAL
1739 func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
1740 r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol))
1742 if handle == InvalidHandle {
1746 err = syscall.EINVAL
1752 func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
1753 r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
1754 if r1 == socket_error {
1758 err = syscall.EINVAL
1764 func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
1765 r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
1766 if r1 == socket_error {
1770 err = syscall.EINVAL
1776 func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
1777 r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
1778 if r1 == socket_error {
1782 err = syscall.EINVAL
1788 func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
1789 r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
1790 if r1 == socket_error {
1794 err = syscall.EINVAL
1800 func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
1801 r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1802 if r1 == socket_error {
1806 err = syscall.EINVAL
1812 func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
1813 r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1814 if r1 == socket_error {
1818 err = syscall.EINVAL
1824 func listen(s Handle, backlog int32) (err error) {
1825 r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
1826 if r1 == socket_error {
1830 err = syscall.EINVAL
1836 func shutdown(s Handle, how int32) (err error) {
1837 r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
1838 if r1 == socket_error {
1842 err = syscall.EINVAL
1848 func Closesocket(s Handle) (err error) {
1849 r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
1850 if r1 == socket_error {
1854 err = syscall.EINVAL
1860 func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
1861 r1, _, e1 := syscall.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)
1866 err = syscall.EINVAL
1872 func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) {
1873 syscall.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)
1877 func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
1878 r1, _, e1 := syscall.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)
1879 if r1 == socket_error {
1883 err = syscall.EINVAL
1889 func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
1890 r1, _, e1 := syscall.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)
1891 if r1 == socket_error {
1895 err = syscall.EINVAL
1901 func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
1902 r1, _, e1 := syscall.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)))
1903 if r1 == socket_error {
1907 err = syscall.EINVAL
1913 func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
1914 r1, _, e1 := syscall.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)))
1915 if r1 == socket_error {
1919 err = syscall.EINVAL
1925 func GetHostByName(name string) (h *Hostent, err error) {
1927 _p0, err = syscall.BytePtrFromString(name)
1931 return _GetHostByName(_p0)
1934 func _GetHostByName(name *byte) (h *Hostent, err error) {
1935 r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
1936 h = (*Hostent)(unsafe.Pointer(r0))
1941 err = syscall.EINVAL
1947 func GetServByName(name string, proto string) (s *Servent, err error) {
1949 _p0, err = syscall.BytePtrFromString(name)
1954 _p1, err = syscall.BytePtrFromString(proto)
1958 return _GetServByName(_p0, _p1)
1961 func _GetServByName(name *byte, proto *byte) (s *Servent, err error) {
1962 r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0)
1963 s = (*Servent)(unsafe.Pointer(r0))
1968 err = syscall.EINVAL
1974 func Ntohs(netshort uint16) (u uint16) {
1975 r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0)
1980 func GetProtoByName(name string) (p *Protoent, err error) {
1982 _p0, err = syscall.BytePtrFromString(name)
1986 return _GetProtoByName(_p0)
1989 func _GetProtoByName(name *byte) (p *Protoent, err error) {
1990 r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
1991 p = (*Protoent)(unsafe.Pointer(r0))
1996 err = syscall.EINVAL
2002 func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
2004 _p0, status = syscall.UTF16PtrFromString(name)
2008 return _DnsQuery(_p0, qtype, options, extra, qrs, pr)
2011 func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
2012 r0, _, _ := syscall.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)))
2014 status = syscall.Errno(r0)
2019 func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
2020 syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
2024 func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) {
2025 r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0)
2030 func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) {
2031 r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0)
2033 sockerr = syscall.Errno(r0)
2038 func FreeAddrInfoW(addrinfo *AddrinfoW) {
2039 syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
2043 func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
2044 r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
2046 errcode = syscall.Errno(r0)
2051 func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) {
2052 r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
2054 errcode = syscall.Errno(r0)
2059 func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) {
2060 r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0)
2065 err = syscall.EINVAL
2071 func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) {
2072 r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength)))
2078 err = syscall.EINVAL
2084 func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
2085 r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
2087 errcode = syscall.Errno(r0)
2092 func GetACP() (acp uint32) {
2093 r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
2098 func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
2099 r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
2105 err = syscall.EINVAL
2111 func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
2112 r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
2117 err = syscall.EINVAL
2123 func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
2124 r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
2129 err = syscall.EINVAL
2135 func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
2136 r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
2138 neterr = syscall.Errno(r0)
2143 func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) {
2144 r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType)))
2146 neterr = syscall.Errno(r0)
2151 func NetApiBufferFree(buf *byte) (neterr error) {
2152 r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0)
2154 neterr = syscall.Errno(r0)
2159 func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
2160 r1, _, e1 := syscall.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)
2165 err = syscall.EINVAL
2171 func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
2172 r1, _, e1 := syscall.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)
2177 err = syscall.EINVAL
2183 func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
2184 r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
2189 err = syscall.EINVAL
2195 func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
2196 r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
2201 err = syscall.EINVAL
2207 func GetLengthSid(sid *SID) (len uint32) {
2208 r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
2213 func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
2214 r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
2219 err = syscall.EINVAL
2225 func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) {
2226 r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0)
2231 err = syscall.EINVAL
2237 func FreeSid(sid *SID) (err error) {
2238 r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
2243 err = syscall.EINVAL
2249 func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) {
2250 r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0)
2255 func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
2256 r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token)))
2261 err = syscall.EINVAL
2267 func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
2268 r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
2273 err = syscall.EINVAL
2279 func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
2280 r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
2285 err = syscall.EINVAL