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