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