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