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