1
2
3 package windows
4
5 import (
6 "syscall"
7 "unsafe"
8 )
9
10 var _ unsafe.Pointer
11
12
13
14 const (
15 errnoERROR_IO_PENDING = 997
16 )
17
18 var (
19 errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
20 errERROR_EINVAL error = syscall.EINVAL
21 )
22
23
24
25 func errnoErr(e syscall.Errno) error {
26 switch e {
27 case 0:
28 return errERROR_EINVAL
29 case errnoERROR_IO_PENDING:
30 return errERROR_IO_PENDING
31 }
32
33
34
35 return e
36 }
37
38 var (
39 modCfgMgr32 = NewLazySystemDLL("CfgMgr32.dll")
40 modadvapi32 = NewLazySystemDLL("advapi32.dll")
41 modcrypt32 = NewLazySystemDLL("crypt32.dll")
42 moddnsapi = NewLazySystemDLL("dnsapi.dll")
43 moddwmapi = NewLazySystemDLL("dwmapi.dll")
44 modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
45 modkernel32 = NewLazySystemDLL("kernel32.dll")
46 modmswsock = NewLazySystemDLL("mswsock.dll")
47 modnetapi32 = NewLazySystemDLL("netapi32.dll")
48 modntdll = NewLazySystemDLL("ntdll.dll")
49 modole32 = NewLazySystemDLL("ole32.dll")
50 modpsapi = NewLazySystemDLL("psapi.dll")
51 modsechost = NewLazySystemDLL("sechost.dll")
52 modsecur32 = NewLazySystemDLL("secur32.dll")
53 modsetupapi = NewLazySystemDLL("setupapi.dll")
54 modshell32 = NewLazySystemDLL("shell32.dll")
55 moduser32 = NewLazySystemDLL("user32.dll")
56 moduserenv = NewLazySystemDLL("userenv.dll")
57 modversion = NewLazySystemDLL("version.dll")
58 modwinmm = NewLazySystemDLL("winmm.dll")
59 modwintrust = NewLazySystemDLL("wintrust.dll")
60 modws2_32 = NewLazySystemDLL("ws2_32.dll")
61 modwtsapi32 = NewLazySystemDLL("wtsapi32.dll")
62
63 procCM_Get_DevNode_Status = modCfgMgr32.NewProc("CM_Get_DevNode_Status")
64 procCM_Get_Device_Interface_ListW = modCfgMgr32.NewProc("CM_Get_Device_Interface_ListW")
65 procCM_Get_Device_Interface_List_SizeW = modCfgMgr32.NewProc("CM_Get_Device_Interface_List_SizeW")
66 procCM_MapCrToWin32Err = modCfgMgr32.NewProc("CM_MapCrToWin32Err")
67 procAdjustTokenGroups = modadvapi32.NewProc("AdjustTokenGroups")
68 procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges")
69 procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid")
70 procBuildSecurityDescriptorW = modadvapi32.NewProc("BuildSecurityDescriptorW")
71 procChangeServiceConfig2W = modadvapi32.NewProc("ChangeServiceConfig2W")
72 procChangeServiceConfigW = modadvapi32.NewProc("ChangeServiceConfigW")
73 procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership")
74 procCloseServiceHandle = modadvapi32.NewProc("CloseServiceHandle")
75 procControlService = modadvapi32.NewProc("ControlService")
76 procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
77 procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW")
78 procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
79 procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW")
80 procCopySid = modadvapi32.NewProc("CopySid")
81 procCreateProcessAsUserW = modadvapi32.NewProc("CreateProcessAsUserW")
82 procCreateServiceW = modadvapi32.NewProc("CreateServiceW")
83 procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid")
84 procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW")
85 procCryptGenRandom = modadvapi32.NewProc("CryptGenRandom")
86 procCryptReleaseContext = modadvapi32.NewProc("CryptReleaseContext")
87 procDeleteService = modadvapi32.NewProc("DeleteService")
88 procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource")
89 procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx")
90 procEnumDependentServicesW = modadvapi32.NewProc("EnumDependentServicesW")
91 procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW")
92 procEqualSid = modadvapi32.NewProc("EqualSid")
93 procFreeSid = modadvapi32.NewProc("FreeSid")
94 procGetAce = modadvapi32.NewProc("GetAce")
95 procGetLengthSid = modadvapi32.NewProc("GetLengthSid")
96 procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW")
97 procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl")
98 procGetSecurityDescriptorDacl = modadvapi32.NewProc("GetSecurityDescriptorDacl")
99 procGetSecurityDescriptorGroup = modadvapi32.NewProc("GetSecurityDescriptorGroup")
100 procGetSecurityDescriptorLength = modadvapi32.NewProc("GetSecurityDescriptorLength")
101 procGetSecurityDescriptorOwner = modadvapi32.NewProc("GetSecurityDescriptorOwner")
102 procGetSecurityDescriptorRMControl = modadvapi32.NewProc("GetSecurityDescriptorRMControl")
103 procGetSecurityDescriptorSacl = modadvapi32.NewProc("GetSecurityDescriptorSacl")
104 procGetSecurityInfo = modadvapi32.NewProc("GetSecurityInfo")
105 procGetSidIdentifierAuthority = modadvapi32.NewProc("GetSidIdentifierAuthority")
106 procGetSidSubAuthority = modadvapi32.NewProc("GetSidSubAuthority")
107 procGetSidSubAuthorityCount = modadvapi32.NewProc("GetSidSubAuthorityCount")
108 procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
109 procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf")
110 procInitializeSecurityDescriptor = modadvapi32.NewProc("InitializeSecurityDescriptor")
111 procInitiateSystemShutdownExW = modadvapi32.NewProc("InitiateSystemShutdownExW")
112 procIsTokenRestricted = modadvapi32.NewProc("IsTokenRestricted")
113 procIsValidSecurityDescriptor = modadvapi32.NewProc("IsValidSecurityDescriptor")
114 procIsValidSid = modadvapi32.NewProc("IsValidSid")
115 procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid")
116 procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW")
117 procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW")
118 procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW")
119 procMakeAbsoluteSD = modadvapi32.NewProc("MakeAbsoluteSD")
120 procMakeSelfRelativeSD = modadvapi32.NewProc("MakeSelfRelativeSD")
121 procNotifyServiceStatusChangeW = modadvapi32.NewProc("NotifyServiceStatusChangeW")
122 procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
123 procOpenSCManagerW = modadvapi32.NewProc("OpenSCManagerW")
124 procOpenServiceW = modadvapi32.NewProc("OpenServiceW")
125 procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken")
126 procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W")
127 procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW")
128 procQueryServiceDynamicInformation = modadvapi32.NewProc("QueryServiceDynamicInformation")
129 procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW")
130 procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus")
131 procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx")
132 procRegCloseKey = modadvapi32.NewProc("RegCloseKey")
133 procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW")
134 procRegNotifyChangeKeyValue = modadvapi32.NewProc("RegNotifyChangeKeyValue")
135 procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW")
136 procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW")
137 procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW")
138 procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW")
139 procRegisterServiceCtrlHandlerExW = modadvapi32.NewProc("RegisterServiceCtrlHandlerExW")
140 procReportEventW = modadvapi32.NewProc("ReportEventW")
141 procRevertToSelf = modadvapi32.NewProc("RevertToSelf")
142 procSetEntriesInAclW = modadvapi32.NewProc("SetEntriesInAclW")
143 procSetKernelObjectSecurity = modadvapi32.NewProc("SetKernelObjectSecurity")
144 procSetNamedSecurityInfoW = modadvapi32.NewProc("SetNamedSecurityInfoW")
145 procSetSecurityDescriptorControl = modadvapi32.NewProc("SetSecurityDescriptorControl")
146 procSetSecurityDescriptorDacl = modadvapi32.NewProc("SetSecurityDescriptorDacl")
147 procSetSecurityDescriptorGroup = modadvapi32.NewProc("SetSecurityDescriptorGroup")
148 procSetSecurityDescriptorOwner = modadvapi32.NewProc("SetSecurityDescriptorOwner")
149 procSetSecurityDescriptorRMControl = modadvapi32.NewProc("SetSecurityDescriptorRMControl")
150 procSetSecurityDescriptorSacl = modadvapi32.NewProc("SetSecurityDescriptorSacl")
151 procSetSecurityInfo = modadvapi32.NewProc("SetSecurityInfo")
152 procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus")
153 procSetThreadToken = modadvapi32.NewProc("SetThreadToken")
154 procSetTokenInformation = modadvapi32.NewProc("SetTokenInformation")
155 procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
156 procStartServiceW = modadvapi32.NewProc("StartServiceW")
157 procCertAddCertificateContextToStore = modcrypt32.NewProc("CertAddCertificateContextToStore")
158 procCertCloseStore = modcrypt32.NewProc("CertCloseStore")
159 procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext")
160 procCertDeleteCertificateFromStore = modcrypt32.NewProc("CertDeleteCertificateFromStore")
161 procCertDuplicateCertificateContext = modcrypt32.NewProc("CertDuplicateCertificateContext")
162 procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore")
163 procCertFindCertificateInStore = modcrypt32.NewProc("CertFindCertificateInStore")
164 procCertFindChainInStore = modcrypt32.NewProc("CertFindChainInStore")
165 procCertFindExtension = modcrypt32.NewProc("CertFindExtension")
166 procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain")
167 procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext")
168 procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain")
169 procCertGetNameStringW = modcrypt32.NewProc("CertGetNameStringW")
170 procCertOpenStore = modcrypt32.NewProc("CertOpenStore")
171 procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW")
172 procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy")
173 procCryptAcquireCertificatePrivateKey = modcrypt32.NewProc("CryptAcquireCertificatePrivateKey")
174 procCryptDecodeObject = modcrypt32.NewProc("CryptDecodeObject")
175 procCryptProtectData = modcrypt32.NewProc("CryptProtectData")
176 procCryptQueryObject = modcrypt32.NewProc("CryptQueryObject")
177 procCryptUnprotectData = modcrypt32.NewProc("CryptUnprotectData")
178 procPFXImportCertStore = modcrypt32.NewProc("PFXImportCertStore")
179 procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W")
180 procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W")
181 procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
182 procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute")
183 procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute")
184 procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2")
185 procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
186 procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
187 procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
188 procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
189 procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex")
190 procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
191 procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
192 procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
193 procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
194 procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
195 procCancelIo = modkernel32.NewProc("CancelIo")
196 procCancelIoEx = modkernel32.NewProc("CancelIoEx")
197 procClearCommBreak = modkernel32.NewProc("ClearCommBreak")
198 procClearCommError = modkernel32.NewProc("ClearCommError")
199 procCloseHandle = modkernel32.NewProc("CloseHandle")
200 procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole")
201 procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe")
202 procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW")
203 procCreateEventExW = modkernel32.NewProc("CreateEventExW")
204 procCreateEventW = modkernel32.NewProc("CreateEventW")
205 procCreateFileMappingW = modkernel32.NewProc("CreateFileMappingW")
206 procCreateFileW = modkernel32.NewProc("CreateFileW")
207 procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW")
208 procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort")
209 procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW")
210 procCreateMutexExW = modkernel32.NewProc("CreateMutexExW")
211 procCreateMutexW = modkernel32.NewProc("CreateMutexW")
212 procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW")
213 procCreatePipe = modkernel32.NewProc("CreatePipe")
214 procCreateProcessW = modkernel32.NewProc("CreateProcessW")
215 procCreatePseudoConsole = modkernel32.NewProc("CreatePseudoConsole")
216 procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
217 procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
218 procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
219 procDeleteFileW = modkernel32.NewProc("DeleteFileW")
220 procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList")
221 procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
222 procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
223 procDisconnectNamedPipe = modkernel32.NewProc("DisconnectNamedPipe")
224 procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
225 procEscapeCommFunction = modkernel32.NewProc("EscapeCommFunction")
226 procExitProcess = modkernel32.NewProc("ExitProcess")
227 procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW")
228 procFindClose = modkernel32.NewProc("FindClose")
229 procFindCloseChangeNotification = modkernel32.NewProc("FindCloseChangeNotification")
230 procFindFirstChangeNotificationW = modkernel32.NewProc("FindFirstChangeNotificationW")
231 procFindFirstFileW = modkernel32.NewProc("FindFirstFileW")
232 procFindFirstVolumeMountPointW = modkernel32.NewProc("FindFirstVolumeMountPointW")
233 procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
234 procFindNextChangeNotification = modkernel32.NewProc("FindNextChangeNotification")
235 procFindNextFileW = modkernel32.NewProc("FindNextFileW")
236 procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW")
237 procFindNextVolumeW = modkernel32.NewProc("FindNextVolumeW")
238 procFindResourceW = modkernel32.NewProc("FindResourceW")
239 procFindVolumeClose = modkernel32.NewProc("FindVolumeClose")
240 procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose")
241 procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers")
242 procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile")
243 procFormatMessageW = modkernel32.NewProc("FormatMessageW")
244 procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW")
245 procFreeLibrary = modkernel32.NewProc("FreeLibrary")
246 procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
247 procGetACP = modkernel32.NewProc("GetACP")
248 procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount")
249 procGetCommModemStatus = modkernel32.NewProc("GetCommModemStatus")
250 procGetCommState = modkernel32.NewProc("GetCommState")
251 procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts")
252 procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
253 procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
254 procGetComputerNameW = modkernel32.NewProc("GetComputerNameW")
255 procGetConsoleCP = modkernel32.NewProc("GetConsoleCP")
256 procGetConsoleMode = modkernel32.NewProc("GetConsoleMode")
257 procGetConsoleOutputCP = modkernel32.NewProc("GetConsoleOutputCP")
258 procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo")
259 procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
260 procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId")
261 procGetCurrentThreadId = modkernel32.NewProc("GetCurrentThreadId")
262 procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW")
263 procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW")
264 procGetEnvironmentStringsW = modkernel32.NewProc("GetEnvironmentStringsW")
265 procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW")
266 procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess")
267 procGetFileAttributesExW = modkernel32.NewProc("GetFileAttributesExW")
268 procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW")
269 procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle")
270 procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx")
271 procGetFileTime = modkernel32.NewProc("GetFileTime")
272 procGetFileType = modkernel32.NewProc("GetFileType")
273 procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW")
274 procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW")
275 procGetLargePageMinimum = modkernel32.NewProc("GetLargePageMinimum")
276 procGetLastError = modkernel32.NewProc("GetLastError")
277 procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW")
278 procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives")
279 procGetLongPathNameW = modkernel32.NewProc("GetLongPathNameW")
280 procGetMaximumProcessorCount = modkernel32.NewProc("GetMaximumProcessorCount")
281 procGetModuleFileNameW = modkernel32.NewProc("GetModuleFileNameW")
282 procGetModuleHandleExW = modkernel32.NewProc("GetModuleHandleExW")
283 procGetNamedPipeClientProcessId = modkernel32.NewProc("GetNamedPipeClientProcessId")
284 procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW")
285 procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo")
286 procGetNamedPipeServerProcessId = modkernel32.NewProc("GetNamedPipeServerProcessId")
287 procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult")
288 procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
289 procGetProcAddress = modkernel32.NewProc("GetProcAddress")
290 procGetProcessId = modkernel32.NewProc("GetProcessId")
291 procGetProcessPreferredUILanguages = modkernel32.NewProc("GetProcessPreferredUILanguages")
292 procGetProcessShutdownParameters = modkernel32.NewProc("GetProcessShutdownParameters")
293 procGetProcessTimes = modkernel32.NewProc("GetProcessTimes")
294 procGetProcessWorkingSetSizeEx = modkernel32.NewProc("GetProcessWorkingSetSizeEx")
295 procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus")
296 procGetShortPathNameW = modkernel32.NewProc("GetShortPathNameW")
297 procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW")
298 procGetStdHandle = modkernel32.NewProc("GetStdHandle")
299 procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW")
300 procGetSystemPreferredUILanguages = modkernel32.NewProc("GetSystemPreferredUILanguages")
301 procGetSystemTimeAsFileTime = modkernel32.NewProc("GetSystemTimeAsFileTime")
302 procGetSystemTimePreciseAsFileTime = modkernel32.NewProc("GetSystemTimePreciseAsFileTime")
303 procGetSystemWindowsDirectoryW = modkernel32.NewProc("GetSystemWindowsDirectoryW")
304 procGetTempPathW = modkernel32.NewProc("GetTempPathW")
305 procGetThreadPreferredUILanguages = modkernel32.NewProc("GetThreadPreferredUILanguages")
306 procGetTickCount64 = modkernel32.NewProc("GetTickCount64")
307 procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation")
308 procGetUserPreferredUILanguages = modkernel32.NewProc("GetUserPreferredUILanguages")
309 procGetVersion = modkernel32.NewProc("GetVersion")
310 procGetVolumeInformationByHandleW = modkernel32.NewProc("GetVolumeInformationByHandleW")
311 procGetVolumeInformationW = modkernel32.NewProc("GetVolumeInformationW")
312 procGetVolumeNameForVolumeMountPointW = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW")
313 procGetVolumePathNameW = modkernel32.NewProc("GetVolumePathNameW")
314 procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW")
315 procGetWindowsDirectoryW = modkernel32.NewProc("GetWindowsDirectoryW")
316 procInitializeProcThreadAttributeList = modkernel32.NewProc("InitializeProcThreadAttributeList")
317 procIsWow64Process = modkernel32.NewProc("IsWow64Process")
318 procIsWow64Process2 = modkernel32.NewProc("IsWow64Process2")
319 procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
320 procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
321 procLoadResource = modkernel32.NewProc("LoadResource")
322 procLocalAlloc = modkernel32.NewProc("LocalAlloc")
323 procLocalFree = modkernel32.NewProc("LocalFree")
324 procLockFileEx = modkernel32.NewProc("LockFileEx")
325 procLockResource = modkernel32.NewProc("LockResource")
326 procMapViewOfFile = modkernel32.NewProc("MapViewOfFile")
327 procModule32FirstW = modkernel32.NewProc("Module32FirstW")
328 procModule32NextW = modkernel32.NewProc("Module32NextW")
329 procMoveFileExW = modkernel32.NewProc("MoveFileExW")
330 procMoveFileW = modkernel32.NewProc("MoveFileW")
331 procMultiByteToWideChar = modkernel32.NewProc("MultiByteToWideChar")
332 procOpenEventW = modkernel32.NewProc("OpenEventW")
333 procOpenMutexW = modkernel32.NewProc("OpenMutexW")
334 procOpenProcess = modkernel32.NewProc("OpenProcess")
335 procOpenThread = modkernel32.NewProc("OpenThread")
336 procPostQueuedCompletionStatus = modkernel32.NewProc("PostQueuedCompletionStatus")
337 procProcess32FirstW = modkernel32.NewProc("Process32FirstW")
338 procProcess32NextW = modkernel32.NewProc("Process32NextW")
339 procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId")
340 procPulseEvent = modkernel32.NewProc("PulseEvent")
341 procPurgeComm = modkernel32.NewProc("PurgeComm")
342 procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW")
343 procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW")
344 procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject")
345 procReadConsoleW = modkernel32.NewProc("ReadConsoleW")
346 procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW")
347 procReadFile = modkernel32.NewProc("ReadFile")
348 procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory")
349 procReleaseMutex = modkernel32.NewProc("ReleaseMutex")
350 procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
351 procRemoveDllDirectory = modkernel32.NewProc("RemoveDllDirectory")
352 procResetEvent = modkernel32.NewProc("ResetEvent")
353 procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole")
354 procResumeThread = modkernel32.NewProc("ResumeThread")
355 procSetCommBreak = modkernel32.NewProc("SetCommBreak")
356 procSetCommMask = modkernel32.NewProc("SetCommMask")
357 procSetCommState = modkernel32.NewProc("SetCommState")
358 procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
359 procSetConsoleCP = modkernel32.NewProc("SetConsoleCP")
360 procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
361 procSetConsoleMode = modkernel32.NewProc("SetConsoleMode")
362 procSetConsoleOutputCP = modkernel32.NewProc("SetConsoleOutputCP")
363 procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
364 procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories")
365 procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW")
366 procSetEndOfFile = modkernel32.NewProc("SetEndOfFile")
367 procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
368 procSetErrorMode = modkernel32.NewProc("SetErrorMode")
369 procSetEvent = modkernel32.NewProc("SetEvent")
370 procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW")
371 procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes")
372 procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle")
373 procSetFilePointer = modkernel32.NewProc("SetFilePointer")
374 procSetFileTime = modkernel32.NewProc("SetFileTime")
375 procSetFileValidData = modkernel32.NewProc("SetFileValidData")
376 procSetHandleInformation = modkernel32.NewProc("SetHandleInformation")
377 procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
378 procSetNamedPipeHandleState = modkernel32.NewProc("SetNamedPipeHandleState")
379 procSetPriorityClass = modkernel32.NewProc("SetPriorityClass")
380 procSetProcessPriorityBoost = modkernel32.NewProc("SetProcessPriorityBoost")
381 procSetProcessShutdownParameters = modkernel32.NewProc("SetProcessShutdownParameters")
382 procSetProcessWorkingSetSizeEx = modkernel32.NewProc("SetProcessWorkingSetSizeEx")
383 procSetStdHandle = modkernel32.NewProc("SetStdHandle")
384 procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW")
385 procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW")
386 procSetupComm = modkernel32.NewProc("SetupComm")
387 procSizeofResource = modkernel32.NewProc("SizeofResource")
388 procSleepEx = modkernel32.NewProc("SleepEx")
389 procTerminateJobObject = modkernel32.NewProc("TerminateJobObject")
390 procTerminateProcess = modkernel32.NewProc("TerminateProcess")
391 procThread32First = modkernel32.NewProc("Thread32First")
392 procThread32Next = modkernel32.NewProc("Thread32Next")
393 procUnlockFileEx = modkernel32.NewProc("UnlockFileEx")
394 procUnmapViewOfFile = modkernel32.NewProc("UnmapViewOfFile")
395 procUpdateProcThreadAttribute = modkernel32.NewProc("UpdateProcThreadAttribute")
396 procVirtualAlloc = modkernel32.NewProc("VirtualAlloc")
397 procVirtualFree = modkernel32.NewProc("VirtualFree")
398 procVirtualLock = modkernel32.NewProc("VirtualLock")
399 procVirtualProtect = modkernel32.NewProc("VirtualProtect")
400 procVirtualProtectEx = modkernel32.NewProc("VirtualProtectEx")
401 procVirtualQuery = modkernel32.NewProc("VirtualQuery")
402 procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx")
403 procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
404 procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId")
405 procWaitCommEvent = modkernel32.NewProc("WaitCommEvent")
406 procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects")
407 procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
408 procWriteConsoleW = modkernel32.NewProc("WriteConsoleW")
409 procWriteFile = modkernel32.NewProc("WriteFile")
410 procWriteProcessMemory = modkernel32.NewProc("WriteProcessMemory")
411 procAcceptEx = modmswsock.NewProc("AcceptEx")
412 procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs")
413 procTransmitFile = modmswsock.NewProc("TransmitFile")
414 procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree")
415 procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation")
416 procNetUserEnum = modnetapi32.NewProc("NetUserEnum")
417 procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
418 procNtCreateFile = modntdll.NewProc("NtCreateFile")
419 procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile")
420 procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess")
421 procNtQuerySystemInformation = modntdll.NewProc("NtQuerySystemInformation")
422 procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile")
423 procNtSetInformationProcess = modntdll.NewProc("NtSetInformationProcess")
424 procNtSetSystemInformation = modntdll.NewProc("NtSetSystemInformation")
425 procRtlAddFunctionTable = modntdll.NewProc("RtlAddFunctionTable")
426 procRtlDefaultNpAcl = modntdll.NewProc("RtlDefaultNpAcl")
427 procRtlDeleteFunctionTable = modntdll.NewProc("RtlDeleteFunctionTable")
428 procRtlDosPathNameToNtPathName_U_WithStatus = modntdll.NewProc("RtlDosPathNameToNtPathName_U_WithStatus")
429 procRtlDosPathNameToRelativeNtPathName_U_WithStatus = modntdll.NewProc("RtlDosPathNameToRelativeNtPathName_U_WithStatus")
430 procRtlGetCurrentPeb = modntdll.NewProc("RtlGetCurrentPeb")
431 procRtlGetNtVersionNumbers = modntdll.NewProc("RtlGetNtVersionNumbers")
432 procRtlGetVersion = modntdll.NewProc("RtlGetVersion")
433 procRtlInitString = modntdll.NewProc("RtlInitString")
434 procRtlInitUnicodeString = modntdll.NewProc("RtlInitUnicodeString")
435 procRtlNtStatusToDosErrorNoTeb = modntdll.NewProc("RtlNtStatusToDosErrorNoTeb")
436 procCLSIDFromString = modole32.NewProc("CLSIDFromString")
437 procCoCreateGuid = modole32.NewProc("CoCreateGuid")
438 procCoGetObject = modole32.NewProc("CoGetObject")
439 procCoInitializeEx = modole32.NewProc("CoInitializeEx")
440 procCoTaskMemFree = modole32.NewProc("CoTaskMemFree")
441 procCoUninitialize = modole32.NewProc("CoUninitialize")
442 procStringFromGUID2 = modole32.NewProc("StringFromGUID2")
443 procEnumProcessModules = modpsapi.NewProc("EnumProcessModules")
444 procEnumProcessModulesEx = modpsapi.NewProc("EnumProcessModulesEx")
445 procEnumProcesses = modpsapi.NewProc("EnumProcesses")
446 procGetModuleBaseNameW = modpsapi.NewProc("GetModuleBaseNameW")
447 procGetModuleFileNameExW = modpsapi.NewProc("GetModuleFileNameExW")
448 procGetModuleInformation = modpsapi.NewProc("GetModuleInformation")
449 procQueryWorkingSetEx = modpsapi.NewProc("QueryWorkingSetEx")
450 procSubscribeServiceChangeNotifications = modsechost.NewProc("SubscribeServiceChangeNotifications")
451 procUnsubscribeServiceChangeNotifications = modsechost.NewProc("UnsubscribeServiceChangeNotifications")
452 procGetUserNameExW = modsecur32.NewProc("GetUserNameExW")
453 procTranslateNameW = modsecur32.NewProc("TranslateNameW")
454 procSetupDiBuildDriverInfoList = modsetupapi.NewProc("SetupDiBuildDriverInfoList")
455 procSetupDiCallClassInstaller = modsetupapi.NewProc("SetupDiCallClassInstaller")
456 procSetupDiCancelDriverInfoSearch = modsetupapi.NewProc("SetupDiCancelDriverInfoSearch")
457 procSetupDiClassGuidsFromNameExW = modsetupapi.NewProc("SetupDiClassGuidsFromNameExW")
458 procSetupDiClassNameFromGuidExW = modsetupapi.NewProc("SetupDiClassNameFromGuidExW")
459 procSetupDiCreateDeviceInfoListExW = modsetupapi.NewProc("SetupDiCreateDeviceInfoListExW")
460 procSetupDiCreateDeviceInfoW = modsetupapi.NewProc("SetupDiCreateDeviceInfoW")
461 procSetupDiDestroyDeviceInfoList = modsetupapi.NewProc("SetupDiDestroyDeviceInfoList")
462 procSetupDiDestroyDriverInfoList = modsetupapi.NewProc("SetupDiDestroyDriverInfoList")
463 procSetupDiEnumDeviceInfo = modsetupapi.NewProc("SetupDiEnumDeviceInfo")
464 procSetupDiEnumDriverInfoW = modsetupapi.NewProc("SetupDiEnumDriverInfoW")
465 procSetupDiGetClassDevsExW = modsetupapi.NewProc("SetupDiGetClassDevsExW")
466 procSetupDiGetClassInstallParamsW = modsetupapi.NewProc("SetupDiGetClassInstallParamsW")
467 procSetupDiGetDeviceInfoListDetailW = modsetupapi.NewProc("SetupDiGetDeviceInfoListDetailW")
468 procSetupDiGetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiGetDeviceInstallParamsW")
469 procSetupDiGetDeviceInstanceIdW = modsetupapi.NewProc("SetupDiGetDeviceInstanceIdW")
470 procSetupDiGetDevicePropertyW = modsetupapi.NewProc("SetupDiGetDevicePropertyW")
471 procSetupDiGetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiGetDeviceRegistryPropertyW")
472 procSetupDiGetDriverInfoDetailW = modsetupapi.NewProc("SetupDiGetDriverInfoDetailW")
473 procSetupDiGetSelectedDevice = modsetupapi.NewProc("SetupDiGetSelectedDevice")
474 procSetupDiGetSelectedDriverW = modsetupapi.NewProc("SetupDiGetSelectedDriverW")
475 procSetupDiOpenDevRegKey = modsetupapi.NewProc("SetupDiOpenDevRegKey")
476 procSetupDiSetClassInstallParamsW = modsetupapi.NewProc("SetupDiSetClassInstallParamsW")
477 procSetupDiSetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiSetDeviceInstallParamsW")
478 procSetupDiSetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiSetDeviceRegistryPropertyW")
479 procSetupDiSetSelectedDevice = modsetupapi.NewProc("SetupDiSetSelectedDevice")
480 procSetupDiSetSelectedDriverW = modsetupapi.NewProc("SetupDiSetSelectedDriverW")
481 procSetupUninstallOEMInfW = modsetupapi.NewProc("SetupUninstallOEMInfW")
482 procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW")
483 procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath")
484 procShellExecuteW = modshell32.NewProc("ShellExecuteW")
485 procEnumChildWindows = moduser32.NewProc("EnumChildWindows")
486 procEnumWindows = moduser32.NewProc("EnumWindows")
487 procExitWindowsEx = moduser32.NewProc("ExitWindowsEx")
488 procGetClassNameW = moduser32.NewProc("GetClassNameW")
489 procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow")
490 procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow")
491 procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo")
492 procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout")
493 procGetShellWindow = moduser32.NewProc("GetShellWindow")
494 procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId")
495 procIsWindow = moduser32.NewProc("IsWindow")
496 procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode")
497 procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
498 procLoadKeyboardLayoutW = moduser32.NewProc("LoadKeyboardLayoutW")
499 procMessageBoxW = moduser32.NewProc("MessageBoxW")
500 procToUnicodeEx = moduser32.NewProc("ToUnicodeEx")
501 procUnloadKeyboardLayout = moduser32.NewProc("UnloadKeyboardLayout")
502 procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock")
503 procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock")
504 procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
505 procGetFileVersionInfoSizeW = modversion.NewProc("GetFileVersionInfoSizeW")
506 procGetFileVersionInfoW = modversion.NewProc("GetFileVersionInfoW")
507 procVerQueryValueW = modversion.NewProc("VerQueryValueW")
508 proctimeBeginPeriod = modwinmm.NewProc("timeBeginPeriod")
509 proctimeEndPeriod = modwinmm.NewProc("timeEndPeriod")
510 procWinVerifyTrustEx = modwintrust.NewProc("WinVerifyTrustEx")
511 procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW")
512 procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW")
513 procWSACleanup = modws2_32.NewProc("WSACleanup")
514 procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW")
515 procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult")
516 procWSAIoctl = modws2_32.NewProc("WSAIoctl")
517 procWSALookupServiceBeginW = modws2_32.NewProc("WSALookupServiceBeginW")
518 procWSALookupServiceEnd = modws2_32.NewProc("WSALookupServiceEnd")
519 procWSALookupServiceNextW = modws2_32.NewProc("WSALookupServiceNextW")
520 procWSARecv = modws2_32.NewProc("WSARecv")
521 procWSARecvFrom = modws2_32.NewProc("WSARecvFrom")
522 procWSASend = modws2_32.NewProc("WSASend")
523 procWSASendTo = modws2_32.NewProc("WSASendTo")
524 procWSASocketW = modws2_32.NewProc("WSASocketW")
525 procWSAStartup = modws2_32.NewProc("WSAStartup")
526 procbind = modws2_32.NewProc("bind")
527 procclosesocket = modws2_32.NewProc("closesocket")
528 procconnect = modws2_32.NewProc("connect")
529 procgethostbyname = modws2_32.NewProc("gethostbyname")
530 procgetpeername = modws2_32.NewProc("getpeername")
531 procgetprotobyname = modws2_32.NewProc("getprotobyname")
532 procgetservbyname = modws2_32.NewProc("getservbyname")
533 procgetsockname = modws2_32.NewProc("getsockname")
534 procgetsockopt = modws2_32.NewProc("getsockopt")
535 proclisten = modws2_32.NewProc("listen")
536 procntohs = modws2_32.NewProc("ntohs")
537 procrecvfrom = modws2_32.NewProc("recvfrom")
538 procsendto = modws2_32.NewProc("sendto")
539 procsetsockopt = modws2_32.NewProc("setsockopt")
540 procshutdown = modws2_32.NewProc("shutdown")
541 procsocket = modws2_32.NewProc("socket")
542 procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW")
543 procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory")
544 procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken")
545 )
546
547 func cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) {
548 r0, _, _ := syscall.Syscall6(procCM_Get_DevNode_Status.Addr(), 4, uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags), 0, 0)
549 ret = CONFIGRET(r0)
550 return
551 }
552
553 func cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) {
554 r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_ListW.Addr(), 5, uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags), 0)
555 ret = CONFIGRET(r0)
556 return
557 }
558
559 func cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) {
560 r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_List_SizeW.Addr(), 4, uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags), 0, 0)
561 ret = CONFIGRET(r0)
562 return
563 }
564
565 func cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) {
566 r0, _, _ := syscall.Syscall(procCM_MapCrToWin32Err.Addr(), 2, uintptr(configRet), uintptr(defaultWin32Error), 0)
567 ret = Errno(r0)
568 return
569 }
570
571 func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) {
572 var _p0 uint32
573 if resetToDefault {
574 _p0 = 1
575 }
576 r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
577 if r1 == 0 {
578 err = errnoErr(e1)
579 }
580 return
581 }
582
583 func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) {
584 var _p0 uint32
585 if disableAllPrivileges {
586 _p0 = 1
587 }
588 r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
589 if r1 == 0 {
590 err = errnoErr(e1)
591 }
592 return
593 }
594
595 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) {
596 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)
597 if r1 == 0 {
598 err = errnoErr(e1)
599 }
600 return
601 }
602
603 func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) {
604 r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor)))
605 if r0 != 0 {
606 ret = syscall.Errno(r0)
607 }
608 return
609 }
610
611 func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) {
612 r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info)))
613 if r1 == 0 {
614 err = errnoErr(e1)
615 }
616 return
617 }
618
619 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) {
620 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)
621 if r1 == 0 {
622 err = errnoErr(e1)
623 }
624 return
625 }
626
627 func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) {
628 r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember)))
629 if r1 == 0 {
630 err = errnoErr(e1)
631 }
632 return
633 }
634
635 func CloseServiceHandle(handle Handle) (err error) {
636 r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0)
637 if r1 == 0 {
638 err = errnoErr(e1)
639 }
640 return
641 }
642
643 func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
644 r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
645 if r1 == 0 {
646 err = errnoErr(e1)
647 }
648 return
649 }
650
651 func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) {
652 r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0)
653 if r1 == 0 {
654 err = errnoErr(e1)
655 }
656 return
657 }
658
659 func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
660 r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
661 if r1 == 0 {
662 err = errnoErr(e1)
663 }
664 return
665 }
666
667 func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
668 var _p0 *uint16
669 _p0, err = syscall.UTF16PtrFromString(str)
670 if err != nil {
671 return
672 }
673 return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
674 }
675
676 func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
677 r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
678 if r1 == 0 {
679 err = errnoErr(e1)
680 }
681 return
682 }
683
684 func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
685 r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
686 if r1 == 0 {
687 err = errnoErr(e1)
688 }
689 return
690 }
691
692 func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
693 r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
694 if r1 == 0 {
695 err = errnoErr(e1)
696 }
697 return
698 }
699
700 func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
701 var _p0 uint32
702 if inheritHandles {
703 _p0 = 1
704 }
705 r1, _, e1 := syscall.Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), 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)
706 if r1 == 0 {
707 err = errnoErr(e1)
708 }
709 return
710 }
711
712 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) {
713 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)
714 handle = Handle(r0)
715 if handle == 0 {
716 err = errnoErr(e1)
717 }
718 return
719 }
720
721 func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) {
722 r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0)
723 if r1 == 0 {
724 err = errnoErr(e1)
725 }
726 return
727 }
728
729 func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
730 r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
731 if r1 == 0 {
732 err = errnoErr(e1)
733 }
734 return
735 }
736
737 func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
738 r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
739 if r1 == 0 {
740 err = errnoErr(e1)
741 }
742 return
743 }
744
745 func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
746 r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
747 if r1 == 0 {
748 err = errnoErr(e1)
749 }
750 return
751 }
752
753 func DeleteService(service Handle) (err error) {
754 r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0)
755 if r1 == 0 {
756 err = errnoErr(e1)
757 }
758 return
759 }
760
761 func DeregisterEventSource(handle Handle) (err error) {
762 r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0)
763 if r1 == 0 {
764 err = errnoErr(e1)
765 }
766 return
767 }
768
769 func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) {
770 r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken)))
771 if r1 == 0 {
772 err = errnoErr(e1)
773 }
774 return
775 }
776
777 func EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) {
778 r1, _, e1 := syscall.Syscall6(procEnumDependentServicesW.Addr(), 6, uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)))
779 if r1 == 0 {
780 err = errnoErr(e1)
781 }
782 return
783 }
784
785 func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) {
786 r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0)
787 if r1 == 0 {
788 err = errnoErr(e1)
789 }
790 return
791 }
792
793 func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) {
794 r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0)
795 isEqual = r0 != 0
796 return
797 }
798
799 func FreeSid(sid *SID) (err error) {
800 r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
801 if r1 != 0 {
802 err = errnoErr(e1)
803 }
804 return
805 }
806
807 func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) {
808 r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce)))
809 if r1 == 0 {
810 err = errnoErr(e1)
811 }
812 return
813 }
814
815 func GetLengthSid(sid *SID) (len uint32) {
816 r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
817 len = uint32(r0)
818 return
819 }
820
821 func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
822 var _p0 *uint16
823 _p0, ret = syscall.UTF16PtrFromString(objectName)
824 if ret != nil {
825 return
826 }
827 return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd)
828 }
829
830 func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
831 r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
832 if r0 != 0 {
833 ret = syscall.Errno(r0)
834 }
835 return
836 }
837
838 func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) {
839 r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision)))
840 if r1 == 0 {
841 err = errnoErr(e1)
842 }
843 return
844 }
845
846 func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) {
847 var _p0 uint32
848 if *daclPresent {
849 _p0 = 1
850 }
851 var _p1 uint32
852 if *daclDefaulted {
853 _p1 = 1
854 }
855 r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
856 *daclPresent = _p0 != 0
857 *daclDefaulted = _p1 != 0
858 if r1 == 0 {
859 err = errnoErr(e1)
860 }
861 return
862 }
863
864 func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) {
865 var _p0 uint32
866 if *groupDefaulted {
867 _p0 = 1
868 }
869 r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0)))
870 *groupDefaulted = _p0 != 0
871 if r1 == 0 {
872 err = errnoErr(e1)
873 }
874 return
875 }
876
877 func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) {
878 r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
879 len = uint32(r0)
880 return
881 }
882
883 func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) {
884 var _p0 uint32
885 if *ownerDefaulted {
886 _p0 = 1
887 }
888 r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0)))
889 *ownerDefaulted = _p0 != 0
890 if r1 == 0 {
891 err = errnoErr(e1)
892 }
893 return
894 }
895
896 func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) {
897 r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
898 if r0 != 0 {
899 ret = syscall.Errno(r0)
900 }
901 return
902 }
903
904 func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) {
905 var _p0 uint32
906 if *saclPresent {
907 _p0 = 1
908 }
909 var _p1 uint32
910 if *saclDefaulted {
911 _p1 = 1
912 }
913 r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
914 *saclPresent = _p0 != 0
915 *saclDefaulted = _p1 != 0
916 if r1 == 0 {
917 err = errnoErr(e1)
918 }
919 return
920 }
921
922 func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
923 r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
924 if r0 != 0 {
925 ret = syscall.Errno(r0)
926 }
927 return
928 }
929
930 func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) {
931 r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
932 authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0))
933 return
934 }
935
936 func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) {
937 r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0)
938 subAuthority = (*uint32)(unsafe.Pointer(r0))
939 return
940 }
941
942 func getSidSubAuthorityCount(sid *SID) (count *uint8) {
943 r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
944 count = (*uint8)(unsafe.Pointer(r0))
945 return
946 }
947
948 func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
949 r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
950 if r1 == 0 {
951 err = errnoErr(e1)
952 }
953 return
954 }
955
956 func ImpersonateSelf(impersonationlevel uint32) (err error) {
957 r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
958 if r1 == 0 {
959 err = errnoErr(e1)
960 }
961 return
962 }
963
964 func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) {
965 r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0)
966 if r1 == 0 {
967 err = errnoErr(e1)
968 }
969 return
970 }
971
972 func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) {
973 var _p0 uint32
974 if forceAppsClosed {
975 _p0 = 1
976 }
977 var _p1 uint32
978 if rebootAfterShutdown {
979 _p1 = 1
980 }
981 r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason))
982 if r1 == 0 {
983 err = errnoErr(e1)
984 }
985 return
986 }
987
988 func isTokenRestricted(tokenHandle Token) (ret bool, err error) {
989 r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0)
990 ret = r0 != 0
991 if !ret {
992 err = errnoErr(e1)
993 }
994 return
995 }
996
997 func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) {
998 r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
999 isValid = r0 != 0
1000 return
1001 }
1002
1003 func isValidSid(sid *SID) (isValid bool) {
1004 r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
1005 isValid = r0 != 0
1006 return
1007 }
1008
1009 func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) {
1010 r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0)
1011 isWellKnown = r0 != 0
1012 return
1013 }
1014
1015 func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
1016 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)
1017 if r1 == 0 {
1018 err = errnoErr(e1)
1019 }
1020 return
1021 }
1022
1023 func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
1024 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)
1025 if r1 == 0 {
1026 err = errnoErr(e1)
1027 }
1028 return
1029 }
1030
1031 func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
1032 r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
1033 if r1 == 0 {
1034 err = errnoErr(e1)
1035 }
1036 return
1037 }
1038
1039 func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) {
1040 r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0)
1041 if r1 == 0 {
1042 err = errnoErr(e1)
1043 }
1044 return
1045 }
1046
1047 func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) {
1048 r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize)))
1049 if r1 == 0 {
1050 err = errnoErr(e1)
1051 }
1052 return
1053 }
1054
1055 func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) {
1056 r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier)))
1057 if r0 != 0 {
1058 ret = syscall.Errno(r0)
1059 }
1060 return
1061 }
1062
1063 func OpenProcessToken(process Handle, access uint32, token *Token) (err error) {
1064 r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token)))
1065 if r1 == 0 {
1066 err = errnoErr(e1)
1067 }
1068 return
1069 }
1070
1071 func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) {
1072 r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
1073 handle = Handle(r0)
1074 if handle == 0 {
1075 err = errnoErr(e1)
1076 }
1077 return
1078 }
1079
1080 func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) {
1081 r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
1082 handle = Handle(r0)
1083 if handle == 0 {
1084 err = errnoErr(e1)
1085 }
1086 return
1087 }
1088
1089 func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) {
1090 var _p0 uint32
1091 if openAsSelf {
1092 _p0 = 1
1093 }
1094 r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
1095 if r1 == 0 {
1096 err = errnoErr(e1)
1097 }
1098 return
1099 }
1100
1101 func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
1102 r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
1103 if r1 == 0 {
1104 err = errnoErr(e1)
1105 }
1106 return
1107 }
1108
1109 func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) {
1110 r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
1111 if r1 == 0 {
1112 err = errnoErr(e1)
1113 }
1114 return
1115 }
1116
1117 func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) {
1118 err = procQueryServiceDynamicInformation.Find()
1119 if err != nil {
1120 return
1121 }
1122 r1, _, e1 := syscall.Syscall(procQueryServiceDynamicInformation.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo))
1123 if r1 == 0 {
1124 err = errnoErr(e1)
1125 }
1126 return
1127 }
1128
1129 func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) {
1130 r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
1131 if r1 == 0 {
1132 err = errnoErr(e1)
1133 }
1134 return
1135 }
1136
1137 func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) {
1138 r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0)
1139 if r1 == 0 {
1140 err = errnoErr(e1)
1141 }
1142 return
1143 }
1144
1145 func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
1146 r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
1147 if r1 == 0 {
1148 err = errnoErr(e1)
1149 }
1150 return
1151 }
1152
1153 func RegCloseKey(key Handle) (regerrno error) {
1154 r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0)
1155 if r0 != 0 {
1156 regerrno = syscall.Errno(r0)
1157 }
1158 return
1159 }
1160
1161 func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) {
1162 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)
1163 if r0 != 0 {
1164 regerrno = syscall.Errno(r0)
1165 }
1166 return
1167 }
1168
1169 func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) {
1170 var _p0 uint32
1171 if watchSubtree {
1172 _p0 = 1
1173 }
1174 var _p1 uint32
1175 if asynchronous {
1176 _p1 = 1
1177 }
1178 r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0)
1179 if r0 != 0 {
1180 regerrno = syscall.Errno(r0)
1181 }
1182 return
1183 }
1184
1185 func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) {
1186 r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0)
1187 if r0 != 0 {
1188 regerrno = syscall.Errno(r0)
1189 }
1190 return
1191 }
1192
1193 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) {
1194 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)))
1195 if r0 != 0 {
1196 regerrno = syscall.Errno(r0)
1197 }
1198 return
1199 }
1200
1201 func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
1202 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)))
1203 if r0 != 0 {
1204 regerrno = syscall.Errno(r0)
1205 }
1206 return
1207 }
1208
1209 func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
1210 r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0)
1211 handle = Handle(r0)
1212 if handle == 0 {
1213 err = errnoErr(e1)
1214 }
1215 return
1216 }
1217
1218 func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) {
1219 r0, _, e1 := syscall.Syscall(procRegisterServiceCtrlHandlerExW.Addr(), 3, uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context))
1220 handle = Handle(r0)
1221 if handle == 0 {
1222 err = errnoErr(e1)
1223 }
1224 return
1225 }
1226
1227 func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) {
1228 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)))
1229 if r1 == 0 {
1230 err = errnoErr(e1)
1231 }
1232 return
1233 }
1234
1235 func RevertToSelf() (err error) {
1236 r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
1237 if r1 == 0 {
1238 err = errnoErr(e1)
1239 }
1240 return
1241 }
1242
1243 func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) {
1244 r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0)
1245 if r0 != 0 {
1246 ret = syscall.Errno(r0)
1247 }
1248 return
1249 }
1250
1251 func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) {
1252 r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor)))
1253 if r1 == 0 {
1254 err = errnoErr(e1)
1255 }
1256 return
1257 }
1258
1259 func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
1260 var _p0 *uint16
1261 _p0, ret = syscall.UTF16PtrFromString(objectName)
1262 if ret != nil {
1263 return
1264 }
1265 return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl)
1266 }
1267
1268 func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
1269 r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
1270 if r0 != 0 {
1271 ret = syscall.Errno(r0)
1272 }
1273 return
1274 }
1275
1276 func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) {
1277 r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet))
1278 if r1 == 0 {
1279 err = errnoErr(e1)
1280 }
1281 return
1282 }
1283
1284 func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) {
1285 var _p0 uint32
1286 if daclPresent {
1287 _p0 = 1
1288 }
1289 var _p1 uint32
1290 if daclDefaulted {
1291 _p1 = 1
1292 }
1293 r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0)
1294 if r1 == 0 {
1295 err = errnoErr(e1)
1296 }
1297 return
1298 }
1299
1300 func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) {
1301 var _p0 uint32
1302 if groupDefaulted {
1303 _p0 = 1
1304 }
1305 r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0))
1306 if r1 == 0 {
1307 err = errnoErr(e1)
1308 }
1309 return
1310 }
1311
1312 func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) {
1313 var _p0 uint32
1314 if ownerDefaulted {
1315 _p0 = 1
1316 }
1317 r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0))
1318 if r1 == 0 {
1319 err = errnoErr(e1)
1320 }
1321 return
1322 }
1323
1324 func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) {
1325 syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
1326 return
1327 }
1328
1329 func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) {
1330 var _p0 uint32
1331 if saclPresent {
1332 _p0 = 1
1333 }
1334 var _p1 uint32
1335 if saclDefaulted {
1336 _p1 = 1
1337 }
1338 r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0)
1339 if r1 == 0 {
1340 err = errnoErr(e1)
1341 }
1342 return
1343 }
1344
1345 func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
1346 r0, _, _ := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
1347 if r0 != 0 {
1348 ret = syscall.Errno(r0)
1349 }
1350 return
1351 }
1352
1353 func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) {
1354 r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0)
1355 if r1 == 0 {
1356 err = errnoErr(e1)
1357 }
1358 return
1359 }
1360
1361 func SetThreadToken(thread *Handle, token Token) (err error) {
1362 r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0)
1363 if r1 == 0 {
1364 err = errnoErr(e1)
1365 }
1366 return
1367 }
1368
1369 func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) {
1370 r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0)
1371 if r1 == 0 {
1372 err = errnoErr(e1)
1373 }
1374 return
1375 }
1376
1377 func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) {
1378 r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0)
1379 if r1 == 0 {
1380 err = errnoErr(e1)
1381 }
1382 return
1383 }
1384
1385 func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) {
1386 r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors)))
1387 if r1 == 0 {
1388 err = errnoErr(e1)
1389 }
1390 return
1391 }
1392
1393 func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
1394 r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
1395 if r1 == 0 {
1396 err = errnoErr(e1)
1397 }
1398 return
1399 }
1400
1401 func CertCloseStore(store Handle, flags uint32) (err error) {
1402 r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
1403 if r1 == 0 {
1404 err = errnoErr(e1)
1405 }
1406 return
1407 }
1408
1409 func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) {
1410 r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen))
1411 context = (*CertContext)(unsafe.Pointer(r0))
1412 if context == nil {
1413 err = errnoErr(e1)
1414 }
1415 return
1416 }
1417
1418 func CertDeleteCertificateFromStore(certContext *CertContext) (err error) {
1419 r1, _, e1 := syscall.Syscall(procCertDeleteCertificateFromStore.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0)
1420 if r1 == 0 {
1421 err = errnoErr(e1)
1422 }
1423 return
1424 }
1425
1426 func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) {
1427 r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0)
1428 dupContext = (*CertContext)(unsafe.Pointer(r0))
1429 return
1430 }
1431
1432 func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) {
1433 r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0)
1434 context = (*CertContext)(unsafe.Pointer(r0))
1435 if context == nil {
1436 err = errnoErr(e1)
1437 }
1438 return
1439 }
1440
1441 func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) {
1442 r0, _, e1 := syscall.Syscall6(procCertFindCertificateInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext)))
1443 cert = (*CertContext)(unsafe.Pointer(r0))
1444 if cert == nil {
1445 err = errnoErr(e1)
1446 }
1447 return
1448 }
1449
1450 func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) {
1451 r0, _, e1 := syscall.Syscall6(procCertFindChainInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext)))
1452 certchain = (*CertChainContext)(unsafe.Pointer(r0))
1453 if certchain == nil {
1454 err = errnoErr(e1)
1455 }
1456 return
1457 }
1458
1459 func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) {
1460 r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions)))
1461 ret = (*CertExtension)(unsafe.Pointer(r0))
1462 return
1463 }
1464
1465 func CertFreeCertificateChain(ctx *CertChainContext) {
1466 syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1467 return
1468 }
1469
1470 func CertFreeCertificateContext(ctx *CertContext) (err error) {
1471 r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1472 if r1 == 0 {
1473 err = errnoErr(e1)
1474 }
1475 return
1476 }
1477
1478 func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
1479 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)
1480 if r1 == 0 {
1481 err = errnoErr(e1)
1482 }
1483 return
1484 }
1485
1486 func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) {
1487 r0, _, _ := syscall.Syscall6(procCertGetNameStringW.Addr(), 6, uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size))
1488 chars = uint32(r0)
1489 return
1490 }
1491
1492 func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
1493 r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
1494 handle = Handle(r0)
1495 if handle == 0 {
1496 err = errnoErr(e1)
1497 }
1498 return
1499 }
1500
1501 func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
1502 r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0)
1503 store = Handle(r0)
1504 if store == 0 {
1505 err = errnoErr(e1)
1506 }
1507 return
1508 }
1509
1510 func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
1511 r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
1512 if r1 == 0 {
1513 err = errnoErr(e1)
1514 }
1515 return
1516 }
1517
1518 func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) {
1519 var _p0 uint32
1520 if *callerFreeProvOrNCryptKey {
1521 _p0 = 1
1522 }
1523 r1, _, e1 := syscall.Syscall6(procCryptAcquireCertificatePrivateKey.Addr(), 6, uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0)))
1524 *callerFreeProvOrNCryptKey = _p0 != 0
1525 if r1 == 0 {
1526 err = errnoErr(e1)
1527 }
1528 return
1529 }
1530
1531 func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) {
1532 r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0)
1533 if r1 == 0 {
1534 err = errnoErr(e1)
1535 }
1536 return
1537 }
1538
1539 func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) {
1540 r1, _, e1 := syscall.Syscall9(procCryptProtectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0)
1541 if r1 == 0 {
1542 err = errnoErr(e1)
1543 }
1544 return
1545 }
1546
1547 func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) {
1548 r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0)
1549 if r1 == 0 {
1550 err = errnoErr(e1)
1551 }
1552 return
1553 }
1554
1555 func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) {
1556 r1, _, e1 := syscall.Syscall9(procCryptUnprotectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0)
1557 if r1 == 0 {
1558 err = errnoErr(e1)
1559 }
1560 return
1561 }
1562
1563 func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) {
1564 r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags))
1565 store = Handle(r0)
1566 if store == 0 {
1567 err = errnoErr(e1)
1568 }
1569 return
1570 }
1571
1572 func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) {
1573 r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0)
1574 same = r0 != 0
1575 return
1576 }
1577
1578 func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
1579 var _p0 *uint16
1580 _p0, status = syscall.UTF16PtrFromString(name)
1581 if status != nil {
1582 return
1583 }
1584 return _DnsQuery(_p0, qtype, options, extra, qrs, pr)
1585 }
1586
1587 func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
1588 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)))
1589 if r0 != 0 {
1590 status = syscall.Errno(r0)
1591 }
1592 return
1593 }
1594
1595 func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
1596 syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
1597 return
1598 }
1599
1600 func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) {
1601 r0, _, _ := syscall.Syscall6(procDwmGetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0)
1602 if r0 != 0 {
1603 ret = syscall.Errno(r0)
1604 }
1605 return
1606 }
1607
1608 func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) {
1609 r0, _, _ := syscall.Syscall6(procDwmSetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0)
1610 if r0 != 0 {
1611 ret = syscall.Errno(r0)
1612 }
1613 return
1614 }
1615
1616 func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) {
1617 r0, _, _ := syscall.Syscall(procCancelMibChangeNotify2.Addr(), 1, uintptr(notificationHandle), 0, 0)
1618 if r0 != 0 {
1619 errcode = syscall.Errno(r0)
1620 }
1621 return
1622 }
1623
1624 func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
1625 r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
1626 if r0 != 0 {
1627 errcode = syscall.Errno(r0)
1628 }
1629 return
1630 }
1631
1632 func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) {
1633 r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
1634 if r0 != 0 {
1635 errcode = syscall.Errno(r0)
1636 }
1637 return
1638 }
1639
1640 func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) {
1641 r0, _, _ := syscall.Syscall(procGetBestInterfaceEx.Addr(), 2, uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex)), 0)
1642 if r0 != 0 {
1643 errcode = syscall.Errno(r0)
1644 }
1645 return
1646 }
1647
1648 func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
1649 r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
1650 if r0 != 0 {
1651 errcode = syscall.Errno(r0)
1652 }
1653 return
1654 }
1655
1656 func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) {
1657 r0, _, _ := syscall.Syscall(procGetIfEntry2Ex.Addr(), 2, uintptr(level), uintptr(unsafe.Pointer(row)), 0)
1658 if r0 != 0 {
1659 errcode = syscall.Errno(r0)
1660 }
1661 return
1662 }
1663
1664 func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
1665 r0, _, _ := syscall.Syscall(procGetUnicastIpAddressEntry.Addr(), 1, uintptr(unsafe.Pointer(row)), 0, 0)
1666 if r0 != 0 {
1667 errcode = syscall.Errno(r0)
1668 }
1669 return
1670 }
1671
1672 func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
1673 var _p0 uint32
1674 if initialNotification {
1675 _p0 = 1
1676 }
1677 r0, _, _ := syscall.Syscall6(procNotifyIpInterfaceChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0)
1678 if r0 != 0 {
1679 errcode = syscall.Errno(r0)
1680 }
1681 return
1682 }
1683
1684 func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
1685 var _p0 uint32
1686 if initialNotification {
1687 _p0 = 1
1688 }
1689 r0, _, _ := syscall.Syscall6(procNotifyUnicastIpAddressChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0)
1690 if r0 != 0 {
1691 errcode = syscall.Errno(r0)
1692 }
1693 return
1694 }
1695
1696 func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
1697 r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
1698 cookie = uintptr(r0)
1699 if cookie == 0 {
1700 err = errnoErr(e1)
1701 }
1702 return
1703 }
1704
1705 func AssignProcessToJobObject(job Handle, process Handle) (err error) {
1706 r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
1707 if r1 == 0 {
1708 err = errnoErr(e1)
1709 }
1710 return
1711 }
1712
1713 func CancelIo(s Handle) (err error) {
1714 r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
1715 if r1 == 0 {
1716 err = errnoErr(e1)
1717 }
1718 return
1719 }
1720
1721 func CancelIoEx(s Handle, o *Overlapped) (err error) {
1722 r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0)
1723 if r1 == 0 {
1724 err = errnoErr(e1)
1725 }
1726 return
1727 }
1728
1729 func ClearCommBreak(handle Handle) (err error) {
1730 r1, _, e1 := syscall.Syscall(procClearCommBreak.Addr(), 1, uintptr(handle), 0, 0)
1731 if r1 == 0 {
1732 err = errnoErr(e1)
1733 }
1734 return
1735 }
1736
1737 func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) {
1738 r1, _, e1 := syscall.Syscall(procClearCommError.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat)))
1739 if r1 == 0 {
1740 err = errnoErr(e1)
1741 }
1742 return
1743 }
1744
1745 func CloseHandle(handle Handle) (err error) {
1746 r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
1747 if r1 == 0 {
1748 err = errnoErr(e1)
1749 }
1750 return
1751 }
1752
1753 func ClosePseudoConsole(console Handle) {
1754 syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(console), 0, 0)
1755 return
1756 }
1757
1758 func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) {
1759 r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0)
1760 if r1 == 0 {
1761 err = errnoErr(e1)
1762 }
1763 return
1764 }
1765
1766 func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
1767 r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
1768 if r1 == 0 {
1769 err = errnoErr(e1)
1770 }
1771 return
1772 }
1773
1774 func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
1775 r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
1776 handle = Handle(r0)
1777 if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
1778 err = errnoErr(e1)
1779 }
1780 return
1781 }
1782
1783 func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) {
1784 r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
1785 handle = Handle(r0)
1786 if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
1787 err = errnoErr(e1)
1788 }
1789 return
1790 }
1791
1792 func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) {
1793 r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
1794 handle = Handle(r0)
1795 if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
1796 err = errnoErr(e1)
1797 }
1798 return
1799 }
1800
1801 func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
1802 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)
1803 handle = Handle(r0)
1804 if handle == InvalidHandle {
1805 err = errnoErr(e1)
1806 }
1807 return
1808 }
1809
1810 func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) {
1811 r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved))
1812 if r1&0xff == 0 {
1813 err = errnoErr(e1)
1814 }
1815 return
1816 }
1817
1818 func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) {
1819 r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
1820 handle = Handle(r0)
1821 if handle == 0 {
1822 err = errnoErr(e1)
1823 }
1824 return
1825 }
1826
1827 func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) {
1828 r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0)
1829 handle = Handle(r0)
1830 if handle == 0 {
1831 err = errnoErr(e1)
1832 }
1833 return
1834 }
1835
1836 func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
1837 r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
1838 handle = Handle(r0)
1839 if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
1840 err = errnoErr(e1)
1841 }
1842 return
1843 }
1844
1845 func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) {
1846 var _p0 uint32
1847 if initialOwner {
1848 _p0 = 1
1849 }
1850 r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name)))
1851 handle = Handle(r0)
1852 if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
1853 err = errnoErr(e1)
1854 }
1855 return
1856 }
1857
1858 func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) {
1859 r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0)
1860 handle = Handle(r0)
1861 if handle == InvalidHandle {
1862 err = errnoErr(e1)
1863 }
1864 return
1865 }
1866
1867 func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
1868 r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
1869 if r1 == 0 {
1870 err = errnoErr(e1)
1871 }
1872 return
1873 }
1874
1875 func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
1876 var _p0 uint32
1877 if inheritHandles {
1878 _p0 = 1
1879 }
1880 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)
1881 if r1 == 0 {
1882 err = errnoErr(e1)
1883 }
1884 return
1885 }
1886
1887 func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) {
1888 r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole)), 0)
1889 if r0 != 0 {
1890 hr = syscall.Errno(r0)
1891 }
1892 return
1893 }
1894
1895 func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) {
1896 r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags))
1897 if r1&0xff == 0 {
1898 err = errnoErr(e1)
1899 }
1900 return
1901 }
1902
1903 func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) {
1904 r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0)
1905 handle = Handle(r0)
1906 if handle == InvalidHandle {
1907 err = errnoErr(e1)
1908 }
1909 return
1910 }
1911
1912 func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
1913 r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
1914 if r1 == 0 {
1915 err = errnoErr(e1)
1916 }
1917 return
1918 }
1919
1920 func DeleteFile(path *uint16) (err error) {
1921 r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
1922 if r1 == 0 {
1923 err = errnoErr(e1)
1924 }
1925 return
1926 }
1927
1928 func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) {
1929 syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0)
1930 return
1931 }
1932
1933 func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) {
1934 r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0)
1935 if r1 == 0 {
1936 err = errnoErr(e1)
1937 }
1938 return
1939 }
1940
1941 func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
1942 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)
1943 if r1 == 0 {
1944 err = errnoErr(e1)
1945 }
1946 return
1947 }
1948
1949 func DisconnectNamedPipe(pipe Handle) (err error) {
1950 r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(pipe), 0, 0)
1951 if r1 == 0 {
1952 err = errnoErr(e1)
1953 }
1954 return
1955 }
1956
1957 func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
1958 var _p0 uint32
1959 if bInheritHandle {
1960 _p0 = 1
1961 }
1962 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)
1963 if r1 == 0 {
1964 err = errnoErr(e1)
1965 }
1966 return
1967 }
1968
1969 func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) {
1970 r1, _, e1 := syscall.Syscall(procEscapeCommFunction.Addr(), 2, uintptr(handle), uintptr(dwFunc), 0)
1971 if r1 == 0 {
1972 err = errnoErr(e1)
1973 }
1974 return
1975 }
1976
1977 func ExitProcess(exitcode uint32) {
1978 syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
1979 return
1980 }
1981
1982 func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) {
1983 r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size))
1984 n = uint32(r0)
1985 if n == 0 {
1986 err = errnoErr(e1)
1987 }
1988 return
1989 }
1990
1991 func FindClose(handle Handle) (err error) {
1992 r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
1993 if r1 == 0 {
1994 err = errnoErr(e1)
1995 }
1996 return
1997 }
1998
1999 func FindCloseChangeNotification(handle Handle) (err error) {
2000 r1, _, e1 := syscall.Syscall(procFindCloseChangeNotification.Addr(), 1, uintptr(handle), 0, 0)
2001 if r1 == 0 {
2002 err = errnoErr(e1)
2003 }
2004 return
2005 }
2006
2007 func FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) {
2008 var _p0 *uint16
2009 _p0, err = syscall.UTF16PtrFromString(path)
2010 if err != nil {
2011 return
2012 }
2013 return _FindFirstChangeNotification(_p0, watchSubtree, notifyFilter)
2014 }
2015
2016 func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) {
2017 var _p1 uint32
2018 if watchSubtree {
2019 _p1 = 1
2020 }
2021 r0, _, e1 := syscall.Syscall(procFindFirstChangeNotificationW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter))
2022 handle = Handle(r0)
2023 if handle == InvalidHandle {
2024 err = errnoErr(e1)
2025 }
2026 return
2027 }
2028
2029 func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) {
2030 r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
2031 handle = Handle(r0)
2032 if handle == InvalidHandle {
2033 err = errnoErr(e1)
2034 }
2035 return
2036 }
2037
2038 func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) {
2039 r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
2040 handle = Handle(r0)
2041 if handle == InvalidHandle {
2042 err = errnoErr(e1)
2043 }
2044 return
2045 }
2046
2047 func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) {
2048 r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0)
2049 handle = Handle(r0)
2050 if handle == InvalidHandle {
2051 err = errnoErr(e1)
2052 }
2053 return
2054 }
2055
2056 func FindNextChangeNotification(handle Handle) (err error) {
2057 r1, _, e1 := syscall.Syscall(procFindNextChangeNotification.Addr(), 1, uintptr(handle), 0, 0)
2058 if r1 == 0 {
2059 err = errnoErr(e1)
2060 }
2061 return
2062 }
2063
2064 func findNextFile1(handle Handle, data *win32finddata1) (err error) {
2065 r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
2066 if r1 == 0 {
2067 err = errnoErr(e1)
2068 }
2069 return
2070 }
2071
2072 func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) {
2073 r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
2074 if r1 == 0 {
2075 err = errnoErr(e1)
2076 }
2077 return
2078 }
2079
2080 func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) {
2081 r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength))
2082 if r1 == 0 {
2083 err = errnoErr(e1)
2084 }
2085 return
2086 }
2087
2088 func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) {
2089 r0, _, e1 := syscall.Syscall(procFindResourceW.Addr(), 3, uintptr(module), uintptr(name), uintptr(resType))
2090 resInfo = Handle(r0)
2091 if resInfo == 0 {
2092 err = errnoErr(e1)
2093 }
2094 return
2095 }
2096
2097 func FindVolumeClose(findVolume Handle) (err error) {
2098 r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0)
2099 if r1 == 0 {
2100 err = errnoErr(e1)
2101 }
2102 return
2103 }
2104
2105 func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) {
2106 r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0)
2107 if r1 == 0 {
2108 err = errnoErr(e1)
2109 }
2110 return
2111 }
2112
2113 func FlushFileBuffers(handle Handle) (err error) {
2114 r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
2115 if r1 == 0 {
2116 err = errnoErr(e1)
2117 }
2118 return
2119 }
2120
2121 func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
2122 r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
2123 if r1 == 0 {
2124 err = errnoErr(e1)
2125 }
2126 return
2127 }
2128
2129 func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) {
2130 var _p0 *uint16
2131 if len(buf) > 0 {
2132 _p0 = &buf[0]
2133 }
2134 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)
2135 n = uint32(r0)
2136 if n == 0 {
2137 err = errnoErr(e1)
2138 }
2139 return
2140 }
2141
2142 func FreeEnvironmentStrings(envs *uint16) (err error) {
2143 r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
2144 if r1 == 0 {
2145 err = errnoErr(e1)
2146 }
2147 return
2148 }
2149
2150 func FreeLibrary(handle Handle) (err error) {
2151 r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
2152 if r1 == 0 {
2153 err = errnoErr(e1)
2154 }
2155 return
2156 }
2157
2158 func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) {
2159 r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0)
2160 if r1 == 0 {
2161 err = errnoErr(e1)
2162 }
2163 return
2164 }
2165
2166 func GetACP() (acp uint32) {
2167 r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
2168 acp = uint32(r0)
2169 return
2170 }
2171
2172 func GetActiveProcessorCount(groupNumber uint16) (ret uint32) {
2173 r0, _, _ := syscall.Syscall(procGetActiveProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0)
2174 ret = uint32(r0)
2175 return
2176 }
2177
2178 func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) {
2179 r1, _, e1 := syscall.Syscall(procGetCommModemStatus.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpModemStat)), 0)
2180 if r1 == 0 {
2181 err = errnoErr(e1)
2182 }
2183 return
2184 }
2185
2186 func GetCommState(handle Handle, lpDCB *DCB) (err error) {
2187 r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0)
2188 if r1 == 0 {
2189 err = errnoErr(e1)
2190 }
2191 return
2192 }
2193
2194 func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
2195 r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
2196 if r1 == 0 {
2197 err = errnoErr(e1)
2198 }
2199 return
2200 }
2201
2202 func GetCommandLine() (cmd *uint16) {
2203 r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0)
2204 cmd = (*uint16)(unsafe.Pointer(r0))
2205 return
2206 }
2207
2208 func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) {
2209 r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
2210 if r1 == 0 {
2211 err = errnoErr(e1)
2212 }
2213 return
2214 }
2215
2216 func GetComputerName(buf *uint16, n *uint32) (err error) {
2217 r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
2218 if r1 == 0 {
2219 err = errnoErr(e1)
2220 }
2221 return
2222 }
2223
2224 func GetConsoleCP() (cp uint32, err error) {
2225 r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0)
2226 cp = uint32(r0)
2227 if cp == 0 {
2228 err = errnoErr(e1)
2229 }
2230 return
2231 }
2232
2233 func GetConsoleMode(console Handle, mode *uint32) (err error) {
2234 r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
2235 if r1 == 0 {
2236 err = errnoErr(e1)
2237 }
2238 return
2239 }
2240
2241 func GetConsoleOutputCP() (cp uint32, err error) {
2242 r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0)
2243 cp = uint32(r0)
2244 if cp == 0 {
2245 err = errnoErr(e1)
2246 }
2247 return
2248 }
2249
2250 func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
2251 r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
2252 if r1 == 0 {
2253 err = errnoErr(e1)
2254 }
2255 return
2256 }
2257
2258 func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
2259 r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
2260 n = uint32(r0)
2261 if n == 0 {
2262 err = errnoErr(e1)
2263 }
2264 return
2265 }
2266
2267 func GetCurrentProcessId() (pid uint32) {
2268 r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
2269 pid = uint32(r0)
2270 return
2271 }
2272
2273 func GetCurrentThreadId() (id uint32) {
2274 r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0)
2275 id = uint32(r0)
2276 return
2277 }
2278
2279 func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) {
2280 r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0)
2281 if r1 == 0 {
2282 err = errnoErr(e1)
2283 }
2284 return
2285 }
2286
2287 func GetDriveType(rootPathName *uint16) (driveType uint32) {
2288 r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
2289 driveType = uint32(r0)
2290 return
2291 }
2292
2293 func GetEnvironmentStrings() (envs *uint16, err error) {
2294 r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0)
2295 envs = (*uint16)(unsafe.Pointer(r0))
2296 if envs == nil {
2297 err = errnoErr(e1)
2298 }
2299 return
2300 }
2301
2302 func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) {
2303 r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size))
2304 n = uint32(r0)
2305 if n == 0 {
2306 err = errnoErr(e1)
2307 }
2308 return
2309 }
2310
2311 func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
2312 r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
2313 if r1 == 0 {
2314 err = errnoErr(e1)
2315 }
2316 return
2317 }
2318
2319 func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
2320 r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
2321 if r1 == 0 {
2322 err = errnoErr(e1)
2323 }
2324 return
2325 }
2326
2327 func GetFileAttributes(name *uint16) (attrs uint32, err error) {
2328 r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
2329 attrs = uint32(r0)
2330 if attrs == INVALID_FILE_ATTRIBUTES {
2331 err = errnoErr(e1)
2332 }
2333 return
2334 }
2335
2336 func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
2337 r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
2338 if r1 == 0 {
2339 err = errnoErr(e1)
2340 }
2341 return
2342 }
2343
2344 func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) {
2345 r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0)
2346 if r1 == 0 {
2347 err = errnoErr(e1)
2348 }
2349 return
2350 }
2351
2352 func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
2353 r1, _, e1 := syscall.Syscall6(procGetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
2354 if r1 == 0 {
2355 err = errnoErr(e1)
2356 }
2357 return
2358 }
2359
2360 func GetFileType(filehandle Handle) (n uint32, err error) {
2361 r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0)
2362 n = uint32(r0)
2363 if n == 0 {
2364 err = errnoErr(e1)
2365 }
2366 return
2367 }
2368
2369 func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
2370 r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0)
2371 n = uint32(r0)
2372 if n == 0 {
2373 err = errnoErr(e1)
2374 }
2375 return
2376 }
2377
2378 func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) {
2379 r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0)
2380 n = uint32(r0)
2381 if n == 0 {
2382 err = errnoErr(e1)
2383 }
2384 return
2385 }
2386
2387 func GetLargePageMinimum() (size uintptr) {
2388 r0, _, _ := syscall.Syscall(procGetLargePageMinimum.Addr(), 0, 0, 0, 0)
2389 size = uintptr(r0)
2390 return
2391 }
2392
2393 func GetLastError() (lasterr error) {
2394 r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
2395 if r0 != 0 {
2396 lasterr = syscall.Errno(r0)
2397 }
2398 return
2399 }
2400
2401 func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) {
2402 r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0)
2403 n = uint32(r0)
2404 if n == 0 {
2405 err = errnoErr(e1)
2406 }
2407 return
2408 }
2409
2410 func GetLogicalDrives() (drivesBitMask uint32, err error) {
2411 r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0)
2412 drivesBitMask = uint32(r0)
2413 if drivesBitMask == 0 {
2414 err = errnoErr(e1)
2415 }
2416 return
2417 }
2418
2419 func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) {
2420 r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen))
2421 n = uint32(r0)
2422 if n == 0 {
2423 err = errnoErr(e1)
2424 }
2425 return
2426 }
2427
2428 func GetMaximumProcessorCount(groupNumber uint16) (ret uint32) {
2429 r0, _, _ := syscall.Syscall(procGetMaximumProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0)
2430 ret = uint32(r0)
2431 return
2432 }
2433
2434 func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) {
2435 r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size))
2436 n = uint32(r0)
2437 if n == 0 {
2438 err = errnoErr(e1)
2439 }
2440 return
2441 }
2442
2443 func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) {
2444 r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module)))
2445 if r1 == 0 {
2446 err = errnoErr(e1)
2447 }
2448 return
2449 }
2450
2451 func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) {
2452 r1, _, e1 := syscall.Syscall(procGetNamedPipeClientProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID)), 0)
2453 if r1 == 0 {
2454 err = errnoErr(e1)
2455 }
2456 return
2457 }
2458
2459 func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) {
2460 r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0)
2461 if r1 == 0 {
2462 err = errnoErr(e1)
2463 }
2464 return
2465 }
2466
2467 func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) {
2468 r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0)
2469 if r1 == 0 {
2470 err = errnoErr(e1)
2471 }
2472 return
2473 }
2474
2475 func GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) {
2476 r1, _, e1 := syscall.Syscall(procGetNamedPipeServerProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID)), 0)
2477 if r1 == 0 {
2478 err = errnoErr(e1)
2479 }
2480 return
2481 }
2482
2483 func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
2484 var _p0 uint32
2485 if wait {
2486 _p0 = 1
2487 }
2488 r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0)
2489 if r1 == 0 {
2490 err = errnoErr(e1)
2491 }
2492 return
2493 }
2494
2495 func GetPriorityClass(process Handle) (ret uint32, err error) {
2496 r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0)
2497 ret = uint32(r0)
2498 if ret == 0 {
2499 err = errnoErr(e1)
2500 }
2501 return
2502 }
2503
2504 func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
2505 var _p0 *byte
2506 _p0, err = syscall.BytePtrFromString(procname)
2507 if err != nil {
2508 return
2509 }
2510 return _GetProcAddress(module, _p0)
2511 }
2512
2513 func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) {
2514 r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0)
2515 proc = uintptr(r0)
2516 if proc == 0 {
2517 err = errnoErr(e1)
2518 }
2519 return
2520 }
2521
2522 func GetProcessId(process Handle) (id uint32, err error) {
2523 r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0)
2524 id = uint32(r0)
2525 if id == 0 {
2526 err = errnoErr(e1)
2527 }
2528 return
2529 }
2530
2531 func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2532 r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2533 if r1 == 0 {
2534 err = errnoErr(e1)
2535 }
2536 return
2537 }
2538
2539 func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) {
2540 r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0)
2541 if r1 == 0 {
2542 err = errnoErr(e1)
2543 }
2544 return
2545 }
2546
2547 func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
2548 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)
2549 if r1 == 0 {
2550 err = errnoErr(e1)
2551 }
2552 return
2553 }
2554
2555 func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) {
2556 syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0)
2557 return
2558 }
2559
2560 func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) {
2561 r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
2562 if r1 == 0 {
2563 err = errnoErr(e1)
2564 }
2565 return
2566 }
2567
2568 func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) {
2569 r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen))
2570 n = uint32(r0)
2571 if n == 0 {
2572 err = errnoErr(e1)
2573 }
2574 return
2575 }
2576
2577 func getStartupInfo(startupInfo *StartupInfo) {
2578 syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
2579 return
2580 }
2581
2582 func GetStdHandle(stdhandle uint32) (handle Handle, err error) {
2583 r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0)
2584 handle = Handle(r0)
2585 if handle == InvalidHandle {
2586 err = errnoErr(e1)
2587 }
2588 return
2589 }
2590
2591 func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2592 r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2593 len = uint32(r0)
2594 if len == 0 {
2595 err = errnoErr(e1)
2596 }
2597 return
2598 }
2599
2600 func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2601 r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2602 if r1 == 0 {
2603 err = errnoErr(e1)
2604 }
2605 return
2606 }
2607
2608 func GetSystemTimeAsFileTime(time *Filetime) {
2609 syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
2610 return
2611 }
2612
2613 func GetSystemTimePreciseAsFileTime(time *Filetime) {
2614 syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
2615 return
2616 }
2617
2618 func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2619 r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2620 len = uint32(r0)
2621 if len == 0 {
2622 err = errnoErr(e1)
2623 }
2624 return
2625 }
2626
2627 func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
2628 r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
2629 n = uint32(r0)
2630 if n == 0 {
2631 err = errnoErr(e1)
2632 }
2633 return
2634 }
2635
2636 func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2637 r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2638 if r1 == 0 {
2639 err = errnoErr(e1)
2640 }
2641 return
2642 }
2643
2644 func getTickCount64() (ms uint64) {
2645 r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0)
2646 ms = uint64(r0)
2647 return
2648 }
2649
2650 func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
2651 r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0)
2652 rc = uint32(r0)
2653 if rc == 0xffffffff {
2654 err = errnoErr(e1)
2655 }
2656 return
2657 }
2658
2659 func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2660 r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2661 if r1 == 0 {
2662 err = errnoErr(e1)
2663 }
2664 return
2665 }
2666
2667 func GetVersion() (ver uint32, err error) {
2668 r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0)
2669 ver = uint32(r0)
2670 if ver == 0 {
2671 err = errnoErr(e1)
2672 }
2673 return
2674 }
2675
2676 func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
2677 r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
2678 if r1 == 0 {
2679 err = errnoErr(e1)
2680 }
2681 return
2682 }
2683
2684 func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
2685 r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
2686 if r1 == 0 {
2687 err = errnoErr(e1)
2688 }
2689 return
2690 }
2691
2692 func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
2693 r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
2694 if r1 == 0 {
2695 err = errnoErr(e1)
2696 }
2697 return
2698 }
2699
2700 func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) {
2701 r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength))
2702 if r1 == 0 {
2703 err = errnoErr(e1)
2704 }
2705 return
2706 }
2707
2708 func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) {
2709 r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0)
2710 if r1 == 0 {
2711 err = errnoErr(e1)
2712 }
2713 return
2714 }
2715
2716 func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2717 r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2718 len = uint32(r0)
2719 if len == 0 {
2720 err = errnoErr(e1)
2721 }
2722 return
2723 }
2724
2725 func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) {
2726 r1, _, e1 := syscall.Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0)
2727 if r1 == 0 {
2728 err = errnoErr(e1)
2729 }
2730 return
2731 }
2732
2733 func IsWow64Process(handle Handle, isWow64 *bool) (err error) {
2734 var _p0 uint32
2735 if *isWow64 {
2736 _p0 = 1
2737 }
2738 r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0)
2739 *isWow64 = _p0 != 0
2740 if r1 == 0 {
2741 err = errnoErr(e1)
2742 }
2743 return
2744 }
2745
2746 func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) {
2747 err = procIsWow64Process2.Find()
2748 if err != nil {
2749 return
2750 }
2751 r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine)))
2752 if r1 == 0 {
2753 err = errnoErr(e1)
2754 }
2755 return
2756 }
2757
2758 func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) {
2759 var _p0 *uint16
2760 _p0, err = syscall.UTF16PtrFromString(libname)
2761 if err != nil {
2762 return
2763 }
2764 return _LoadLibraryEx(_p0, zero, flags)
2765 }
2766
2767 func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) {
2768 r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags))
2769 handle = Handle(r0)
2770 if handle == 0 {
2771 err = errnoErr(e1)
2772 }
2773 return
2774 }
2775
2776 func LoadLibrary(libname string) (handle Handle, err error) {
2777 var _p0 *uint16
2778 _p0, err = syscall.UTF16PtrFromString(libname)
2779 if err != nil {
2780 return
2781 }
2782 return _LoadLibrary(_p0)
2783 }
2784
2785 func _LoadLibrary(libname *uint16) (handle Handle, err error) {
2786 r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0)
2787 handle = Handle(r0)
2788 if handle == 0 {
2789 err = errnoErr(e1)
2790 }
2791 return
2792 }
2793
2794 func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) {
2795 r0, _, e1 := syscall.Syscall(procLoadResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0)
2796 resData = Handle(r0)
2797 if resData == 0 {
2798 err = errnoErr(e1)
2799 }
2800 return
2801 }
2802
2803 func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) {
2804 r0, _, e1 := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0)
2805 ptr = uintptr(r0)
2806 if ptr == 0 {
2807 err = errnoErr(e1)
2808 }
2809 return
2810 }
2811
2812 func LocalFree(hmem Handle) (handle Handle, err error) {
2813 r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0)
2814 handle = Handle(r0)
2815 if handle != 0 {
2816 err = errnoErr(e1)
2817 }
2818 return
2819 }
2820
2821 func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
2822 r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
2823 if r1 == 0 {
2824 err = errnoErr(e1)
2825 }
2826 return
2827 }
2828
2829 func LockResource(resData Handle) (addr uintptr, err error) {
2830 r0, _, e1 := syscall.Syscall(procLockResource.Addr(), 1, uintptr(resData), 0, 0)
2831 addr = uintptr(r0)
2832 if addr == 0 {
2833 err = errnoErr(e1)
2834 }
2835 return
2836 }
2837
2838 func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) {
2839 r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
2840 addr = uintptr(r0)
2841 if addr == 0 {
2842 err = errnoErr(e1)
2843 }
2844 return
2845 }
2846
2847 func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) {
2848 r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
2849 if r1 == 0 {
2850 err = errnoErr(e1)
2851 }
2852 return
2853 }
2854
2855 func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) {
2856 r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
2857 if r1 == 0 {
2858 err = errnoErr(e1)
2859 }
2860 return
2861 }
2862
2863 func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
2864 r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
2865 if r1 == 0 {
2866 err = errnoErr(e1)
2867 }
2868 return
2869 }
2870
2871 func MoveFile(from *uint16, to *uint16) (err error) {
2872 r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
2873 if r1 == 0 {
2874 err = errnoErr(e1)
2875 }
2876 return
2877 }
2878
2879 func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
2880 r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
2881 nwrite = int32(r0)
2882 if nwrite == 0 {
2883 err = errnoErr(e1)
2884 }
2885 return
2886 }
2887
2888 func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2889 var _p0 uint32
2890 if inheritHandle {
2891 _p0 = 1
2892 }
2893 r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2894 handle = Handle(r0)
2895 if handle == 0 {
2896 err = errnoErr(e1)
2897 }
2898 return
2899 }
2900
2901 func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2902 var _p0 uint32
2903 if inheritHandle {
2904 _p0 = 1
2905 }
2906 r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2907 handle = Handle(r0)
2908 if handle == 0 {
2909 err = errnoErr(e1)
2910 }
2911 return
2912 }
2913
2914 func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) {
2915 var _p0 uint32
2916 if inheritHandle {
2917 _p0 = 1
2918 }
2919 r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId))
2920 handle = Handle(r0)
2921 if handle == 0 {
2922 err = errnoErr(e1)
2923 }
2924 return
2925 }
2926
2927 func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) {
2928 var _p0 uint32
2929 if inheritHandle {
2930 _p0 = 1
2931 }
2932 r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId))
2933 handle = Handle(r0)
2934 if handle == 0 {
2935 err = errnoErr(e1)
2936 }
2937 return
2938 }
2939
2940 func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) {
2941 r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
2942 if r1 == 0 {
2943 err = errnoErr(e1)
2944 }
2945 return
2946 }
2947
2948 func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2949 r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
2950 if r1 == 0 {
2951 err = errnoErr(e1)
2952 }
2953 return
2954 }
2955
2956 func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2957 r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
2958 if r1 == 0 {
2959 err = errnoErr(e1)
2960 }
2961 return
2962 }
2963
2964 func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) {
2965 r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0)
2966 if r1 == 0 {
2967 err = errnoErr(e1)
2968 }
2969 return
2970 }
2971
2972 func PulseEvent(event Handle) (err error) {
2973 r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0)
2974 if r1 == 0 {
2975 err = errnoErr(e1)
2976 }
2977 return
2978 }
2979
2980 func PurgeComm(handle Handle, dwFlags uint32) (err error) {
2981 r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(dwFlags), 0)
2982 if r1 == 0 {
2983 err = errnoErr(e1)
2984 }
2985 return
2986 }
2987
2988 func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
2989 r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
2990 n = uint32(r0)
2991 if n == 0 {
2992 err = errnoErr(e1)
2993 }
2994 return
2995 }
2996
2997 func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) {
2998 r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size)), 0, 0)
2999 if r1 == 0 {
3000 err = errnoErr(e1)
3001 }
3002 return
3003 }
3004
3005 func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) {
3006 r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0)
3007 if r1 == 0 {
3008 err = errnoErr(e1)
3009 }
3010 return
3011 }
3012
3013 func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) {
3014 r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0)
3015 if r1 == 0 {
3016 err = errnoErr(e1)
3017 }
3018 return
3019 }
3020
3021 func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
3022 var _p0 uint32
3023 if watchSubTree {
3024 _p0 = 1
3025 }
3026 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)
3027 if r1 == 0 {
3028 err = errnoErr(e1)
3029 }
3030 return
3031 }
3032
3033 func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
3034 var _p0 *byte
3035 if len(buf) > 0 {
3036 _p0 = &buf[0]
3037 }
3038 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)
3039 if r1 == 0 {
3040 err = errnoErr(e1)
3041 }
3042 return
3043 }
3044
3045 func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) {
3046 r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0)
3047 if r1 == 0 {
3048 err = errnoErr(e1)
3049 }
3050 return
3051 }
3052
3053 func ReleaseMutex(mutex Handle) (err error) {
3054 r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0)
3055 if r1 == 0 {
3056 err = errnoErr(e1)
3057 }
3058 return
3059 }
3060
3061 func RemoveDirectory(path *uint16) (err error) {
3062 r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
3063 if r1 == 0 {
3064 err = errnoErr(e1)
3065 }
3066 return
3067 }
3068
3069 func RemoveDllDirectory(cookie uintptr) (err error) {
3070 r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0)
3071 if r1 == 0 {
3072 err = errnoErr(e1)
3073 }
3074 return
3075 }
3076
3077 func ResetEvent(event Handle) (err error) {
3078 r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
3079 if r1 == 0 {
3080 err = errnoErr(e1)
3081 }
3082 return
3083 }
3084
3085 func resizePseudoConsole(pconsole Handle, size uint32) (hr error) {
3086 r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(pconsole), uintptr(size), 0)
3087 if r0 != 0 {
3088 hr = syscall.Errno(r0)
3089 }
3090 return
3091 }
3092
3093 func ResumeThread(thread Handle) (ret uint32, err error) {
3094 r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0)
3095 ret = uint32(r0)
3096 if ret == 0xffffffff {
3097 err = errnoErr(e1)
3098 }
3099 return
3100 }
3101
3102 func SetCommBreak(handle Handle) (err error) {
3103 r1, _, e1 := syscall.Syscall(procSetCommBreak.Addr(), 1, uintptr(handle), 0, 0)
3104 if r1 == 0 {
3105 err = errnoErr(e1)
3106 }
3107 return
3108 }
3109
3110 func SetCommMask(handle Handle, dwEvtMask uint32) (err error) {
3111 r1, _, e1 := syscall.Syscall(procSetCommMask.Addr(), 2, uintptr(handle), uintptr(dwEvtMask), 0)
3112 if r1 == 0 {
3113 err = errnoErr(e1)
3114 }
3115 return
3116 }
3117
3118 func SetCommState(handle Handle, lpDCB *DCB) (err error) {
3119 r1, _, e1 := syscall.Syscall(procSetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0)
3120 if r1 == 0 {
3121 err = errnoErr(e1)
3122 }
3123 return
3124 }
3125
3126 func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
3127 r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
3128 if r1 == 0 {
3129 err = errnoErr(e1)
3130 }
3131 return
3132 }
3133
3134 func SetConsoleCP(cp uint32) (err error) {
3135 r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0)
3136 if r1 == 0 {
3137 err = errnoErr(e1)
3138 }
3139 return
3140 }
3141
3142 func setConsoleCursorPosition(console Handle, position uint32) (err error) {
3143 r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0)
3144 if r1 == 0 {
3145 err = errnoErr(e1)
3146 }
3147 return
3148 }
3149
3150 func SetConsoleMode(console Handle, mode uint32) (err error) {
3151 r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0)
3152 if r1 == 0 {
3153 err = errnoErr(e1)
3154 }
3155 return
3156 }
3157
3158 func SetConsoleOutputCP(cp uint32) (err error) {
3159 r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0)
3160 if r1 == 0 {
3161 err = errnoErr(e1)
3162 }
3163 return
3164 }
3165
3166 func SetCurrentDirectory(path *uint16) (err error) {
3167 r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
3168 if r1 == 0 {
3169 err = errnoErr(e1)
3170 }
3171 return
3172 }
3173
3174 func SetDefaultDllDirectories(directoryFlags uint32) (err error) {
3175 r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0)
3176 if r1 == 0 {
3177 err = errnoErr(e1)
3178 }
3179 return
3180 }
3181
3182 func SetDllDirectory(path string) (err error) {
3183 var _p0 *uint16
3184 _p0, err = syscall.UTF16PtrFromString(path)
3185 if err != nil {
3186 return
3187 }
3188 return _SetDllDirectory(_p0)
3189 }
3190
3191 func _SetDllDirectory(path *uint16) (err error) {
3192 r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
3193 if r1 == 0 {
3194 err = errnoErr(e1)
3195 }
3196 return
3197 }
3198
3199 func SetEndOfFile(handle Handle) (err error) {
3200 r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
3201 if r1 == 0 {
3202 err = errnoErr(e1)
3203 }
3204 return
3205 }
3206
3207 func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
3208 r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
3209 if r1 == 0 {
3210 err = errnoErr(e1)
3211 }
3212 return
3213 }
3214
3215 func SetErrorMode(mode uint32) (ret uint32) {
3216 r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0)
3217 ret = uint32(r0)
3218 return
3219 }
3220
3221 func SetEvent(event Handle) (err error) {
3222 r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0)
3223 if r1 == 0 {
3224 err = errnoErr(e1)
3225 }
3226 return
3227 }
3228
3229 func SetFileAttributes(name *uint16, attrs uint32) (err error) {
3230 r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
3231 if r1 == 0 {
3232 err = errnoErr(e1)
3233 }
3234 return
3235 }
3236
3237 func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) {
3238 r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0)
3239 if r1 == 0 {
3240 err = errnoErr(e1)
3241 }
3242 return
3243 }
3244
3245 func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) {
3246 r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0)
3247 if r1 == 0 {
3248 err = errnoErr(e1)
3249 }
3250 return
3251 }
3252
3253 func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
3254 r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
3255 newlowoffset = uint32(r0)
3256 if newlowoffset == 0xffffffff {
3257 err = errnoErr(e1)
3258 }
3259 return
3260 }
3261
3262 func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
3263 r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
3264 if r1 == 0 {
3265 err = errnoErr(e1)
3266 }
3267 return
3268 }
3269
3270 func SetFileValidData(handle Handle, validDataLength int64) (err error) {
3271 r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0)
3272 if r1 == 0 {
3273 err = errnoErr(e1)
3274 }
3275 return
3276 }
3277
3278 func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
3279 r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
3280 if r1 == 0 {
3281 err = errnoErr(e1)
3282 }
3283 return
3284 }
3285
3286 func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
3287 r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
3288 ret = int(r0)
3289 if ret == 0 {
3290 err = errnoErr(e1)
3291 }
3292 return
3293 }
3294
3295 func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) {
3296 r1, _, e1 := syscall.Syscall6(procSetNamedPipeHandleState.Addr(), 4, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), 0, 0)
3297 if r1 == 0 {
3298 err = errnoErr(e1)
3299 }
3300 return
3301 }
3302
3303 func SetPriorityClass(process Handle, priorityClass uint32) (err error) {
3304 r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0)
3305 if r1 == 0 {
3306 err = errnoErr(e1)
3307 }
3308 return
3309 }
3310
3311 func SetProcessPriorityBoost(process Handle, disable bool) (err error) {
3312 var _p0 uint32
3313 if disable {
3314 _p0 = 1
3315 }
3316 r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0)
3317 if r1 == 0 {
3318 err = errnoErr(e1)
3319 }
3320 return
3321 }
3322
3323 func SetProcessShutdownParameters(level uint32, flags uint32) (err error) {
3324 r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0)
3325 if r1 == 0 {
3326 err = errnoErr(e1)
3327 }
3328 return
3329 }
3330
3331 func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) {
3332 r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0)
3333 if r1 == 0 {
3334 err = errnoErr(e1)
3335 }
3336 return
3337 }
3338
3339 func SetStdHandle(stdhandle uint32, handle Handle) (err error) {
3340 r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0)
3341 if r1 == 0 {
3342 err = errnoErr(e1)
3343 }
3344 return
3345 }
3346
3347 func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) {
3348 r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0)
3349 if r1 == 0 {
3350 err = errnoErr(e1)
3351 }
3352 return
3353 }
3354
3355 func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) {
3356 r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0)
3357 if r1 == 0 {
3358 err = errnoErr(e1)
3359 }
3360 return
3361 }
3362
3363 func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) {
3364 r1, _, e1 := syscall.Syscall(procSetupComm.Addr(), 3, uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue))
3365 if r1 == 0 {
3366 err = errnoErr(e1)
3367 }
3368 return
3369 }
3370
3371 func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) {
3372 r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0)
3373 size = uint32(r0)
3374 if size == 0 {
3375 err = errnoErr(e1)
3376 }
3377 return
3378 }
3379
3380 func SleepEx(milliseconds uint32, alertable bool) (ret uint32) {
3381 var _p0 uint32
3382 if alertable {
3383 _p0 = 1
3384 }
3385 r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0)
3386 ret = uint32(r0)
3387 return
3388 }
3389
3390 func TerminateJobObject(job Handle, exitCode uint32) (err error) {
3391 r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0)
3392 if r1 == 0 {
3393 err = errnoErr(e1)
3394 }
3395 return
3396 }
3397
3398 func TerminateProcess(handle Handle, exitcode uint32) (err error) {
3399 r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
3400 if r1 == 0 {
3401 err = errnoErr(e1)
3402 }
3403 return
3404 }
3405
3406 func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
3407 r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
3408 if r1 == 0 {
3409 err = errnoErr(e1)
3410 }
3411 return
3412 }
3413
3414 func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
3415 r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
3416 if r1 == 0 {
3417 err = errnoErr(e1)
3418 }
3419 return
3420 }
3421
3422 func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
3423 r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0)
3424 if r1 == 0 {
3425 err = errnoErr(e1)
3426 }
3427 return
3428 }
3429
3430 func UnmapViewOfFile(addr uintptr) (err error) {
3431 r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
3432 if r1 == 0 {
3433 err = errnoErr(e1)
3434 }
3435 return
3436 }
3437
3438 func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) {
3439 r1, _, e1 := syscall.Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0)
3440 if r1 == 0 {
3441 err = errnoErr(e1)
3442 }
3443 return
3444 }
3445
3446 func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) {
3447 r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0)
3448 value = uintptr(r0)
3449 if value == 0 {
3450 err = errnoErr(e1)
3451 }
3452 return
3453 }
3454
3455 func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) {
3456 r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype))
3457 if r1 == 0 {
3458 err = errnoErr(e1)
3459 }
3460 return
3461 }
3462
3463 func VirtualLock(addr uintptr, length uintptr) (err error) {
3464 r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
3465 if r1 == 0 {
3466 err = errnoErr(e1)
3467 }
3468 return
3469 }
3470
3471 func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) {
3472 r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0)
3473 if r1 == 0 {
3474 err = errnoErr(e1)
3475 }
3476 return
3477 }
3478
3479 func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) {
3480 r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0)
3481 if r1 == 0 {
3482 err = errnoErr(e1)
3483 }
3484 return
3485 }
3486
3487 func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
3488 r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length))
3489 if r1 == 0 {
3490 err = errnoErr(e1)
3491 }
3492 return
3493 }
3494
3495 func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
3496 r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0)
3497 if r1 == 0 {
3498 err = errnoErr(e1)
3499 }
3500 return
3501 }
3502
3503 func VirtualUnlock(addr uintptr, length uintptr) (err error) {
3504 r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
3505 if r1 == 0 {
3506 err = errnoErr(e1)
3507 }
3508 return
3509 }
3510
3511 func WTSGetActiveConsoleSessionId() (sessionID uint32) {
3512 r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0)
3513 sessionID = uint32(r0)
3514 return
3515 }
3516
3517 func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) {
3518 r1, _, e1 := syscall.Syscall(procWaitCommEvent.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped)))
3519 if r1 == 0 {
3520 err = errnoErr(e1)
3521 }
3522 return
3523 }
3524
3525 func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
3526 var _p0 uint32
3527 if waitAll {
3528 _p0 = 1
3529 }
3530 r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0)
3531 event = uint32(r0)
3532 if event == 0xffffffff {
3533 err = errnoErr(e1)
3534 }
3535 return
3536 }
3537
3538 func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) {
3539 r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0)
3540 event = uint32(r0)
3541 if event == 0xffffffff {
3542 err = errnoErr(e1)
3543 }
3544 return
3545 }
3546
3547 func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
3548 r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
3549 if r1 == 0 {
3550 err = errnoErr(e1)
3551 }
3552 return
3553 }
3554
3555 func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
3556 var _p0 *byte
3557 if len(buf) > 0 {
3558 _p0 = &buf[0]
3559 }
3560 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)
3561 if r1 == 0 {
3562 err = errnoErr(e1)
3563 }
3564 return
3565 }
3566
3567 func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) {
3568 r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0)
3569 if r1 == 0 {
3570 err = errnoErr(e1)
3571 }
3572 return
3573 }
3574
3575 func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
3576 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)
3577 if r1 == 0 {
3578 err = errnoErr(e1)
3579 }
3580 return
3581 }
3582
3583 func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) {
3584 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)
3585 return
3586 }
3587
3588 func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
3589 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)
3590 if r1 == 0 {
3591 err = errnoErr(e1)
3592 }
3593 return
3594 }
3595
3596 func NetApiBufferFree(buf *byte) (neterr error) {
3597 r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0)
3598 if r0 != 0 {
3599 neterr = syscall.Errno(r0)
3600 }
3601 return
3602 }
3603
3604 func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) {
3605 r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType)))
3606 if r0 != 0 {
3607 neterr = syscall.Errno(r0)
3608 }
3609 return
3610 }
3611
3612 func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) {
3613 r0, _, _ := syscall.Syscall9(procNetUserEnum.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle)), 0)
3614 if r0 != 0 {
3615 neterr = syscall.Errno(r0)
3616 }
3617 return
3618 }
3619
3620 func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
3621 r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
3622 if r0 != 0 {
3623 neterr = syscall.Errno(r0)
3624 }
3625 return
3626 }
3627
3628 func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) {
3629 r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0)
3630 if r0 != 0 {
3631 ntstatus = NTStatus(r0)
3632 }
3633 return
3634 }
3635
3636 func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) {
3637 r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0)
3638 if r0 != 0 {
3639 ntstatus = NTStatus(r0)
3640 }
3641 return
3642 }
3643
3644 func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) {
3645 r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0)
3646 if r0 != 0 {
3647 ntstatus = NTStatus(r0)
3648 }
3649 return
3650 }
3651
3652 func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) {
3653 r0, _, _ := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen)), 0, 0)
3654 if r0 != 0 {
3655 ntstatus = NTStatus(r0)
3656 }
3657 return
3658 }
3659
3660 func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) {
3661 r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0)
3662 if r0 != 0 {
3663 ntstatus = NTStatus(r0)
3664 }
3665 return
3666 }
3667
3668 func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) {
3669 r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0)
3670 if r0 != 0 {
3671 ntstatus = NTStatus(r0)
3672 }
3673 return
3674 }
3675
3676 func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32) (ntstatus error) {
3677 r0, _, _ := syscall.Syscall(procNtSetSystemInformation.Addr(), 3, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen))
3678 if r0 != 0 {
3679 ntstatus = NTStatus(r0)
3680 }
3681 return
3682 }
3683
3684 func RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) {
3685 r0, _, _ := syscall.Syscall(procRtlAddFunctionTable.Addr(), 3, uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress))
3686 ret = r0 != 0
3687 return
3688 }
3689
3690 func RtlDefaultNpAcl(acl **ACL) (ntstatus error) {
3691 r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(acl)), 0, 0)
3692 if r0 != 0 {
3693 ntstatus = NTStatus(r0)
3694 }
3695 return
3696 }
3697
3698 func RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) {
3699 r0, _, _ := syscall.Syscall(procRtlDeleteFunctionTable.Addr(), 1, uintptr(unsafe.Pointer(functionTable)), 0, 0)
3700 ret = r0 != 0
3701 return
3702 }
3703
3704 func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) {
3705 r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0)
3706 if r0 != 0 {
3707 ntstatus = NTStatus(r0)
3708 }
3709 return
3710 }
3711
3712 func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) {
3713 r0, _, _ := syscall.Syscall6(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0)
3714 if r0 != 0 {
3715 ntstatus = NTStatus(r0)
3716 }
3717 return
3718 }
3719
3720 func RtlGetCurrentPeb() (peb *PEB) {
3721 r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0)
3722 peb = (*PEB)(unsafe.Pointer(r0))
3723 return
3724 }
3725
3726 func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) {
3727 syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber)))
3728 return
3729 }
3730
3731 func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) {
3732 r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0)
3733 if r0 != 0 {
3734 ntstatus = NTStatus(r0)
3735 }
3736 return
3737 }
3738
3739 func RtlInitString(destinationString *NTString, sourceString *byte) {
3740 syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0)
3741 return
3742 }
3743
3744 func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) {
3745 syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0)
3746 return
3747 }
3748
3749 func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) {
3750 r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0)
3751 ret = syscall.Errno(r0)
3752 return
3753 }
3754
3755 func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) {
3756 r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
3757 if r0 != 0 {
3758 ret = syscall.Errno(r0)
3759 }
3760 return
3761 }
3762
3763 func coCreateGuid(pguid *GUID) (ret error) {
3764 r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0)
3765 if r0 != 0 {
3766 ret = syscall.Errno(r0)
3767 }
3768 return
3769 }
3770
3771 func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) {
3772 r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0)
3773 if r0 != 0 {
3774 ret = syscall.Errno(r0)
3775 }
3776 return
3777 }
3778
3779 func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) {
3780 r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0)
3781 if r0 != 0 {
3782 ret = syscall.Errno(r0)
3783 }
3784 return
3785 }
3786
3787 func CoTaskMemFree(address unsafe.Pointer) {
3788 syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0)
3789 return
3790 }
3791
3792 func CoUninitialize() {
3793 syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0)
3794 return
3795 }
3796
3797 func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) {
3798 r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax))
3799 chars = int32(r0)
3800 return
3801 }
3802
3803 func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) {
3804 r1, _, e1 := syscall.Syscall6(procEnumProcessModules.Addr(), 4, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), 0, 0)
3805 if r1 == 0 {
3806 err = errnoErr(e1)
3807 }
3808 return
3809 }
3810
3811 func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) {
3812 r1, _, e1 := syscall.Syscall6(procEnumProcessModulesEx.Addr(), 5, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag), 0)
3813 if r1 == 0 {
3814 err = errnoErr(e1)
3815 }
3816 return
3817 }
3818
3819 func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) {
3820 r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned)))
3821 if r1 == 0 {
3822 err = errnoErr(e1)
3823 }
3824 return
3825 }
3826
3827 func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) {
3828 r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0)
3829 if r1 == 0 {
3830 err = errnoErr(e1)
3831 }
3832 return
3833 }
3834
3835 func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) {
3836 r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0)
3837 if r1 == 0 {
3838 err = errnoErr(e1)
3839 }
3840 return
3841 }
3842
3843 func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) {
3844 r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0)
3845 if r1 == 0 {
3846 err = errnoErr(e1)
3847 }
3848 return
3849 }
3850
3851 func QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) {
3852 r1, _, e1 := syscall.Syscall(procQueryWorkingSetEx.Addr(), 3, uintptr(process), uintptr(pv), uintptr(cb))
3853 if r1 == 0 {
3854 err = errnoErr(e1)
3855 }
3856 return
3857 }
3858
3859 func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) {
3860 ret = procSubscribeServiceChangeNotifications.Find()
3861 if ret != nil {
3862 return
3863 }
3864 r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0)
3865 if r0 != 0 {
3866 ret = syscall.Errno(r0)
3867 }
3868 return
3869 }
3870
3871 func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) {
3872 err = procUnsubscribeServiceChangeNotifications.Find()
3873 if err != nil {
3874 return
3875 }
3876 syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0)
3877 return
3878 }
3879
3880 func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
3881 r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
3882 if r1&0xff == 0 {
3883 err = errnoErr(e1)
3884 }
3885 return
3886 }
3887
3888 func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
3889 r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
3890 if r1&0xff == 0 {
3891 err = errnoErr(e1)
3892 }
3893 return
3894 }
3895
3896 func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) {
3897 r1, _, e1 := syscall.Syscall(procSetupDiBuildDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType))
3898 if r1 == 0 {
3899 err = errnoErr(e1)
3900 }
3901 return
3902 }
3903
3904 func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) {
3905 r1, _, e1 := syscall.Syscall(procSetupDiCallClassInstaller.Addr(), 3, uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)))
3906 if r1 == 0 {
3907 err = errnoErr(e1)
3908 }
3909 return
3910 }
3911
3912 func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) {
3913 r1, _, e1 := syscall.Syscall(procSetupDiCancelDriverInfoSearch.Addr(), 1, uintptr(deviceInfoSet), 0, 0)
3914 if r1 == 0 {
3915 err = errnoErr(e1)
3916 }
3917 return
3918 }
3919
3920 func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) {
3921 r1, _, e1 := syscall.Syscall6(procSetupDiClassGuidsFromNameExW.Addr(), 6, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved))
3922 if r1 == 0 {
3923 err = errnoErr(e1)
3924 }
3925 return
3926 }
3927
3928 func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) {
3929 r1, _, e1 := syscall.Syscall6(procSetupDiClassNameFromGuidExW.Addr(), 6, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved))
3930 if r1 == 0 {
3931 err = errnoErr(e1)
3932 }
3933 return
3934 }
3935
3936 func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) {
3937 r0, _, e1 := syscall.Syscall6(procSetupDiCreateDeviceInfoListExW.Addr(), 4, uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0)
3938 handle = DevInfo(r0)
3939 if handle == DevInfo(InvalidHandle) {
3940 err = errnoErr(e1)
3941 }
3942 return
3943 }
3944
3945 func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) {
3946 r1, _, e1 := syscall.Syscall9(procSetupDiCreateDeviceInfoW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData)), 0, 0)
3947 if r1 == 0 {
3948 err = errnoErr(e1)
3949 }
3950 return
3951 }
3952
3953 func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) {
3954 r1, _, e1 := syscall.Syscall(procSetupDiDestroyDeviceInfoList.Addr(), 1, uintptr(deviceInfoSet), 0, 0)
3955 if r1 == 0 {
3956 err = errnoErr(e1)
3957 }
3958 return
3959 }
3960
3961 func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) {
3962 r1, _, e1 := syscall.Syscall(procSetupDiDestroyDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType))
3963 if r1 == 0 {
3964 err = errnoErr(e1)
3965 }
3966 return
3967 }
3968
3969 func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) {
3970 r1, _, e1 := syscall.Syscall(procSetupDiEnumDeviceInfo.Addr(), 3, uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData)))
3971 if r1 == 0 {
3972 err = errnoErr(e1)
3973 }
3974 return
3975 }
3976
3977 func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) {
3978 r1, _, e1 := syscall.Syscall6(procSetupDiEnumDriverInfoW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData)), 0)
3979 if r1 == 0 {
3980 err = errnoErr(e1)
3981 }
3982 return
3983 }
3984
3985 func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) {
3986 r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0)
3987 handle = DevInfo(r0)
3988 if handle == DevInfo(InvalidHandle) {
3989 err = errnoErr(e1)
3990 }
3991 return
3992 }
3993
3994 func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) {
3995 r1, _, e1 := syscall.Syscall6(procSetupDiGetClassInstallParamsW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize)), 0)
3996 if r1 == 0 {
3997 err = errnoErr(e1)
3998 }
3999 return
4000 }
4001
4002 func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) {
4003 r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInfoListDetailW.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData)), 0)
4004 if r1 == 0 {
4005 err = errnoErr(e1)
4006 }
4007 return
4008 }
4009
4010 func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) {
4011 r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams)))
4012 if r1 == 0 {
4013 err = errnoErr(e1)
4014 }
4015 return
4016 }
4017
4018 func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) {
4019 r1, _, e1 := syscall.Syscall6(procSetupDiGetDeviceInstanceIdW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize)), 0)
4020 if r1 == 0 {
4021 err = errnoErr(e1)
4022 }
4023 return
4024 }
4025
4026 func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) {
4027 r1, _, e1 := syscall.Syscall9(procSetupDiGetDevicePropertyW.Addr(), 8, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags), 0)
4028 if r1 == 0 {
4029 err = errnoErr(e1)
4030 }
4031 return
4032 }
4033
4034 func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) {
4035 r1, _, e1 := syscall.Syscall9(procSetupDiGetDeviceRegistryPropertyW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), 0, 0)
4036 if r1 == 0 {
4037 err = errnoErr(e1)
4038 }
4039 return
4040 }
4041
4042 func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) {
4043 r1, _, e1 := syscall.Syscall6(procSetupDiGetDriverInfoDetailW.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize)))
4044 if r1 == 0 {
4045 err = errnoErr(e1)
4046 }
4047 return
4048 }
4049
4050 func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) {
4051 r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0)
4052 if r1 == 0 {
4053 err = errnoErr(e1)
4054 }
4055 return
4056 }
4057
4058 func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) {
4059 r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)))
4060 if r1 == 0 {
4061 err = errnoErr(e1)
4062 }
4063 return
4064 }
4065
4066 func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) {
4067 r0, _, e1 := syscall.Syscall6(procSetupDiOpenDevRegKey.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired))
4068 key = Handle(r0)
4069 if key == InvalidHandle {
4070 err = errnoErr(e1)
4071 }
4072 return
4073 }
4074
4075 func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) {
4076 r1, _, e1 := syscall.Syscall6(procSetupDiSetClassInstallParamsW.Addr(), 4, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), 0, 0)
4077 if r1 == 0 {
4078 err = errnoErr(e1)
4079 }
4080 return
4081 }
4082
4083 func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) {
4084 r1, _, e1 := syscall.Syscall(procSetupDiSetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams)))
4085 if r1 == 0 {
4086 err = errnoErr(e1)
4087 }
4088 return
4089 }
4090
4091 func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) {
4092 r1, _, e1 := syscall.Syscall6(procSetupDiSetDeviceRegistryPropertyW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), 0)
4093 if r1 == 0 {
4094 err = errnoErr(e1)
4095 }
4096 return
4097 }
4098
4099 func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) {
4100 r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0)
4101 if r1 == 0 {
4102 err = errnoErr(e1)
4103 }
4104 return
4105 }
4106
4107 func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) {
4108 r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)))
4109 if r1 == 0 {
4110 err = errnoErr(e1)
4111 }
4112 return
4113 }
4114
4115 func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) {
4116 r1, _, e1 := syscall.Syscall(procSetupUninstallOEMInfW.Addr(), 3, uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved))
4117 if r1 == 0 {
4118 err = errnoErr(e1)
4119 }
4120 return
4121 }
4122
4123 func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) {
4124 r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0)
4125 argv = (**uint16)(unsafe.Pointer(r0))
4126 if argv == nil {
4127 err = errnoErr(e1)
4128 }
4129 return
4130 }
4131
4132 func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) {
4133 r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0)
4134 if r0 != 0 {
4135 ret = syscall.Errno(r0)
4136 }
4137 return
4138 }
4139
4140 func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) {
4141 r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd))
4142 if r1 <= 32 {
4143 err = errnoErr(e1)
4144 }
4145 return
4146 }
4147
4148 func EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) {
4149 syscall.Syscall(procEnumChildWindows.Addr(), 3, uintptr(hwnd), uintptr(enumFunc), uintptr(param))
4150 return
4151 }
4152
4153 func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) {
4154 r1, _, e1 := syscall.Syscall(procEnumWindows.Addr(), 2, uintptr(enumFunc), uintptr(param), 0)
4155 if r1 == 0 {
4156 err = errnoErr(e1)
4157 }
4158 return
4159 }
4160
4161 func ExitWindowsEx(flags uint32, reason uint32) (err error) {
4162 r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
4163 if r1 == 0 {
4164 err = errnoErr(e1)
4165 }
4166 return
4167 }
4168
4169 func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) {
4170 r0, _, e1 := syscall.Syscall(procGetClassNameW.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount))
4171 copied = int32(r0)
4172 if copied == 0 {
4173 err = errnoErr(e1)
4174 }
4175 return
4176 }
4177
4178 func GetDesktopWindow() (hwnd HWND) {
4179 r0, _, _ := syscall.Syscall(procGetDesktopWindow.Addr(), 0, 0, 0, 0)
4180 hwnd = HWND(r0)
4181 return
4182 }
4183
4184 func GetForegroundWindow() (hwnd HWND) {
4185 r0, _, _ := syscall.Syscall(procGetForegroundWindow.Addr(), 0, 0, 0, 0)
4186 hwnd = HWND(r0)
4187 return
4188 }
4189
4190 func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) {
4191 r1, _, e1 := syscall.Syscall(procGetGUIThreadInfo.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(info)), 0)
4192 if r1 == 0 {
4193 err = errnoErr(e1)
4194 }
4195 return
4196 }
4197
4198 func GetKeyboardLayout(tid uint32) (hkl Handle) {
4199 r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0)
4200 hkl = Handle(r0)
4201 return
4202 }
4203
4204 func GetShellWindow() (shellWindow HWND) {
4205 r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0)
4206 shellWindow = HWND(r0)
4207 return
4208 }
4209
4210 func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) {
4211 r0, _, e1 := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(pid)), 0)
4212 tid = uint32(r0)
4213 if tid == 0 {
4214 err = errnoErr(e1)
4215 }
4216 return
4217 }
4218
4219 func IsWindow(hwnd HWND) (isWindow bool) {
4220 r0, _, _ := syscall.Syscall(procIsWindow.Addr(), 1, uintptr(hwnd), 0, 0)
4221 isWindow = r0 != 0
4222 return
4223 }
4224
4225 func IsWindowUnicode(hwnd HWND) (isUnicode bool) {
4226 r0, _, _ := syscall.Syscall(procIsWindowUnicode.Addr(), 1, uintptr(hwnd), 0, 0)
4227 isUnicode = r0 != 0
4228 return
4229 }
4230
4231 func IsWindowVisible(hwnd HWND) (isVisible bool) {
4232 r0, _, _ := syscall.Syscall(procIsWindowVisible.Addr(), 1, uintptr(hwnd), 0, 0)
4233 isVisible = r0 != 0
4234 return
4235 }
4236
4237 func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) {
4238 r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0)
4239 hkl = Handle(r0)
4240 if hkl == 0 {
4241 err = errnoErr(e1)
4242 }
4243 return
4244 }
4245
4246 func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
4247 r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
4248 ret = int32(r0)
4249 if ret == 0 {
4250 err = errnoErr(e1)
4251 }
4252 return
4253 }
4254
4255 func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) {
4256 r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0)
4257 ret = int32(r0)
4258 return
4259 }
4260
4261 func UnloadKeyboardLayout(hkl Handle) (err error) {
4262 r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0)
4263 if r1 == 0 {
4264 err = errnoErr(e1)
4265 }
4266 return
4267 }
4268
4269 func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) {
4270 var _p0 uint32
4271 if inheritExisting {
4272 _p0 = 1
4273 }
4274 r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
4275 if r1 == 0 {
4276 err = errnoErr(e1)
4277 }
4278 return
4279 }
4280
4281 func DestroyEnvironmentBlock(block *uint16) (err error) {
4282 r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
4283 if r1 == 0 {
4284 err = errnoErr(e1)
4285 }
4286 return
4287 }
4288
4289 func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
4290 r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
4291 if r1 == 0 {
4292 err = errnoErr(e1)
4293 }
4294 return
4295 }
4296
4297 func GetFileVersionInfoSize(filename string, zeroHandle *Handle) (bufSize uint32, err error) {
4298 var _p0 *uint16
4299 _p0, err = syscall.UTF16PtrFromString(filename)
4300 if err != nil {
4301 return
4302 }
4303 return _GetFileVersionInfoSize(_p0, zeroHandle)
4304 }
4305
4306 func _GetFileVersionInfoSize(filename *uint16, zeroHandle *Handle) (bufSize uint32, err error) {
4307 r0, _, e1 := syscall.Syscall(procGetFileVersionInfoSizeW.Addr(), 2, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle)), 0)
4308 bufSize = uint32(r0)
4309 if bufSize == 0 {
4310 err = errnoErr(e1)
4311 }
4312 return
4313 }
4314
4315 func GetFileVersionInfo(filename string, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) {
4316 var _p0 *uint16
4317 _p0, err = syscall.UTF16PtrFromString(filename)
4318 if err != nil {
4319 return
4320 }
4321 return _GetFileVersionInfo(_p0, handle, bufSize, buffer)
4322 }
4323
4324 func _GetFileVersionInfo(filename *uint16, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) {
4325 r1, _, e1 := syscall.Syscall6(procGetFileVersionInfoW.Addr(), 4, uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer), 0, 0)
4326 if r1 == 0 {
4327 err = errnoErr(e1)
4328 }
4329 return
4330 }
4331
4332 func VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) {
4333 var _p0 *uint16
4334 _p0, err = syscall.UTF16PtrFromString(subBlock)
4335 if err != nil {
4336 return
4337 }
4338 return _VerQueryValue(block, _p0, pointerToBufferPointer, bufSize)
4339 }
4340
4341 func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) {
4342 r1, _, e1 := syscall.Syscall6(procVerQueryValueW.Addr(), 4, uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize)), 0, 0)
4343 if r1 == 0 {
4344 err = errnoErr(e1)
4345 }
4346 return
4347 }
4348
4349 func TimeBeginPeriod(period uint32) (err error) {
4350 r1, _, e1 := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0)
4351 if r1 != 0 {
4352 err = errnoErr(e1)
4353 }
4354 return
4355 }
4356
4357 func TimeEndPeriod(period uint32) (err error) {
4358 r1, _, e1 := syscall.Syscall(proctimeEndPeriod.Addr(), 1, uintptr(period), 0, 0)
4359 if r1 != 0 {
4360 err = errnoErr(e1)
4361 }
4362 return
4363 }
4364
4365 func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) {
4366 r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data)))
4367 if r0 != 0 {
4368 ret = syscall.Errno(r0)
4369 }
4370 return
4371 }
4372
4373 func FreeAddrInfoW(addrinfo *AddrinfoW) {
4374 syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
4375 return
4376 }
4377
4378 func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) {
4379 r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0)
4380 if r0 != 0 {
4381 sockerr = syscall.Errno(r0)
4382 }
4383 return
4384 }
4385
4386 func WSACleanup() (err error) {
4387 r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
4388 if r1 == socket_error {
4389 err = errnoErr(e1)
4390 }
4391 return
4392 }
4393
4394 func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) {
4395 r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength)))
4396 n = int32(r0)
4397 if n == -1 {
4398 err = errnoErr(e1)
4399 }
4400 return
4401 }
4402
4403 func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) {
4404 var _p0 uint32
4405 if wait {
4406 _p0 = 1
4407 }
4408 r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0)
4409 if r1 == 0 {
4410 err = errnoErr(e1)
4411 }
4412 return
4413 }
4414
4415 func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
4416 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))
4417 if r1 == socket_error {
4418 err = errnoErr(e1)
4419 }
4420 return
4421 }
4422
4423 func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) {
4424 r1, _, e1 := syscall.Syscall(procWSALookupServiceBeginW.Addr(), 3, uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle)))
4425 if r1 == socket_error {
4426 err = errnoErr(e1)
4427 }
4428 return
4429 }
4430
4431 func WSALookupServiceEnd(handle Handle) (err error) {
4432 r1, _, e1 := syscall.Syscall(procWSALookupServiceEnd.Addr(), 1, uintptr(handle), 0, 0)
4433 if r1 == socket_error {
4434 err = errnoErr(e1)
4435 }
4436 return
4437 }
4438
4439 func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) {
4440 r1, _, e1 := syscall.Syscall6(procWSALookupServiceNextW.Addr(), 4, uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet)), 0, 0)
4441 if r1 == socket_error {
4442 err = errnoErr(e1)
4443 }
4444 return
4445 }
4446
4447 func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
4448 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)
4449 if r1 == socket_error {
4450 err = errnoErr(e1)
4451 }
4452 return
4453 }
4454
4455 func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
4456 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)))
4457 if r1 == socket_error {
4458 err = errnoErr(e1)
4459 }
4460 return
4461 }
4462
4463 func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
4464 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)
4465 if r1 == socket_error {
4466 err = errnoErr(e1)
4467 }
4468 return
4469 }
4470
4471 func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
4472 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)))
4473 if r1 == socket_error {
4474 err = errnoErr(e1)
4475 }
4476 return
4477 }
4478
4479 func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) {
4480 r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags))
4481 handle = Handle(r0)
4482 if handle == InvalidHandle {
4483 err = errnoErr(e1)
4484 }
4485 return
4486 }
4487
4488 func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
4489 r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
4490 if r0 != 0 {
4491 sockerr = syscall.Errno(r0)
4492 }
4493 return
4494 }
4495
4496 func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
4497 r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
4498 if r1 == socket_error {
4499 err = errnoErr(e1)
4500 }
4501 return
4502 }
4503
4504 func Closesocket(s Handle) (err error) {
4505 r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
4506 if r1 == socket_error {
4507 err = errnoErr(e1)
4508 }
4509 return
4510 }
4511
4512 func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
4513 r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
4514 if r1 == socket_error {
4515 err = errnoErr(e1)
4516 }
4517 return
4518 }
4519
4520 func GetHostByName(name string) (h *Hostent, err error) {
4521 var _p0 *byte
4522 _p0, err = syscall.BytePtrFromString(name)
4523 if err != nil {
4524 return
4525 }
4526 return _GetHostByName(_p0)
4527 }
4528
4529 func _GetHostByName(name *byte) (h *Hostent, err error) {
4530 r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
4531 h = (*Hostent)(unsafe.Pointer(r0))
4532 if h == nil {
4533 err = errnoErr(e1)
4534 }
4535 return
4536 }
4537
4538 func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
4539 r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
4540 if r1 == socket_error {
4541 err = errnoErr(e1)
4542 }
4543 return
4544 }
4545
4546 func GetProtoByName(name string) (p *Protoent, err error) {
4547 var _p0 *byte
4548 _p0, err = syscall.BytePtrFromString(name)
4549 if err != nil {
4550 return
4551 }
4552 return _GetProtoByName(_p0)
4553 }
4554
4555 func _GetProtoByName(name *byte) (p *Protoent, err error) {
4556 r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
4557 p = (*Protoent)(unsafe.Pointer(r0))
4558 if p == nil {
4559 err = errnoErr(e1)
4560 }
4561 return
4562 }
4563
4564 func GetServByName(name string, proto string) (s *Servent, err error) {
4565 var _p0 *byte
4566 _p0, err = syscall.BytePtrFromString(name)
4567 if err != nil {
4568 return
4569 }
4570 var _p1 *byte
4571 _p1, err = syscall.BytePtrFromString(proto)
4572 if err != nil {
4573 return
4574 }
4575 return _GetServByName(_p0, _p1)
4576 }
4577
4578 func _GetServByName(name *byte, proto *byte) (s *Servent, err error) {
4579 r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0)
4580 s = (*Servent)(unsafe.Pointer(r0))
4581 if s == nil {
4582 err = errnoErr(e1)
4583 }
4584 return
4585 }
4586
4587 func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
4588 r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
4589 if r1 == socket_error {
4590 err = errnoErr(e1)
4591 }
4592 return
4593 }
4594
4595 func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
4596 r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
4597 if r1 == socket_error {
4598 err = errnoErr(e1)
4599 }
4600 return
4601 }
4602
4603 func listen(s Handle, backlog int32) (err error) {
4604 r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
4605 if r1 == socket_error {
4606 err = errnoErr(e1)
4607 }
4608 return
4609 }
4610
4611 func Ntohs(netshort uint16) (u uint16) {
4612 r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0)
4613 u = uint16(r0)
4614 return
4615 }
4616
4617 func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) {
4618 var _p0 *byte
4619 if len(buf) > 0 {
4620 _p0 = &buf[0]
4621 }
4622 r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
4623 n = int32(r0)
4624 if n == -1 {
4625 err = errnoErr(e1)
4626 }
4627 return
4628 }
4629
4630 func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) {
4631 var _p0 *byte
4632 if len(buf) > 0 {
4633 _p0 = &buf[0]
4634 }
4635 r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen))
4636 if r1 == socket_error {
4637 err = errnoErr(e1)
4638 }
4639 return
4640 }
4641
4642 func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
4643 r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
4644 if r1 == socket_error {
4645 err = errnoErr(e1)
4646 }
4647 return
4648 }
4649
4650 func shutdown(s Handle, how int32) (err error) {
4651 r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
4652 if r1 == socket_error {
4653 err = errnoErr(e1)
4654 }
4655 return
4656 }
4657
4658 func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
4659 r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol))
4660 handle = Handle(r0)
4661 if handle == InvalidHandle {
4662 err = errnoErr(e1)
4663 }
4664 return
4665 }
4666
4667 func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) {
4668 r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0)
4669 if r1 == 0 {
4670 err = errnoErr(e1)
4671 }
4672 return
4673 }
4674
4675 func WTSFreeMemory(ptr uintptr) {
4676 syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0)
4677 return
4678 }
4679
4680 func WTSQueryUserToken(session uint32, token *Token) (err error) {
4681 r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0)
4682 if r1 == 0 {
4683 err = errnoErr(e1)
4684 }
4685 return
4686 }
4687
View as plain text