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