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