1// Code generated by 'go generate'; DO NOT EDIT.
2
3package windows
4
5import (
6	"syscall"
7	"unsafe"
8)
9
10var _ unsafe.Pointer
11
12// Do the interface allocations only once for common
13// Errno values.
14const (
15	errnoERROR_IO_PENDING = 997
16)
17
18var (
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.
25func 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
38var (
39	modadvapi32 = NewLazySystemDLL("advapi32.dll")
40	modcrypt32  = NewLazySystemDLL("crypt32.dll")
41	moddnsapi   = NewLazySystemDLL("dnsapi.dll")
42	modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
43	modkernel32 = NewLazySystemDLL("kernel32.dll")
44	modmswsock  = NewLazySystemDLL("mswsock.dll")
45	modnetapi32 = NewLazySystemDLL("netapi32.dll")
46	modntdll    = NewLazySystemDLL("ntdll.dll")
47	modole32    = NewLazySystemDLL("ole32.dll")
48	modpsapi    = NewLazySystemDLL("psapi.dll")
49	modsechost  = NewLazySystemDLL("sechost.dll")
50	modsecur32  = NewLazySystemDLL("secur32.dll")
51	modshell32  = NewLazySystemDLL("shell32.dll")
52	moduser32   = NewLazySystemDLL("user32.dll")
53	moduserenv  = NewLazySystemDLL("userenv.dll")
54	modws2_32   = NewLazySystemDLL("ws2_32.dll")
55	modwtsapi32 = NewLazySystemDLL("wtsapi32.dll")
56
57	procAdjustTokenGroups                                    = modadvapi32.NewProc("AdjustTokenGroups")
58	procAdjustTokenPrivileges                                = modadvapi32.NewProc("AdjustTokenPrivileges")
59	procAllocateAndInitializeSid                             = modadvapi32.NewProc("AllocateAndInitializeSid")
60	procBuildSecurityDescriptorW                             = modadvapi32.NewProc("BuildSecurityDescriptorW")
61	procChangeServiceConfig2W                                = modadvapi32.NewProc("ChangeServiceConfig2W")
62	procChangeServiceConfigW                                 = modadvapi32.NewProc("ChangeServiceConfigW")
63	procCheckTokenMembership                                 = modadvapi32.NewProc("CheckTokenMembership")
64	procCloseServiceHandle                                   = modadvapi32.NewProc("CloseServiceHandle")
65	procControlService                                       = modadvapi32.NewProc("ControlService")
66	procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
67	procConvertSidToStringSidW                               = modadvapi32.NewProc("ConvertSidToStringSidW")
68	procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
69	procConvertStringSidToSidW                               = modadvapi32.NewProc("ConvertStringSidToSidW")
70	procCopySid                                              = modadvapi32.NewProc("CopySid")
71	procCreateServiceW                                       = modadvapi32.NewProc("CreateServiceW")
72	procCreateWellKnownSid                                   = modadvapi32.NewProc("CreateWellKnownSid")
73	procCryptAcquireContextW                                 = modadvapi32.NewProc("CryptAcquireContextW")
74	procCryptGenRandom                                       = modadvapi32.NewProc("CryptGenRandom")
75	procCryptReleaseContext                                  = modadvapi32.NewProc("CryptReleaseContext")
76	procDeleteService                                        = modadvapi32.NewProc("DeleteService")
77	procDeregisterEventSource                                = modadvapi32.NewProc("DeregisterEventSource")
78	procDuplicateTokenEx                                     = modadvapi32.NewProc("DuplicateTokenEx")
79	procEnumServicesStatusExW                                = modadvapi32.NewProc("EnumServicesStatusExW")
80	procEqualSid                                             = modadvapi32.NewProc("EqualSid")
81	procFreeSid                                              = modadvapi32.NewProc("FreeSid")
82	procGetLengthSid                                         = modadvapi32.NewProc("GetLengthSid")
83	procGetNamedSecurityInfoW                                = modadvapi32.NewProc("GetNamedSecurityInfoW")
84	procGetSecurityDescriptorControl                         = modadvapi32.NewProc("GetSecurityDescriptorControl")
85	procGetSecurityDescriptorDacl                            = modadvapi32.NewProc("GetSecurityDescriptorDacl")
86	procGetSecurityDescriptorGroup                           = modadvapi32.NewProc("GetSecurityDescriptorGroup")
87	procGetSecurityDescriptorLength                          = modadvapi32.NewProc("GetSecurityDescriptorLength")
88	procGetSecurityDescriptorOwner                           = modadvapi32.NewProc("GetSecurityDescriptorOwner")
89	procGetSecurityDescriptorRMControl                       = modadvapi32.NewProc("GetSecurityDescriptorRMControl")
90	procGetSecurityDescriptorSacl                            = modadvapi32.NewProc("GetSecurityDescriptorSacl")
91	procGetSecurityInfo                                      = modadvapi32.NewProc("GetSecurityInfo")
92	procGetSidIdentifierAuthority                            = modadvapi32.NewProc("GetSidIdentifierAuthority")
93	procGetSidSubAuthority                                   = modadvapi32.NewProc("GetSidSubAuthority")
94	procGetSidSubAuthorityCount                              = modadvapi32.NewProc("GetSidSubAuthorityCount")
95	procGetTokenInformation                                  = modadvapi32.NewProc("GetTokenInformation")
96	procImpersonateSelf                                      = modadvapi32.NewProc("ImpersonateSelf")
97	procInitializeSecurityDescriptor                         = modadvapi32.NewProc("InitializeSecurityDescriptor")
98	procInitiateSystemShutdownExW                            = modadvapi32.NewProc("InitiateSystemShutdownExW")
99	procIsTokenRestricted                                    = modadvapi32.NewProc("IsTokenRestricted")
100	procIsValidSecurityDescriptor                            = modadvapi32.NewProc("IsValidSecurityDescriptor")
101	procIsValidSid                                           = modadvapi32.NewProc("IsValidSid")
102	procIsWellKnownSid                                       = modadvapi32.NewProc("IsWellKnownSid")
103	procLookupAccountNameW                                   = modadvapi32.NewProc("LookupAccountNameW")
104	procLookupAccountSidW                                    = modadvapi32.NewProc("LookupAccountSidW")
105	procLookupPrivilegeValueW                                = modadvapi32.NewProc("LookupPrivilegeValueW")
106	procMakeAbsoluteSD                                       = modadvapi32.NewProc("MakeAbsoluteSD")
107	procMakeSelfRelativeSD                                   = modadvapi32.NewProc("MakeSelfRelativeSD")
108	procNotifyServiceStatusChangeW                           = modadvapi32.NewProc("NotifyServiceStatusChangeW")
109	procOpenProcessToken                                     = modadvapi32.NewProc("OpenProcessToken")
110	procOpenSCManagerW                                       = modadvapi32.NewProc("OpenSCManagerW")
111	procOpenServiceW                                         = modadvapi32.NewProc("OpenServiceW")
112	procOpenThreadToken                                      = modadvapi32.NewProc("OpenThreadToken")
113	procQueryServiceConfig2W                                 = modadvapi32.NewProc("QueryServiceConfig2W")
114	procQueryServiceConfigW                                  = modadvapi32.NewProc("QueryServiceConfigW")
115	procQueryServiceLockStatusW                              = modadvapi32.NewProc("QueryServiceLockStatusW")
116	procQueryServiceStatus                                   = modadvapi32.NewProc("QueryServiceStatus")
117	procQueryServiceStatusEx                                 = modadvapi32.NewProc("QueryServiceStatusEx")
118	procRegCloseKey                                          = modadvapi32.NewProc("RegCloseKey")
119	procRegEnumKeyExW                                        = modadvapi32.NewProc("RegEnumKeyExW")
120	procRegNotifyChangeKeyValue                              = modadvapi32.NewProc("RegNotifyChangeKeyValue")
121	procRegOpenKeyExW                                        = modadvapi32.NewProc("RegOpenKeyExW")
122	procRegQueryInfoKeyW                                     = modadvapi32.NewProc("RegQueryInfoKeyW")
123	procRegQueryValueExW                                     = modadvapi32.NewProc("RegQueryValueExW")
124	procRegisterEventSourceW                                 = modadvapi32.NewProc("RegisterEventSourceW")
125	procReportEventW                                         = modadvapi32.NewProc("ReportEventW")
126	procRevertToSelf                                         = modadvapi32.NewProc("RevertToSelf")
127	procSetEntriesInAclW                                     = modadvapi32.NewProc("SetEntriesInAclW")
128	procSetKernelObjectSecurity                              = modadvapi32.NewProc("SetKernelObjectSecurity")
129	procSetNamedSecurityInfoW                                = modadvapi32.NewProc("SetNamedSecurityInfoW")
130	procSetSecurityDescriptorControl                         = modadvapi32.NewProc("SetSecurityDescriptorControl")
131	procSetSecurityDescriptorDacl                            = modadvapi32.NewProc("SetSecurityDescriptorDacl")
132	procSetSecurityDescriptorGroup                           = modadvapi32.NewProc("SetSecurityDescriptorGroup")
133	procSetSecurityDescriptorOwner                           = modadvapi32.NewProc("SetSecurityDescriptorOwner")
134	procSetSecurityDescriptorRMControl                       = modadvapi32.NewProc("SetSecurityDescriptorRMControl")
135	procSetSecurityDescriptorSacl                            = modadvapi32.NewProc("SetSecurityDescriptorSacl")
136	procSetSecurityInfo                                      = modadvapi32.NewProc("SetSecurityInfo")
137	procSetServiceStatus                                     = modadvapi32.NewProc("SetServiceStatus")
138	procSetThreadToken                                       = modadvapi32.NewProc("SetThreadToken")
139	procSetTokenInformation                                  = modadvapi32.NewProc("SetTokenInformation")
140	procStartServiceCtrlDispatcherW                          = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
141	procStartServiceW                                        = modadvapi32.NewProc("StartServiceW")
142	procCertAddCertificateContextToStore                     = modcrypt32.NewProc("CertAddCertificateContextToStore")
143	procCertCloseStore                                       = modcrypt32.NewProc("CertCloseStore")
144	procCertCreateCertificateContext                         = modcrypt32.NewProc("CertCreateCertificateContext")
145	procCertDeleteCertificateFromStore                       = modcrypt32.NewProc("CertDeleteCertificateFromStore")
146	procCertDuplicateCertificateContext                      = modcrypt32.NewProc("CertDuplicateCertificateContext")
147	procCertEnumCertificatesInStore                          = modcrypt32.NewProc("CertEnumCertificatesInStore")
148	procCertFreeCertificateChain                             = modcrypt32.NewProc("CertFreeCertificateChain")
149	procCertFreeCertificateContext                           = modcrypt32.NewProc("CertFreeCertificateContext")
150	procCertGetCertificateChain                              = modcrypt32.NewProc("CertGetCertificateChain")
151	procCertOpenStore                                        = modcrypt32.NewProc("CertOpenStore")
152	procCertOpenSystemStoreW                                 = modcrypt32.NewProc("CertOpenSystemStoreW")
153	procCertVerifyCertificateChainPolicy                     = modcrypt32.NewProc("CertVerifyCertificateChainPolicy")
154	procPFXImportCertStore                                   = modcrypt32.NewProc("PFXImportCertStore")
155	procDnsNameCompare_W                                     = moddnsapi.NewProc("DnsNameCompare_W")
156	procDnsQuery_W                                           = moddnsapi.NewProc("DnsQuery_W")
157	procDnsRecordListFree                                    = moddnsapi.NewProc("DnsRecordListFree")
158	procGetAdaptersAddresses                                 = modiphlpapi.NewProc("GetAdaptersAddresses")
159	procGetAdaptersInfo                                      = modiphlpapi.NewProc("GetAdaptersInfo")
160	procGetIfEntry                                           = modiphlpapi.NewProc("GetIfEntry")
161	procAssignProcessToJobObject                             = modkernel32.NewProc("AssignProcessToJobObject")
162	procCancelIo                                             = modkernel32.NewProc("CancelIo")
163	procCancelIoEx                                           = modkernel32.NewProc("CancelIoEx")
164	procCloseHandle                                          = modkernel32.NewProc("CloseHandle")
165	procCreateDirectoryW                                     = modkernel32.NewProc("CreateDirectoryW")
166	procCreateEventExW                                       = modkernel32.NewProc("CreateEventExW")
167	procCreateEventW                                         = modkernel32.NewProc("CreateEventW")
168	procCreateFileMappingW                                   = modkernel32.NewProc("CreateFileMappingW")
169	procCreateFileW                                          = modkernel32.NewProc("CreateFileW")
170	procCreateHardLinkW                                      = modkernel32.NewProc("CreateHardLinkW")
171	procCreateIoCompletionPort                               = modkernel32.NewProc("CreateIoCompletionPort")
172	procCreateJobObjectW                                     = modkernel32.NewProc("CreateJobObjectW")
173	procCreateMutexExW                                       = modkernel32.NewProc("CreateMutexExW")
174	procCreateMutexW                                         = modkernel32.NewProc("CreateMutexW")
175	procCreatePipe                                           = modkernel32.NewProc("CreatePipe")
176	procCreateProcessW                                       = modkernel32.NewProc("CreateProcessW")
177	procCreateSymbolicLinkW                                  = modkernel32.NewProc("CreateSymbolicLinkW")
178	procCreateToolhelp32Snapshot                             = modkernel32.NewProc("CreateToolhelp32Snapshot")
179	procDefineDosDeviceW                                     = modkernel32.NewProc("DefineDosDeviceW")
180	procDeleteFileW                                          = modkernel32.NewProc("DeleteFileW")
181	procDeleteVolumeMountPointW                              = modkernel32.NewProc("DeleteVolumeMountPointW")
182	procDeviceIoControl                                      = modkernel32.NewProc("DeviceIoControl")
183	procDuplicateHandle                                      = modkernel32.NewProc("DuplicateHandle")
184	procExitProcess                                          = modkernel32.NewProc("ExitProcess")
185	procFindClose                                            = modkernel32.NewProc("FindClose")
186	procFindFirstFileW                                       = modkernel32.NewProc("FindFirstFileW")
187	procFindFirstVolumeMountPointW                           = modkernel32.NewProc("FindFirstVolumeMountPointW")
188	procFindFirstVolumeW                                     = modkernel32.NewProc("FindFirstVolumeW")
189	procFindNextFileW                                        = modkernel32.NewProc("FindNextFileW")
190	procFindNextVolumeMountPointW                            = modkernel32.NewProc("FindNextVolumeMountPointW")
191	procFindNextVolumeW                                      = modkernel32.NewProc("FindNextVolumeW")
192	procFindVolumeClose                                      = modkernel32.NewProc("FindVolumeClose")
193	procFindVolumeMountPointClose                            = modkernel32.NewProc("FindVolumeMountPointClose")
194	procFlushFileBuffers                                     = modkernel32.NewProc("FlushFileBuffers")
195	procFlushViewOfFile                                      = modkernel32.NewProc("FlushViewOfFile")
196	procFormatMessageW                                       = modkernel32.NewProc("FormatMessageW")
197	procFreeEnvironmentStringsW                              = modkernel32.NewProc("FreeEnvironmentStringsW")
198	procFreeLibrary                                          = modkernel32.NewProc("FreeLibrary")
199	procGenerateConsoleCtrlEvent                             = modkernel32.NewProc("GenerateConsoleCtrlEvent")
200	procGetACP                                               = modkernel32.NewProc("GetACP")
201	procGetCommandLineW                                      = modkernel32.NewProc("GetCommandLineW")
202	procGetComputerNameExW                                   = modkernel32.NewProc("GetComputerNameExW")
203	procGetComputerNameW                                     = modkernel32.NewProc("GetComputerNameW")
204	procGetConsoleMode                                       = modkernel32.NewProc("GetConsoleMode")
205	procGetConsoleScreenBufferInfo                           = modkernel32.NewProc("GetConsoleScreenBufferInfo")
206	procGetCurrentDirectoryW                                 = modkernel32.NewProc("GetCurrentDirectoryW")
207	procGetCurrentProcessId                                  = modkernel32.NewProc("GetCurrentProcessId")
208	procGetCurrentThreadId                                   = modkernel32.NewProc("GetCurrentThreadId")
209	procGetDiskFreeSpaceExW                                  = modkernel32.NewProc("GetDiskFreeSpaceExW")
210	procGetDriveTypeW                                        = modkernel32.NewProc("GetDriveTypeW")
211	procGetEnvironmentStringsW                               = modkernel32.NewProc("GetEnvironmentStringsW")
212	procGetEnvironmentVariableW                              = modkernel32.NewProc("GetEnvironmentVariableW")
213	procGetExitCodeProcess                                   = modkernel32.NewProc("GetExitCodeProcess")
214	procGetFileAttributesExW                                 = modkernel32.NewProc("GetFileAttributesExW")
215	procGetFileAttributesW                                   = modkernel32.NewProc("GetFileAttributesW")
216	procGetFileInformationByHandle                           = modkernel32.NewProc("GetFileInformationByHandle")
217	procGetFileInformationByHandleEx                         = modkernel32.NewProc("GetFileInformationByHandleEx")
218	procGetFileType                                          = modkernel32.NewProc("GetFileType")
219	procGetFinalPathNameByHandleW                            = modkernel32.NewProc("GetFinalPathNameByHandleW")
220	procGetFullPathNameW                                     = modkernel32.NewProc("GetFullPathNameW")
221	procGetLastError                                         = modkernel32.NewProc("GetLastError")
222	procGetLogicalDriveStringsW                              = modkernel32.NewProc("GetLogicalDriveStringsW")
223	procGetLogicalDrives                                     = modkernel32.NewProc("GetLogicalDrives")
224	procGetLongPathNameW                                     = modkernel32.NewProc("GetLongPathNameW")
225	procGetModuleFileNameW                                   = modkernel32.NewProc("GetModuleFileNameW")
226	procGetModuleHandleExW                                   = modkernel32.NewProc("GetModuleHandleExW")
227	procGetOverlappedResult                                  = modkernel32.NewProc("GetOverlappedResult")
228	procGetPriorityClass                                     = modkernel32.NewProc("GetPriorityClass")
229	procGetProcAddress                                       = modkernel32.NewProc("GetProcAddress")
230	procGetProcessId                                         = modkernel32.NewProc("GetProcessId")
231	procGetProcessPreferredUILanguages                       = modkernel32.NewProc("GetProcessPreferredUILanguages")
232	procGetProcessShutdownParameters                         = modkernel32.NewProc("GetProcessShutdownParameters")
233	procGetProcessTimes                                      = modkernel32.NewProc("GetProcessTimes")
234	procGetProcessWorkingSetSizeEx                           = modkernel32.NewProc("GetProcessWorkingSetSizeEx")
235	procGetQueuedCompletionStatus                            = modkernel32.NewProc("GetQueuedCompletionStatus")
236	procGetShortPathNameW                                    = modkernel32.NewProc("GetShortPathNameW")
237	procGetStartupInfoW                                      = modkernel32.NewProc("GetStartupInfoW")
238	procGetStdHandle                                         = modkernel32.NewProc("GetStdHandle")
239	procGetSystemDirectoryW                                  = modkernel32.NewProc("GetSystemDirectoryW")
240	procGetSystemPreferredUILanguages                        = modkernel32.NewProc("GetSystemPreferredUILanguages")
241	procGetSystemTimeAsFileTime                              = modkernel32.NewProc("GetSystemTimeAsFileTime")
242	procGetSystemTimePreciseAsFileTime                       = modkernel32.NewProc("GetSystemTimePreciseAsFileTime")
243	procGetSystemWindowsDirectoryW                           = modkernel32.NewProc("GetSystemWindowsDirectoryW")
244	procGetTempPathW                                         = modkernel32.NewProc("GetTempPathW")
245	procGetThreadPreferredUILanguages                        = modkernel32.NewProc("GetThreadPreferredUILanguages")
246	procGetTickCount64                                       = modkernel32.NewProc("GetTickCount64")
247	procGetTimeZoneInformation                               = modkernel32.NewProc("GetTimeZoneInformation")
248	procGetUserPreferredUILanguages                          = modkernel32.NewProc("GetUserPreferredUILanguages")
249	procGetVersion                                           = modkernel32.NewProc("GetVersion")
250	procGetVolumeInformationByHandleW                        = modkernel32.NewProc("GetVolumeInformationByHandleW")
251	procGetVolumeInformationW                                = modkernel32.NewProc("GetVolumeInformationW")
252	procGetVolumeNameForVolumeMountPointW                    = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW")
253	procGetVolumePathNameW                                   = modkernel32.NewProc("GetVolumePathNameW")
254	procGetVolumePathNamesForVolumeNameW                     = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW")
255	procGetWindowsDirectoryW                                 = modkernel32.NewProc("GetWindowsDirectoryW")
256	procIsWow64Process                                       = modkernel32.NewProc("IsWow64Process")
257	procIsWow64Process2                                      = modkernel32.NewProc("IsWow64Process2")
258	procLoadLibraryExW                                       = modkernel32.NewProc("LoadLibraryExW")
259	procLoadLibraryW                                         = modkernel32.NewProc("LoadLibraryW")
260	procLocalFree                                            = modkernel32.NewProc("LocalFree")
261	procLockFileEx                                           = modkernel32.NewProc("LockFileEx")
262	procMapViewOfFile                                        = modkernel32.NewProc("MapViewOfFile")
263	procMoveFileExW                                          = modkernel32.NewProc("MoveFileExW")
264	procMoveFileW                                            = modkernel32.NewProc("MoveFileW")
265	procMultiByteToWideChar                                  = modkernel32.NewProc("MultiByteToWideChar")
266	procOpenEventW                                           = modkernel32.NewProc("OpenEventW")
267	procOpenMutexW                                           = modkernel32.NewProc("OpenMutexW")
268	procOpenProcess                                          = modkernel32.NewProc("OpenProcess")
269	procOpenThread                                           = modkernel32.NewProc("OpenThread")
270	procPostQueuedCompletionStatus                           = modkernel32.NewProc("PostQueuedCompletionStatus")
271	procProcess32FirstW                                      = modkernel32.NewProc("Process32FirstW")
272	procProcess32NextW                                       = modkernel32.NewProc("Process32NextW")
273	procProcessIdToSessionId                                 = modkernel32.NewProc("ProcessIdToSessionId")
274	procPulseEvent                                           = modkernel32.NewProc("PulseEvent")
275	procQueryDosDeviceW                                      = modkernel32.NewProc("QueryDosDeviceW")
276	procQueryInformationJobObject                            = modkernel32.NewProc("QueryInformationJobObject")
277	procReadConsoleW                                         = modkernel32.NewProc("ReadConsoleW")
278	procReadDirectoryChangesW                                = modkernel32.NewProc("ReadDirectoryChangesW")
279	procReadFile                                             = modkernel32.NewProc("ReadFile")
280	procReleaseMutex                                         = modkernel32.NewProc("ReleaseMutex")
281	procRemoveDirectoryW                                     = modkernel32.NewProc("RemoveDirectoryW")
282	procResetEvent                                           = modkernel32.NewProc("ResetEvent")
283	procResumeThread                                         = modkernel32.NewProc("ResumeThread")
284	procSetConsoleCursorPosition                             = modkernel32.NewProc("SetConsoleCursorPosition")
285	procSetConsoleMode                                       = modkernel32.NewProc("SetConsoleMode")
286	procSetCurrentDirectoryW                                 = modkernel32.NewProc("SetCurrentDirectoryW")
287	procSetDefaultDllDirectories                             = modkernel32.NewProc("SetDefaultDllDirectories")
288	procSetDllDirectoryW                                     = modkernel32.NewProc("SetDllDirectoryW")
289	procSetEndOfFile                                         = modkernel32.NewProc("SetEndOfFile")
290	procSetEnvironmentVariableW                              = modkernel32.NewProc("SetEnvironmentVariableW")
291	procSetErrorMode                                         = modkernel32.NewProc("SetErrorMode")
292	procSetEvent                                             = modkernel32.NewProc("SetEvent")
293	procSetFileAttributesW                                   = modkernel32.NewProc("SetFileAttributesW")
294	procSetFileCompletionNotificationModes                   = modkernel32.NewProc("SetFileCompletionNotificationModes")
295	procSetFileInformationByHandle                           = modkernel32.NewProc("SetFileInformationByHandle")
296	procSetFilePointer                                       = modkernel32.NewProc("SetFilePointer")
297	procSetFileTime                                          = modkernel32.NewProc("SetFileTime")
298	procSetHandleInformation                                 = modkernel32.NewProc("SetHandleInformation")
299	procSetInformationJobObject                              = modkernel32.NewProc("SetInformationJobObject")
300	procSetPriorityClass                                     = modkernel32.NewProc("SetPriorityClass")
301	procSetProcessPriorityBoost                              = modkernel32.NewProc("SetProcessPriorityBoost")
302	procSetProcessShutdownParameters                         = modkernel32.NewProc("SetProcessShutdownParameters")
303	procSetProcessWorkingSetSizeEx                           = modkernel32.NewProc("SetProcessWorkingSetSizeEx")
304	procSetStdHandle                                         = modkernel32.NewProc("SetStdHandle")
305	procSetVolumeLabelW                                      = modkernel32.NewProc("SetVolumeLabelW")
306	procSetVolumeMountPointW                                 = modkernel32.NewProc("SetVolumeMountPointW")
307	procSleepEx                                              = modkernel32.NewProc("SleepEx")
308	procTerminateJobObject                                   = modkernel32.NewProc("TerminateJobObject")
309	procTerminateProcess                                     = modkernel32.NewProc("TerminateProcess")
310	procThread32First                                        = modkernel32.NewProc("Thread32First")
311	procThread32Next                                         = modkernel32.NewProc("Thread32Next")
312	procUnlockFileEx                                         = modkernel32.NewProc("UnlockFileEx")
313	procUnmapViewOfFile                                      = modkernel32.NewProc("UnmapViewOfFile")
314	procVirtualAlloc                                         = modkernel32.NewProc("VirtualAlloc")
315	procVirtualFree                                          = modkernel32.NewProc("VirtualFree")
316	procVirtualLock                                          = modkernel32.NewProc("VirtualLock")
317	procVirtualProtect                                       = modkernel32.NewProc("VirtualProtect")
318	procVirtualUnlock                                        = modkernel32.NewProc("VirtualUnlock")
319	procWaitForMultipleObjects                               = modkernel32.NewProc("WaitForMultipleObjects")
320	procWaitForSingleObject                                  = modkernel32.NewProc("WaitForSingleObject")
321	procWriteConsoleW                                        = modkernel32.NewProc("WriteConsoleW")
322	procWriteFile                                            = modkernel32.NewProc("WriteFile")
323	procAcceptEx                                             = modmswsock.NewProc("AcceptEx")
324	procGetAcceptExSockaddrs                                 = modmswsock.NewProc("GetAcceptExSockaddrs")
325	procTransmitFile                                         = modmswsock.NewProc("TransmitFile")
326	procNetApiBufferFree                                     = modnetapi32.NewProc("NetApiBufferFree")
327	procNetGetJoinInformation                                = modnetapi32.NewProc("NetGetJoinInformation")
328	procNetUserGetInfo                                       = modnetapi32.NewProc("NetUserGetInfo")
329	procRtlGetNtVersionNumbers                               = modntdll.NewProc("RtlGetNtVersionNumbers")
330	procRtlGetVersion                                        = modntdll.NewProc("RtlGetVersion")
331	procCLSIDFromString                                      = modole32.NewProc("CLSIDFromString")
332	procCoCreateGuid                                         = modole32.NewProc("CoCreateGuid")
333	procCoTaskMemFree                                        = modole32.NewProc("CoTaskMemFree")
334	procStringFromGUID2                                      = modole32.NewProc("StringFromGUID2")
335	procEnumProcesses                                        = modpsapi.NewProc("EnumProcesses")
336	procSubscribeServiceChangeNotifications                  = modsechost.NewProc("SubscribeServiceChangeNotifications")
337	procUnsubscribeServiceChangeNotifications                = modsechost.NewProc("UnsubscribeServiceChangeNotifications")
338	procGetUserNameExW                                       = modsecur32.NewProc("GetUserNameExW")
339	procTranslateNameW                                       = modsecur32.NewProc("TranslateNameW")
340	procCommandLineToArgvW                                   = modshell32.NewProc("CommandLineToArgvW")
341	procSHGetKnownFolderPath                                 = modshell32.NewProc("SHGetKnownFolderPath")
342	procShellExecuteW                                        = modshell32.NewProc("ShellExecuteW")
343	procExitWindowsEx                                        = moduser32.NewProc("ExitWindowsEx")
344	procGetShellWindow                                       = moduser32.NewProc("GetShellWindow")
345	procGetWindowThreadProcessId                             = moduser32.NewProc("GetWindowThreadProcessId")
346	procMessageBoxW                                          = moduser32.NewProc("MessageBoxW")
347	procCreateEnvironmentBlock                               = moduserenv.NewProc("CreateEnvironmentBlock")
348	procDestroyEnvironmentBlock                              = moduserenv.NewProc("DestroyEnvironmentBlock")
349	procGetUserProfileDirectoryW                             = moduserenv.NewProc("GetUserProfileDirectoryW")
350	procFreeAddrInfoW                                        = modws2_32.NewProc("FreeAddrInfoW")
351	procGetAddrInfoW                                         = modws2_32.NewProc("GetAddrInfoW")
352	procWSACleanup                                           = modws2_32.NewProc("WSACleanup")
353	procWSAEnumProtocolsW                                    = modws2_32.NewProc("WSAEnumProtocolsW")
354	procWSAIoctl                                             = modws2_32.NewProc("WSAIoctl")
355	procWSARecv                                              = modws2_32.NewProc("WSARecv")
356	procWSARecvFrom                                          = modws2_32.NewProc("WSARecvFrom")
357	procWSASend                                              = modws2_32.NewProc("WSASend")
358	procWSASendTo                                            = modws2_32.NewProc("WSASendTo")
359	procWSAStartup                                           = modws2_32.NewProc("WSAStartup")
360	procbind                                                 = modws2_32.NewProc("bind")
361	procclosesocket                                          = modws2_32.NewProc("closesocket")
362	procconnect                                              = modws2_32.NewProc("connect")
363	procgethostbyname                                        = modws2_32.NewProc("gethostbyname")
364	procgetpeername                                          = modws2_32.NewProc("getpeername")
365	procgetprotobyname                                       = modws2_32.NewProc("getprotobyname")
366	procgetservbyname                                        = modws2_32.NewProc("getservbyname")
367	procgetsockname                                          = modws2_32.NewProc("getsockname")
368	procgetsockopt                                           = modws2_32.NewProc("getsockopt")
369	proclisten                                               = modws2_32.NewProc("listen")
370	procntohs                                                = modws2_32.NewProc("ntohs")
371	procrecvfrom                                             = modws2_32.NewProc("recvfrom")
372	procsendto                                               = modws2_32.NewProc("sendto")
373	procsetsockopt                                           = modws2_32.NewProc("setsockopt")
374	procshutdown                                             = modws2_32.NewProc("shutdown")
375	procsocket                                               = modws2_32.NewProc("socket")
376	procWTSEnumerateSessionsW                                = modwtsapi32.NewProc("WTSEnumerateSessionsW")
377	procWTSFreeMemory                                        = modwtsapi32.NewProc("WTSFreeMemory")
378	procWTSQueryUserToken                                    = modwtsapi32.NewProc("WTSQueryUserToken")
379)
380
381func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) {
382	var _p0 uint32
383	if resetToDefault {
384		_p0 = 1
385	}
386	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)))
387	if r1 == 0 {
388		err = errnoErr(e1)
389	}
390	return
391}
392
393func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) {
394	var _p0 uint32
395	if disableAllPrivileges {
396		_p0 = 1
397	}
398	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)))
399	if r1 == 0 {
400		err = errnoErr(e1)
401	}
402	return
403}
404
405func 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) {
406	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)
407	if r1 == 0 {
408		err = errnoErr(e1)
409	}
410	return
411}
412
413func 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) {
414	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)))
415	if r0 != 0 {
416		ret = syscall.Errno(r0)
417	}
418	return
419}
420
421func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) {
422	r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info)))
423	if r1 == 0 {
424		err = errnoErr(e1)
425	}
426	return
427}
428
429func 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) {
430	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)
431	if r1 == 0 {
432		err = errnoErr(e1)
433	}
434	return
435}
436
437func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) {
438	r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember)))
439	if r1 == 0 {
440		err = errnoErr(e1)
441	}
442	return
443}
444
445func CloseServiceHandle(handle Handle) (err error) {
446	r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0)
447	if r1 == 0 {
448		err = errnoErr(e1)
449	}
450	return
451}
452
453func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
454	r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
455	if r1 == 0 {
456		err = errnoErr(e1)
457	}
458	return
459}
460
461func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) {
462	r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0)
463	if r1 == 0 {
464		err = errnoErr(e1)
465	}
466	return
467}
468
469func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
470	r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
471	if r1 == 0 {
472		err = errnoErr(e1)
473	}
474	return
475}
476
477func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
478	var _p0 *uint16
479	_p0, err = syscall.UTF16PtrFromString(str)
480	if err != nil {
481		return
482	}
483	return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
484}
485
486func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
487	r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
488	if r1 == 0 {
489		err = errnoErr(e1)
490	}
491	return
492}
493
494func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
495	r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
496	if r1 == 0 {
497		err = errnoErr(e1)
498	}
499	return
500}
501
502func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
503	r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
504	if r1 == 0 {
505		err = errnoErr(e1)
506	}
507	return
508}
509
510func 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) {
511	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)
512	handle = Handle(r0)
513	if handle == 0 {
514		err = errnoErr(e1)
515	}
516	return
517}
518
519func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) {
520	r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0)
521	if r1 == 0 {
522		err = errnoErr(e1)
523	}
524	return
525}
526
527func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
528	r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
529	if r1 == 0 {
530		err = errnoErr(e1)
531	}
532	return
533}
534
535func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
536	r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
537	if r1 == 0 {
538		err = errnoErr(e1)
539	}
540	return
541}
542
543func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
544	r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
545	if r1 == 0 {
546		err = errnoErr(e1)
547	}
548	return
549}
550
551func DeleteService(service Handle) (err error) {
552	r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0)
553	if r1 == 0 {
554		err = errnoErr(e1)
555	}
556	return
557}
558
559func DeregisterEventSource(handle Handle) (err error) {
560	r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0)
561	if r1 == 0 {
562		err = errnoErr(e1)
563	}
564	return
565}
566
567func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) {
568	r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken)))
569	if r1 == 0 {
570		err = errnoErr(e1)
571	}
572	return
573}
574
575func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) {
576	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)
577	if r1 == 0 {
578		err = errnoErr(e1)
579	}
580	return
581}
582
583func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) {
584	r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0)
585	isEqual = r0 != 0
586	return
587}
588
589func FreeSid(sid *SID) (err error) {
590	r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
591	if r1 != 0 {
592		err = errnoErr(e1)
593	}
594	return
595}
596
597func GetLengthSid(sid *SID) (len uint32) {
598	r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
599	len = uint32(r0)
600	return
601}
602
603func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
604	var _p0 *uint16
605	_p0, ret = syscall.UTF16PtrFromString(objectName)
606	if ret != nil {
607		return
608	}
609	return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd)
610}
611
612func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
613	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)
614	if r0 != 0 {
615		ret = syscall.Errno(r0)
616	}
617	return
618}
619
620func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) {
621	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision)))
622	if r1 == 0 {
623		err = errnoErr(e1)
624	}
625	return
626}
627
628func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) {
629	var _p0 uint32
630	if *daclPresent {
631		_p0 = 1
632	}
633	var _p1 uint32
634	if *daclDefaulted {
635		_p1 = 1
636	}
637	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)
638	*daclPresent = _p0 != 0
639	*daclDefaulted = _p1 != 0
640	if r1 == 0 {
641		err = errnoErr(e1)
642	}
643	return
644}
645
646func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) {
647	var _p0 uint32
648	if *groupDefaulted {
649		_p0 = 1
650	}
651	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0)))
652	*groupDefaulted = _p0 != 0
653	if r1 == 0 {
654		err = errnoErr(e1)
655	}
656	return
657}
658
659func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) {
660	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
661	len = uint32(r0)
662	return
663}
664
665func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) {
666	var _p0 uint32
667	if *ownerDefaulted {
668		_p0 = 1
669	}
670	r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0)))
671	*ownerDefaulted = _p0 != 0
672	if r1 == 0 {
673		err = errnoErr(e1)
674	}
675	return
676}
677
678func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) {
679	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
680	if r0 != 0 {
681		ret = syscall.Errno(r0)
682	}
683	return
684}
685
686func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) {
687	var _p0 uint32
688	if *saclPresent {
689		_p0 = 1
690	}
691	var _p1 uint32
692	if *saclDefaulted {
693		_p1 = 1
694	}
695	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)
696	*saclPresent = _p0 != 0
697	*saclDefaulted = _p1 != 0
698	if r1 == 0 {
699		err = errnoErr(e1)
700	}
701	return
702}
703
704func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
705	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)
706	if r0 != 0 {
707		ret = syscall.Errno(r0)
708	}
709	return
710}
711
712func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) {
713	r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
714	authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0))
715	return
716}
717
718func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) {
719	r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0)
720	subAuthority = (*uint32)(unsafe.Pointer(r0))
721	return
722}
723
724func getSidSubAuthorityCount(sid *SID) (count *uint8) {
725	r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
726	count = (*uint8)(unsafe.Pointer(r0))
727	return
728}
729
730func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
731	r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
732	if r1 == 0 {
733		err = errnoErr(e1)
734	}
735	return
736}
737
738func ImpersonateSelf(impersonationlevel uint32) (err error) {
739	r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
740	if r1 == 0 {
741		err = errnoErr(e1)
742	}
743	return
744}
745
746func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) {
747	r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0)
748	if r1 == 0 {
749		err = errnoErr(e1)
750	}
751	return
752}
753
754func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) {
755	var _p0 uint32
756	if forceAppsClosed {
757		_p0 = 1
758	}
759	var _p1 uint32
760	if rebootAfterShutdown {
761		_p1 = 1
762	}
763	r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason))
764	if r1 == 0 {
765		err = errnoErr(e1)
766	}
767	return
768}
769
770func isTokenRestricted(tokenHandle Token) (ret bool, err error) {
771	r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0)
772	ret = r0 != 0
773	if !ret {
774		err = errnoErr(e1)
775	}
776	return
777}
778
779func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) {
780	r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
781	isValid = r0 != 0
782	return
783}
784
785func isValidSid(sid *SID) (isValid bool) {
786	r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
787	isValid = r0 != 0
788	return
789}
790
791func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) {
792	r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0)
793	isWellKnown = r0 != 0
794	return
795}
796
797func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
798	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)
799	if r1 == 0 {
800		err = errnoErr(e1)
801	}
802	return
803}
804
805func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
806	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)
807	if r1 == 0 {
808		err = errnoErr(e1)
809	}
810	return
811}
812
813func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
814	r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
815	if r1 == 0 {
816		err = errnoErr(e1)
817	}
818	return
819}
820
821func 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) {
822	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)
823	if r1 == 0 {
824		err = errnoErr(e1)
825	}
826	return
827}
828
829func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) {
830	r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize)))
831	if r1 == 0 {
832		err = errnoErr(e1)
833	}
834	return
835}
836
837func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) {
838	r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier)))
839	if r0 != 0 {
840		ret = syscall.Errno(r0)
841	}
842	return
843}
844
845func OpenProcessToken(process Handle, access uint32, token *Token) (err error) {
846	r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token)))
847	if r1 == 0 {
848		err = errnoErr(e1)
849	}
850	return
851}
852
853func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) {
854	r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
855	handle = Handle(r0)
856	if handle == 0 {
857		err = errnoErr(e1)
858	}
859	return
860}
861
862func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) {
863	r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
864	handle = Handle(r0)
865	if handle == 0 {
866		err = errnoErr(e1)
867	}
868	return
869}
870
871func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) {
872	var _p0 uint32
873	if openAsSelf {
874		_p0 = 1
875	}
876	r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
877	if r1 == 0 {
878		err = errnoErr(e1)
879	}
880	return
881}
882
883func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
884	r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
885	if r1 == 0 {
886		err = errnoErr(e1)
887	}
888	return
889}
890
891func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) {
892	r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
893	if r1 == 0 {
894		err = errnoErr(e1)
895	}
896	return
897}
898
899func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) {
900	r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
901	if r1 == 0 {
902		err = errnoErr(e1)
903	}
904	return
905}
906
907func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) {
908	r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0)
909	if r1 == 0 {
910		err = errnoErr(e1)
911	}
912	return
913}
914
915func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
916	r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
917	if r1 == 0 {
918		err = errnoErr(e1)
919	}
920	return
921}
922
923func RegCloseKey(key Handle) (regerrno error) {
924	r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0)
925	if r0 != 0 {
926		regerrno = syscall.Errno(r0)
927	}
928	return
929}
930
931func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) {
932	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)
933	if r0 != 0 {
934		regerrno = syscall.Errno(r0)
935	}
936	return
937}
938
939func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) {
940	var _p0 uint32
941	if watchSubtree {
942		_p0 = 1
943	}
944	var _p1 uint32
945	if asynchronous {
946		_p1 = 1
947	}
948	r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0)
949	if r0 != 0 {
950		regerrno = syscall.Errno(r0)
951	}
952	return
953}
954
955func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) {
956	r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0)
957	if r0 != 0 {
958		regerrno = syscall.Errno(r0)
959	}
960	return
961}
962
963func 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) {
964	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)))
965	if r0 != 0 {
966		regerrno = syscall.Errno(r0)
967	}
968	return
969}
970
971func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
972	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)))
973	if r0 != 0 {
974		regerrno = syscall.Errno(r0)
975	}
976	return
977}
978
979func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
980	r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0)
981	handle = Handle(r0)
982	if handle == 0 {
983		err = errnoErr(e1)
984	}
985	return
986}
987
988func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) {
989	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)))
990	if r1 == 0 {
991		err = errnoErr(e1)
992	}
993	return
994}
995
996func RevertToSelf() (err error) {
997	r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
998	if r1 == 0 {
999		err = errnoErr(e1)
1000	}
1001	return
1002}
1003
1004func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) {
1005	r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0)
1006	if r0 != 0 {
1007		ret = syscall.Errno(r0)
1008	}
1009	return
1010}
1011
1012func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) {
1013	r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor)))
1014	if r1 == 0 {
1015		err = errnoErr(e1)
1016	}
1017	return
1018}
1019
1020func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
1021	var _p0 *uint16
1022	_p0, ret = syscall.UTF16PtrFromString(objectName)
1023	if ret != nil {
1024		return
1025	}
1026	return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl)
1027}
1028
1029func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
1030	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)
1031	if r0 != 0 {
1032		ret = syscall.Errno(r0)
1033	}
1034	return
1035}
1036
1037func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) {
1038	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet))
1039	if r1 == 0 {
1040		err = errnoErr(e1)
1041	}
1042	return
1043}
1044
1045func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) {
1046	var _p0 uint32
1047	if daclPresent {
1048		_p0 = 1
1049	}
1050	var _p1 uint32
1051	if daclDefaulted {
1052		_p1 = 1
1053	}
1054	r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0)
1055	if r1 == 0 {
1056		err = errnoErr(e1)
1057	}
1058	return
1059}
1060
1061func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) {
1062	var _p0 uint32
1063	if groupDefaulted {
1064		_p0 = 1
1065	}
1066	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0))
1067	if r1 == 0 {
1068		err = errnoErr(e1)
1069	}
1070	return
1071}
1072
1073func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) {
1074	var _p0 uint32
1075	if ownerDefaulted {
1076		_p0 = 1
1077	}
1078	r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0))
1079	if r1 == 0 {
1080		err = errnoErr(e1)
1081	}
1082	return
1083}
1084
1085func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) {
1086	syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
1087	return
1088}
1089
1090func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) {
1091	var _p0 uint32
1092	if saclPresent {
1093		_p0 = 1
1094	}
1095	var _p1 uint32
1096	if saclDefaulted {
1097		_p1 = 1
1098	}
1099	r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0)
1100	if r1 == 0 {
1101		err = errnoErr(e1)
1102	}
1103	return
1104}
1105
1106func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
1107	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)
1108	if r0 != 0 {
1109		ret = syscall.Errno(r0)
1110	}
1111	return
1112}
1113
1114func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) {
1115	r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0)
1116	if r1 == 0 {
1117		err = errnoErr(e1)
1118	}
1119	return
1120}
1121
1122func SetThreadToken(thread *Handle, token Token) (err error) {
1123	r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0)
1124	if r1 == 0 {
1125		err = errnoErr(e1)
1126	}
1127	return
1128}
1129
1130func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) {
1131	r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0)
1132	if r1 == 0 {
1133		err = errnoErr(e1)
1134	}
1135	return
1136}
1137
1138func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) {
1139	r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0)
1140	if r1 == 0 {
1141		err = errnoErr(e1)
1142	}
1143	return
1144}
1145
1146func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) {
1147	r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors)))
1148	if r1 == 0 {
1149		err = errnoErr(e1)
1150	}
1151	return
1152}
1153
1154func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
1155	r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
1156	if r1 == 0 {
1157		err = errnoErr(e1)
1158	}
1159	return
1160}
1161
1162func CertCloseStore(store Handle, flags uint32) (err error) {
1163	r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
1164	if r1 == 0 {
1165		err = errnoErr(e1)
1166	}
1167	return
1168}
1169
1170func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) {
1171	r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen))
1172	context = (*CertContext)(unsafe.Pointer(r0))
1173	if context == nil {
1174		err = errnoErr(e1)
1175	}
1176	return
1177}
1178
1179func CertDeleteCertificateFromStore(certContext *CertContext) (err error) {
1180	r1, _, e1 := syscall.Syscall(procCertDeleteCertificateFromStore.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0)
1181	if r1 == 0 {
1182		err = errnoErr(e1)
1183	}
1184	return
1185}
1186
1187func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) {
1188	r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0)
1189	dupContext = (*CertContext)(unsafe.Pointer(r0))
1190	return
1191}
1192
1193func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) {
1194	r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0)
1195	context = (*CertContext)(unsafe.Pointer(r0))
1196	if context == nil {
1197		err = errnoErr(e1)
1198	}
1199	return
1200}
1201
1202func CertFreeCertificateChain(ctx *CertChainContext) {
1203	syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1204	return
1205}
1206
1207func CertFreeCertificateContext(ctx *CertContext) (err error) {
1208	r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1209	if r1 == 0 {
1210		err = errnoErr(e1)
1211	}
1212	return
1213}
1214
1215func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
1216	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)
1217	if r1 == 0 {
1218		err = errnoErr(e1)
1219	}
1220	return
1221}
1222
1223func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
1224	r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
1225	handle = Handle(r0)
1226	if handle == 0 {
1227		err = errnoErr(e1)
1228	}
1229	return
1230}
1231
1232func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
1233	r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0)
1234	store = Handle(r0)
1235	if store == 0 {
1236		err = errnoErr(e1)
1237	}
1238	return
1239}
1240
1241func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
1242	r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
1243	if r1 == 0 {
1244		err = errnoErr(e1)
1245	}
1246	return
1247}
1248
1249func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) {
1250	r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags))
1251	store = Handle(r0)
1252	if store == 0 {
1253		err = errnoErr(e1)
1254	}
1255	return
1256}
1257
1258func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) {
1259	r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0)
1260	same = r0 != 0
1261	return
1262}
1263
1264func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
1265	var _p0 *uint16
1266	_p0, status = syscall.UTF16PtrFromString(name)
1267	if status != nil {
1268		return
1269	}
1270	return _DnsQuery(_p0, qtype, options, extra, qrs, pr)
1271}
1272
1273func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
1274	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)))
1275	if r0 != 0 {
1276		status = syscall.Errno(r0)
1277	}
1278	return
1279}
1280
1281func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
1282	syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
1283	return
1284}
1285
1286func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
1287	r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
1288	if r0 != 0 {
1289		errcode = syscall.Errno(r0)
1290	}
1291	return
1292}
1293
1294func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) {
1295	r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
1296	if r0 != 0 {
1297		errcode = syscall.Errno(r0)
1298	}
1299	return
1300}
1301
1302func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
1303	r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
1304	if r0 != 0 {
1305		errcode = syscall.Errno(r0)
1306	}
1307	return
1308}
1309
1310func AssignProcessToJobObject(job Handle, process Handle) (err error) {
1311	r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
1312	if r1 == 0 {
1313		err = errnoErr(e1)
1314	}
1315	return
1316}
1317
1318func CancelIo(s Handle) (err error) {
1319	r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
1320	if r1 == 0 {
1321		err = errnoErr(e1)
1322	}
1323	return
1324}
1325
1326func CancelIoEx(s Handle, o *Overlapped) (err error) {
1327	r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0)
1328	if r1 == 0 {
1329		err = errnoErr(e1)
1330	}
1331	return
1332}
1333
1334func CloseHandle(handle Handle) (err error) {
1335	r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
1336	if r1 == 0 {
1337		err = errnoErr(e1)
1338	}
1339	return
1340}
1341
1342func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
1343	r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
1344	if r1 == 0 {
1345		err = errnoErr(e1)
1346	}
1347	return
1348}
1349
1350func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
1351	r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
1352	handle = Handle(r0)
1353	if handle == 0 {
1354		err = errnoErr(e1)
1355	}
1356	return
1357}
1358
1359func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) {
1360	r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
1361	handle = Handle(r0)
1362	if handle == 0 {
1363		err = errnoErr(e1)
1364	}
1365	return
1366}
1367
1368func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) {
1369	r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
1370	handle = Handle(r0)
1371	if handle == 0 {
1372		err = errnoErr(e1)
1373	}
1374	return
1375}
1376
1377func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
1378	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)
1379	handle = Handle(r0)
1380	if handle == InvalidHandle {
1381		err = errnoErr(e1)
1382	}
1383	return
1384}
1385
1386func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) {
1387	r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved))
1388	if r1&0xff == 0 {
1389		err = errnoErr(e1)
1390	}
1391	return
1392}
1393
1394func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) {
1395	r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
1396	handle = Handle(r0)
1397	if handle == 0 {
1398		err = errnoErr(e1)
1399	}
1400	return
1401}
1402
1403func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) {
1404	r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0)
1405	handle = Handle(r0)
1406	if handle == 0 {
1407		err = errnoErr(e1)
1408	}
1409	return
1410}
1411
1412func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
1413	r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
1414	handle = Handle(r0)
1415	if handle == 0 {
1416		err = errnoErr(e1)
1417	}
1418	return
1419}
1420
1421func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) {
1422	var _p0 uint32
1423	if initialOwner {
1424		_p0 = 1
1425	}
1426	r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name)))
1427	handle = Handle(r0)
1428	if handle == 0 {
1429		err = errnoErr(e1)
1430	}
1431	return
1432}
1433
1434func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
1435	r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
1436	if r1 == 0 {
1437		err = errnoErr(e1)
1438	}
1439	return
1440}
1441
1442func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
1443	var _p0 uint32
1444	if inheritHandles {
1445		_p0 = 1
1446	}
1447	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)
1448	if r1 == 0 {
1449		err = errnoErr(e1)
1450	}
1451	return
1452}
1453
1454func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) {
1455	r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags))
1456	if r1&0xff == 0 {
1457		err = errnoErr(e1)
1458	}
1459	return
1460}
1461
1462func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) {
1463	r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0)
1464	handle = Handle(r0)
1465	if handle == InvalidHandle {
1466		err = errnoErr(e1)
1467	}
1468	return
1469}
1470
1471func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
1472	r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
1473	if r1 == 0 {
1474		err = errnoErr(e1)
1475	}
1476	return
1477}
1478
1479func DeleteFile(path *uint16) (err error) {
1480	r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
1481	if r1 == 0 {
1482		err = errnoErr(e1)
1483	}
1484	return
1485}
1486
1487func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) {
1488	r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0)
1489	if r1 == 0 {
1490		err = errnoErr(e1)
1491	}
1492	return
1493}
1494
1495func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
1496	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)
1497	if r1 == 0 {
1498		err = errnoErr(e1)
1499	}
1500	return
1501}
1502
1503func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
1504	var _p0 uint32
1505	if bInheritHandle {
1506		_p0 = 1
1507	}
1508	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)
1509	if r1 == 0 {
1510		err = errnoErr(e1)
1511	}
1512	return
1513}
1514
1515func ExitProcess(exitcode uint32) {
1516	syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
1517	return
1518}
1519
1520func FindClose(handle Handle) (err error) {
1521	r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
1522	if r1 == 0 {
1523		err = errnoErr(e1)
1524	}
1525	return
1526}
1527
1528func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) {
1529	r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
1530	handle = Handle(r0)
1531	if handle == InvalidHandle {
1532		err = errnoErr(e1)
1533	}
1534	return
1535}
1536
1537func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) {
1538	r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
1539	handle = Handle(r0)
1540	if handle == InvalidHandle {
1541		err = errnoErr(e1)
1542	}
1543	return
1544}
1545
1546func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) {
1547	r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0)
1548	handle = Handle(r0)
1549	if handle == InvalidHandle {
1550		err = errnoErr(e1)
1551	}
1552	return
1553}
1554
1555func findNextFile1(handle Handle, data *win32finddata1) (err error) {
1556	r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
1557	if r1 == 0 {
1558		err = errnoErr(e1)
1559	}
1560	return
1561}
1562
1563func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) {
1564	r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
1565	if r1 == 0 {
1566		err = errnoErr(e1)
1567	}
1568	return
1569}
1570
1571func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) {
1572	r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength))
1573	if r1 == 0 {
1574		err = errnoErr(e1)
1575	}
1576	return
1577}
1578
1579func FindVolumeClose(findVolume Handle) (err error) {
1580	r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0)
1581	if r1 == 0 {
1582		err = errnoErr(e1)
1583	}
1584	return
1585}
1586
1587func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) {
1588	r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0)
1589	if r1 == 0 {
1590		err = errnoErr(e1)
1591	}
1592	return
1593}
1594
1595func FlushFileBuffers(handle Handle) (err error) {
1596	r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
1597	if r1 == 0 {
1598		err = errnoErr(e1)
1599	}
1600	return
1601}
1602
1603func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
1604	r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
1605	if r1 == 0 {
1606		err = errnoErr(e1)
1607	}
1608	return
1609}
1610
1611func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) {
1612	var _p0 *uint16
1613	if len(buf) > 0 {
1614		_p0 = &buf[0]
1615	}
1616	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)
1617	n = uint32(r0)
1618	if n == 0 {
1619		err = errnoErr(e1)
1620	}
1621	return
1622}
1623
1624func FreeEnvironmentStrings(envs *uint16) (err error) {
1625	r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
1626	if r1 == 0 {
1627		err = errnoErr(e1)
1628	}
1629	return
1630}
1631
1632func FreeLibrary(handle Handle) (err error) {
1633	r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
1634	if r1 == 0 {
1635		err = errnoErr(e1)
1636	}
1637	return
1638}
1639
1640func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) {
1641	r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0)
1642	if r1 == 0 {
1643		err = errnoErr(e1)
1644	}
1645	return
1646}
1647
1648func GetACP() (acp uint32) {
1649	r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
1650	acp = uint32(r0)
1651	return
1652}
1653
1654func GetCommandLine() (cmd *uint16) {
1655	r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0)
1656	cmd = (*uint16)(unsafe.Pointer(r0))
1657	return
1658}
1659
1660func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) {
1661	r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
1662	if r1 == 0 {
1663		err = errnoErr(e1)
1664	}
1665	return
1666}
1667
1668func GetComputerName(buf *uint16, n *uint32) (err error) {
1669	r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
1670	if r1 == 0 {
1671		err = errnoErr(e1)
1672	}
1673	return
1674}
1675
1676func GetConsoleMode(console Handle, mode *uint32) (err error) {
1677	r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
1678	if r1 == 0 {
1679		err = errnoErr(e1)
1680	}
1681	return
1682}
1683
1684func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
1685	r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
1686	if r1 == 0 {
1687		err = errnoErr(e1)
1688	}
1689	return
1690}
1691
1692func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
1693	r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
1694	n = uint32(r0)
1695	if n == 0 {
1696		err = errnoErr(e1)
1697	}
1698	return
1699}
1700
1701func GetCurrentProcessId() (pid uint32) {
1702	r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
1703	pid = uint32(r0)
1704	return
1705}
1706
1707func GetCurrentThreadId() (id uint32) {
1708	r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0)
1709	id = uint32(r0)
1710	return
1711}
1712
1713func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) {
1714	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)
1715	if r1 == 0 {
1716		err = errnoErr(e1)
1717	}
1718	return
1719}
1720
1721func GetDriveType(rootPathName *uint16) (driveType uint32) {
1722	r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
1723	driveType = uint32(r0)
1724	return
1725}
1726
1727func GetEnvironmentStrings() (envs *uint16, err error) {
1728	r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0)
1729	envs = (*uint16)(unsafe.Pointer(r0))
1730	if envs == nil {
1731		err = errnoErr(e1)
1732	}
1733	return
1734}
1735
1736func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) {
1737	r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size))
1738	n = uint32(r0)
1739	if n == 0 {
1740		err = errnoErr(e1)
1741	}
1742	return
1743}
1744
1745func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
1746	r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
1747	if r1 == 0 {
1748		err = errnoErr(e1)
1749	}
1750	return
1751}
1752
1753func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
1754	r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
1755	if r1 == 0 {
1756		err = errnoErr(e1)
1757	}
1758	return
1759}
1760
1761func GetFileAttributes(name *uint16) (attrs uint32, err error) {
1762	r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
1763	attrs = uint32(r0)
1764	if attrs == INVALID_FILE_ATTRIBUTES {
1765		err = errnoErr(e1)
1766	}
1767	return
1768}
1769
1770func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
1771	r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
1772	if r1 == 0 {
1773		err = errnoErr(e1)
1774	}
1775	return
1776}
1777
1778func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) {
1779	r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0)
1780	if r1 == 0 {
1781		err = errnoErr(e1)
1782	}
1783	return
1784}
1785
1786func GetFileType(filehandle Handle) (n uint32, err error) {
1787	r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0)
1788	n = uint32(r0)
1789	if n == 0 {
1790		err = errnoErr(e1)
1791	}
1792	return
1793}
1794
1795func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
1796	r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0)
1797	n = uint32(r0)
1798	if n == 0 {
1799		err = errnoErr(e1)
1800	}
1801	return
1802}
1803
1804func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) {
1805	r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0)
1806	n = uint32(r0)
1807	if n == 0 {
1808		err = errnoErr(e1)
1809	}
1810	return
1811}
1812
1813func GetLastError() (lasterr error) {
1814	r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
1815	if r0 != 0 {
1816		lasterr = syscall.Errno(r0)
1817	}
1818	return
1819}
1820
1821func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) {
1822	r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0)
1823	n = uint32(r0)
1824	if n == 0 {
1825		err = errnoErr(e1)
1826	}
1827	return
1828}
1829
1830func GetLogicalDrives() (drivesBitMask uint32, err error) {
1831	r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0)
1832	drivesBitMask = uint32(r0)
1833	if drivesBitMask == 0 {
1834		err = errnoErr(e1)
1835	}
1836	return
1837}
1838
1839func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) {
1840	r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen))
1841	n = uint32(r0)
1842	if n == 0 {
1843		err = errnoErr(e1)
1844	}
1845	return
1846}
1847
1848func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) {
1849	r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size))
1850	n = uint32(r0)
1851	if n == 0 {
1852		err = errnoErr(e1)
1853	}
1854	return
1855}
1856
1857func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) {
1858	r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module)))
1859	if r1 == 0 {
1860		err = errnoErr(e1)
1861	}
1862	return
1863}
1864
1865func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
1866	var _p0 uint32
1867	if wait {
1868		_p0 = 1
1869	}
1870	r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0)
1871	if r1 == 0 {
1872		err = errnoErr(e1)
1873	}
1874	return
1875}
1876
1877func GetPriorityClass(process Handle) (ret uint32, err error) {
1878	r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0)
1879	ret = uint32(r0)
1880	if ret == 0 {
1881		err = errnoErr(e1)
1882	}
1883	return
1884}
1885
1886func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
1887	var _p0 *byte
1888	_p0, err = syscall.BytePtrFromString(procname)
1889	if err != nil {
1890		return
1891	}
1892	return _GetProcAddress(module, _p0)
1893}
1894
1895func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) {
1896	r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0)
1897	proc = uintptr(r0)
1898	if proc == 0 {
1899		err = errnoErr(e1)
1900	}
1901	return
1902}
1903
1904func GetProcessId(process Handle) (id uint32, err error) {
1905	r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0)
1906	id = uint32(r0)
1907	if id == 0 {
1908		err = errnoErr(e1)
1909	}
1910	return
1911}
1912
1913func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
1914	r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
1915	if r1 == 0 {
1916		err = errnoErr(e1)
1917	}
1918	return
1919}
1920
1921func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) {
1922	r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0)
1923	if r1 == 0 {
1924		err = errnoErr(e1)
1925	}
1926	return
1927}
1928
1929func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
1930	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)
1931	if r1 == 0 {
1932		err = errnoErr(e1)
1933	}
1934	return
1935}
1936
1937func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) {
1938	syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0)
1939	return
1940}
1941
1942func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
1943	r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
1944	if r1 == 0 {
1945		err = errnoErr(e1)
1946	}
1947	return
1948}
1949
1950func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) {
1951	r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen))
1952	n = uint32(r0)
1953	if n == 0 {
1954		err = errnoErr(e1)
1955	}
1956	return
1957}
1958
1959func GetStartupInfo(startupInfo *StartupInfo) (err error) {
1960	r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
1961	if r1 == 0 {
1962		err = errnoErr(e1)
1963	}
1964	return
1965}
1966
1967func GetStdHandle(stdhandle uint32) (handle Handle, err error) {
1968	r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0)
1969	handle = Handle(r0)
1970	if handle == InvalidHandle {
1971		err = errnoErr(e1)
1972	}
1973	return
1974}
1975
1976func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
1977	r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
1978	len = uint32(r0)
1979	if len == 0 {
1980		err = errnoErr(e1)
1981	}
1982	return
1983}
1984
1985func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
1986	r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
1987	if r1 == 0 {
1988		err = errnoErr(e1)
1989	}
1990	return
1991}
1992
1993func GetSystemTimeAsFileTime(time *Filetime) {
1994	syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
1995	return
1996}
1997
1998func GetSystemTimePreciseAsFileTime(time *Filetime) {
1999	syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
2000	return
2001}
2002
2003func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2004	r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2005	len = uint32(r0)
2006	if len == 0 {
2007		err = errnoErr(e1)
2008	}
2009	return
2010}
2011
2012func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
2013	r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
2014	n = uint32(r0)
2015	if n == 0 {
2016		err = errnoErr(e1)
2017	}
2018	return
2019}
2020
2021func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2022	r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2023	if r1 == 0 {
2024		err = errnoErr(e1)
2025	}
2026	return
2027}
2028
2029func getTickCount64() (ms uint64) {
2030	r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0)
2031	ms = uint64(r0)
2032	return
2033}
2034
2035func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
2036	r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0)
2037	rc = uint32(r0)
2038	if rc == 0xffffffff {
2039		err = errnoErr(e1)
2040	}
2041	return
2042}
2043
2044func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
2045	r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
2046	if r1 == 0 {
2047		err = errnoErr(e1)
2048	}
2049	return
2050}
2051
2052func GetVersion() (ver uint32, err error) {
2053	r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0)
2054	ver = uint32(r0)
2055	if ver == 0 {
2056		err = errnoErr(e1)
2057	}
2058	return
2059}
2060
2061func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
2062	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)
2063	if r1 == 0 {
2064		err = errnoErr(e1)
2065	}
2066	return
2067}
2068
2069func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
2070	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)
2071	if r1 == 0 {
2072		err = errnoErr(e1)
2073	}
2074	return
2075}
2076
2077func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
2078	r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
2079	if r1 == 0 {
2080		err = errnoErr(e1)
2081	}
2082	return
2083}
2084
2085func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) {
2086	r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength))
2087	if r1 == 0 {
2088		err = errnoErr(e1)
2089	}
2090	return
2091}
2092
2093func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) {
2094	r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0)
2095	if r1 == 0 {
2096		err = errnoErr(e1)
2097	}
2098	return
2099}
2100
2101func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
2102	r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
2103	len = uint32(r0)
2104	if len == 0 {
2105		err = errnoErr(e1)
2106	}
2107	return
2108}
2109
2110func IsWow64Process(handle Handle, isWow64 *bool) (err error) {
2111	var _p0 uint32
2112	if *isWow64 {
2113		_p0 = 1
2114	}
2115	r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0)
2116	*isWow64 = _p0 != 0
2117	if r1 == 0 {
2118		err = errnoErr(e1)
2119	}
2120	return
2121}
2122
2123func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) {
2124	err = procIsWow64Process2.Find()
2125	if err != nil {
2126		return
2127	}
2128	r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine)))
2129	if r1 == 0 {
2130		err = errnoErr(e1)
2131	}
2132	return
2133}
2134
2135func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) {
2136	var _p0 *uint16
2137	_p0, err = syscall.UTF16PtrFromString(libname)
2138	if err != nil {
2139		return
2140	}
2141	return _LoadLibraryEx(_p0, zero, flags)
2142}
2143
2144func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) {
2145	r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags))
2146	handle = Handle(r0)
2147	if handle == 0 {
2148		err = errnoErr(e1)
2149	}
2150	return
2151}
2152
2153func LoadLibrary(libname string) (handle Handle, err error) {
2154	var _p0 *uint16
2155	_p0, err = syscall.UTF16PtrFromString(libname)
2156	if err != nil {
2157		return
2158	}
2159	return _LoadLibrary(_p0)
2160}
2161
2162func _LoadLibrary(libname *uint16) (handle Handle, err error) {
2163	r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0)
2164	handle = Handle(r0)
2165	if handle == 0 {
2166		err = errnoErr(e1)
2167	}
2168	return
2169}
2170
2171func LocalFree(hmem Handle) (handle Handle, err error) {
2172	r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0)
2173	handle = Handle(r0)
2174	if handle != 0 {
2175		err = errnoErr(e1)
2176	}
2177	return
2178}
2179
2180func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
2181	r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
2182	if r1 == 0 {
2183		err = errnoErr(e1)
2184	}
2185	return
2186}
2187
2188func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) {
2189	r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
2190	addr = uintptr(r0)
2191	if addr == 0 {
2192		err = errnoErr(e1)
2193	}
2194	return
2195}
2196
2197func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
2198	r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
2199	if r1 == 0 {
2200		err = errnoErr(e1)
2201	}
2202	return
2203}
2204
2205func MoveFile(from *uint16, to *uint16) (err error) {
2206	r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
2207	if r1 == 0 {
2208		err = errnoErr(e1)
2209	}
2210	return
2211}
2212
2213func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
2214	r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
2215	nwrite = int32(r0)
2216	if nwrite == 0 {
2217		err = errnoErr(e1)
2218	}
2219	return
2220}
2221
2222func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2223	var _p0 uint32
2224	if inheritHandle {
2225		_p0 = 1
2226	}
2227	r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2228	handle = Handle(r0)
2229	if handle == 0 {
2230		err = errnoErr(e1)
2231	}
2232	return
2233}
2234
2235func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
2236	var _p0 uint32
2237	if inheritHandle {
2238		_p0 = 1
2239	}
2240	r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
2241	handle = Handle(r0)
2242	if handle == 0 {
2243		err = errnoErr(e1)
2244	}
2245	return
2246}
2247
2248func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) {
2249	var _p0 uint32
2250	if inheritHandle {
2251		_p0 = 1
2252	}
2253	r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId))
2254	handle = Handle(r0)
2255	if handle == 0 {
2256		err = errnoErr(e1)
2257	}
2258	return
2259}
2260
2261func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) {
2262	var _p0 uint32
2263	if inheritHandle {
2264		_p0 = 1
2265	}
2266	r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId))
2267	handle = Handle(r0)
2268	if handle == 0 {
2269		err = errnoErr(e1)
2270	}
2271	return
2272}
2273
2274func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
2275	r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
2276	if r1 == 0 {
2277		err = errnoErr(e1)
2278	}
2279	return
2280}
2281
2282func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2283	r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
2284	if r1 == 0 {
2285		err = errnoErr(e1)
2286	}
2287	return
2288}
2289
2290func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
2291	r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
2292	if r1 == 0 {
2293		err = errnoErr(e1)
2294	}
2295	return
2296}
2297
2298func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) {
2299	r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0)
2300	if r1 == 0 {
2301		err = errnoErr(e1)
2302	}
2303	return
2304}
2305
2306func PulseEvent(event Handle) (err error) {
2307	r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0)
2308	if r1 == 0 {
2309		err = errnoErr(e1)
2310	}
2311	return
2312}
2313
2314func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
2315	r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
2316	n = uint32(r0)
2317	if n == 0 {
2318		err = errnoErr(e1)
2319	}
2320	return
2321}
2322
2323func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) {
2324	r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0)
2325	if r1 == 0 {
2326		err = errnoErr(e1)
2327	}
2328	return
2329}
2330
2331func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) {
2332	r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0)
2333	if r1 == 0 {
2334		err = errnoErr(e1)
2335	}
2336	return
2337}
2338
2339func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
2340	var _p0 uint32
2341	if watchSubTree {
2342		_p0 = 1
2343	}
2344	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)
2345	if r1 == 0 {
2346		err = errnoErr(e1)
2347	}
2348	return
2349}
2350
2351func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
2352	var _p0 *byte
2353	if len(buf) > 0 {
2354		_p0 = &buf[0]
2355	}
2356	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)
2357	if r1 == 0 {
2358		err = errnoErr(e1)
2359	}
2360	return
2361}
2362
2363func ReleaseMutex(mutex Handle) (err error) {
2364	r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0)
2365	if r1 == 0 {
2366		err = errnoErr(e1)
2367	}
2368	return
2369}
2370
2371func RemoveDirectory(path *uint16) (err error) {
2372	r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
2373	if r1 == 0 {
2374		err = errnoErr(e1)
2375	}
2376	return
2377}
2378
2379func ResetEvent(event Handle) (err error) {
2380	r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
2381	if r1 == 0 {
2382		err = errnoErr(e1)
2383	}
2384	return
2385}
2386
2387func ResumeThread(thread Handle) (ret uint32, err error) {
2388	r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0)
2389	ret = uint32(r0)
2390	if ret == 0xffffffff {
2391		err = errnoErr(e1)
2392	}
2393	return
2394}
2395
2396func setConsoleCursorPosition(console Handle, position uint32) (err error) {
2397	r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0)
2398	if r1 == 0 {
2399		err = errnoErr(e1)
2400	}
2401	return
2402}
2403
2404func SetConsoleMode(console Handle, mode uint32) (err error) {
2405	r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0)
2406	if r1 == 0 {
2407		err = errnoErr(e1)
2408	}
2409	return
2410}
2411
2412func SetCurrentDirectory(path *uint16) (err error) {
2413	r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
2414	if r1 == 0 {
2415		err = errnoErr(e1)
2416	}
2417	return
2418}
2419
2420func SetDefaultDllDirectories(directoryFlags uint32) (err error) {
2421	r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0)
2422	if r1 == 0 {
2423		err = errnoErr(e1)
2424	}
2425	return
2426}
2427
2428func SetDllDirectory(path string) (err error) {
2429	var _p0 *uint16
2430	_p0, err = syscall.UTF16PtrFromString(path)
2431	if err != nil {
2432		return
2433	}
2434	return _SetDllDirectory(_p0)
2435}
2436
2437func _SetDllDirectory(path *uint16) (err error) {
2438	r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
2439	if r1 == 0 {
2440		err = errnoErr(e1)
2441	}
2442	return
2443}
2444
2445func SetEndOfFile(handle Handle) (err error) {
2446	r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
2447	if r1 == 0 {
2448		err = errnoErr(e1)
2449	}
2450	return
2451}
2452
2453func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
2454	r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
2455	if r1 == 0 {
2456		err = errnoErr(e1)
2457	}
2458	return
2459}
2460
2461func SetErrorMode(mode uint32) (ret uint32) {
2462	r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0)
2463	ret = uint32(r0)
2464	return
2465}
2466
2467func SetEvent(event Handle) (err error) {
2468	r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0)
2469	if r1 == 0 {
2470		err = errnoErr(e1)
2471	}
2472	return
2473}
2474
2475func SetFileAttributes(name *uint16, attrs uint32) (err error) {
2476	r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
2477	if r1 == 0 {
2478		err = errnoErr(e1)
2479	}
2480	return
2481}
2482
2483func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) {
2484	r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0)
2485	if r1 == 0 {
2486		err = errnoErr(e1)
2487	}
2488	return
2489}
2490
2491func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) {
2492	r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0)
2493	if r1 == 0 {
2494		err = errnoErr(e1)
2495	}
2496	return
2497}
2498
2499func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
2500	r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
2501	newlowoffset = uint32(r0)
2502	if newlowoffset == 0xffffffff {
2503		err = errnoErr(e1)
2504	}
2505	return
2506}
2507
2508func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
2509	r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
2510	if r1 == 0 {
2511		err = errnoErr(e1)
2512	}
2513	return
2514}
2515
2516func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
2517	r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
2518	if r1 == 0 {
2519		err = errnoErr(e1)
2520	}
2521	return
2522}
2523
2524func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
2525	r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
2526	ret = int(r0)
2527	if ret == 0 {
2528		err = errnoErr(e1)
2529	}
2530	return
2531}
2532
2533func SetPriorityClass(process Handle, priorityClass uint32) (err error) {
2534	r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0)
2535	if r1 == 0 {
2536		err = errnoErr(e1)
2537	}
2538	return
2539}
2540
2541func SetProcessPriorityBoost(process Handle, disable bool) (err error) {
2542	var _p0 uint32
2543	if disable {
2544		_p0 = 1
2545	}
2546	r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0)
2547	if r1 == 0 {
2548		err = errnoErr(e1)
2549	}
2550	return
2551}
2552
2553func SetProcessShutdownParameters(level uint32, flags uint32) (err error) {
2554	r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0)
2555	if r1 == 0 {
2556		err = errnoErr(e1)
2557	}
2558	return
2559}
2560
2561func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) {
2562	r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0)
2563	if r1 == 0 {
2564		err = errnoErr(e1)
2565	}
2566	return
2567}
2568
2569func SetStdHandle(stdhandle uint32, handle Handle) (err error) {
2570	r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0)
2571	if r1 == 0 {
2572		err = errnoErr(e1)
2573	}
2574	return
2575}
2576
2577func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) {
2578	r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0)
2579	if r1 == 0 {
2580		err = errnoErr(e1)
2581	}
2582	return
2583}
2584
2585func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) {
2586	r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0)
2587	if r1 == 0 {
2588		err = errnoErr(e1)
2589	}
2590	return
2591}
2592
2593func SleepEx(milliseconds uint32, alertable bool) (ret uint32) {
2594	var _p0 uint32
2595	if alertable {
2596		_p0 = 1
2597	}
2598	r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0)
2599	ret = uint32(r0)
2600	return
2601}
2602
2603func TerminateJobObject(job Handle, exitCode uint32) (err error) {
2604	r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0)
2605	if r1 == 0 {
2606		err = errnoErr(e1)
2607	}
2608	return
2609}
2610
2611func TerminateProcess(handle Handle, exitcode uint32) (err error) {
2612	r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
2613	if r1 == 0 {
2614		err = errnoErr(e1)
2615	}
2616	return
2617}
2618
2619func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
2620	r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
2621	if r1 == 0 {
2622		err = errnoErr(e1)
2623	}
2624	return
2625}
2626
2627func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
2628	r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
2629	if r1 == 0 {
2630		err = errnoErr(e1)
2631	}
2632	return
2633}
2634
2635func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
2636	r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0)
2637	if r1 == 0 {
2638		err = errnoErr(e1)
2639	}
2640	return
2641}
2642
2643func UnmapViewOfFile(addr uintptr) (err error) {
2644	r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
2645	if r1 == 0 {
2646		err = errnoErr(e1)
2647	}
2648	return
2649}
2650
2651func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) {
2652	r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0)
2653	value = uintptr(r0)
2654	if value == 0 {
2655		err = errnoErr(e1)
2656	}
2657	return
2658}
2659
2660func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) {
2661	r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype))
2662	if r1 == 0 {
2663		err = errnoErr(e1)
2664	}
2665	return
2666}
2667
2668func VirtualLock(addr uintptr, length uintptr) (err error) {
2669	r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
2670	if r1 == 0 {
2671		err = errnoErr(e1)
2672	}
2673	return
2674}
2675
2676func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) {
2677	r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0)
2678	if r1 == 0 {
2679		err = errnoErr(e1)
2680	}
2681	return
2682}
2683
2684func VirtualUnlock(addr uintptr, length uintptr) (err error) {
2685	r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
2686	if r1 == 0 {
2687		err = errnoErr(e1)
2688	}
2689	return
2690}
2691
2692func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
2693	var _p0 uint32
2694	if waitAll {
2695		_p0 = 1
2696	}
2697	r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0)
2698	event = uint32(r0)
2699	if event == 0xffffffff {
2700		err = errnoErr(e1)
2701	}
2702	return
2703}
2704
2705func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) {
2706	r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0)
2707	event = uint32(r0)
2708	if event == 0xffffffff {
2709		err = errnoErr(e1)
2710	}
2711	return
2712}
2713
2714func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
2715	r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
2716	if r1 == 0 {
2717		err = errnoErr(e1)
2718	}
2719	return
2720}
2721
2722func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
2723	var _p0 *byte
2724	if len(buf) > 0 {
2725		_p0 = &buf[0]
2726	}
2727	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)
2728	if r1 == 0 {
2729		err = errnoErr(e1)
2730	}
2731	return
2732}
2733
2734func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
2735	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)
2736	if r1 == 0 {
2737		err = errnoErr(e1)
2738	}
2739	return
2740}
2741
2742func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) {
2743	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)
2744	return
2745}
2746
2747func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
2748	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)
2749	if r1 == 0 {
2750		err = errnoErr(e1)
2751	}
2752	return
2753}
2754
2755func NetApiBufferFree(buf *byte) (neterr error) {
2756	r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0)
2757	if r0 != 0 {
2758		neterr = syscall.Errno(r0)
2759	}
2760	return
2761}
2762
2763func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) {
2764	r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType)))
2765	if r0 != 0 {
2766		neterr = syscall.Errno(r0)
2767	}
2768	return
2769}
2770
2771func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
2772	r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
2773	if r0 != 0 {
2774		neterr = syscall.Errno(r0)
2775	}
2776	return
2777}
2778
2779func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) {
2780	syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber)))
2781	return
2782}
2783
2784func rtlGetVersion(info *OsVersionInfoEx) (ret error) {
2785	r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0)
2786	if r0 != 0 {
2787		ret = syscall.Errno(r0)
2788	}
2789	return
2790}
2791
2792func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) {
2793	r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
2794	if r0 != 0 {
2795		ret = syscall.Errno(r0)
2796	}
2797	return
2798}
2799
2800func coCreateGuid(pguid *GUID) (ret error) {
2801	r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0)
2802	if r0 != 0 {
2803		ret = syscall.Errno(r0)
2804	}
2805	return
2806}
2807
2808func CoTaskMemFree(address unsafe.Pointer) {
2809	syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0)
2810	return
2811}
2812
2813func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) {
2814	r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax))
2815	chars = int32(r0)
2816	return
2817}
2818
2819func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) {
2820	var _p0 *uint32
2821	if len(processIds) > 0 {
2822		_p0 = &processIds[0]
2823	}
2824	r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned)))
2825	if r1 == 0 {
2826		err = errnoErr(e1)
2827	}
2828	return
2829}
2830
2831func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) {
2832	ret = procSubscribeServiceChangeNotifications.Find()
2833	if ret != nil {
2834		return
2835	}
2836	r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0)
2837	if r0 != 0 {
2838		ret = syscall.Errno(r0)
2839	}
2840	return
2841}
2842
2843func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) {
2844	err = procUnsubscribeServiceChangeNotifications.Find()
2845	if err != nil {
2846		return
2847	}
2848	syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0)
2849	return
2850}
2851
2852func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
2853	r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
2854	if r1&0xff == 0 {
2855		err = errnoErr(e1)
2856	}
2857	return
2858}
2859
2860func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
2861	r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
2862	if r1&0xff == 0 {
2863		err = errnoErr(e1)
2864	}
2865	return
2866}
2867
2868func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
2869	r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0)
2870	argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0))
2871	if argv == nil {
2872		err = errnoErr(e1)
2873	}
2874	return
2875}
2876
2877func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) {
2878	r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0)
2879	if r0 != 0 {
2880		ret = syscall.Errno(r0)
2881	}
2882	return
2883}
2884
2885func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) {
2886	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))
2887	if r1 <= 32 {
2888		err = errnoErr(e1)
2889	}
2890	return
2891}
2892
2893func ExitWindowsEx(flags uint32, reason uint32) (err error) {
2894	r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
2895	if r1 == 0 {
2896		err = errnoErr(e1)
2897	}
2898	return
2899}
2900
2901func GetShellWindow() (desktopWindow uintptr) {
2902	r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0)
2903	desktopWindow = uintptr(r0)
2904	return
2905}
2906
2907func GetWindowThreadProcessId(wnd uintptr, pid *uint32) (tid uint32) {
2908	r0, _, _ := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(wnd), uintptr(unsafe.Pointer(pid)), 0)
2909	tid = uint32(r0)
2910	return
2911}
2912
2913func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
2914	r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
2915	ret = int32(r0)
2916	if ret == 0 {
2917		err = errnoErr(e1)
2918	}
2919	return
2920}
2921
2922func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) {
2923	var _p0 uint32
2924	if inheritExisting {
2925		_p0 = 1
2926	}
2927	r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
2928	if r1 == 0 {
2929		err = errnoErr(e1)
2930	}
2931	return
2932}
2933
2934func DestroyEnvironmentBlock(block *uint16) (err error) {
2935	r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
2936	if r1 == 0 {
2937		err = errnoErr(e1)
2938	}
2939	return
2940}
2941
2942func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
2943	r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
2944	if r1 == 0 {
2945		err = errnoErr(e1)
2946	}
2947	return
2948}
2949
2950func FreeAddrInfoW(addrinfo *AddrinfoW) {
2951	syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
2952	return
2953}
2954
2955func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) {
2956	r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0)
2957	if r0 != 0 {
2958		sockerr = syscall.Errno(r0)
2959	}
2960	return
2961}
2962
2963func WSACleanup() (err error) {
2964	r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
2965	if r1 == socket_error {
2966		err = errnoErr(e1)
2967	}
2968	return
2969}
2970
2971func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) {
2972	r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength)))
2973	n = int32(r0)
2974	if n == -1 {
2975		err = errnoErr(e1)
2976	}
2977	return
2978}
2979
2980func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
2981	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))
2982	if r1 == socket_error {
2983		err = errnoErr(e1)
2984	}
2985	return
2986}
2987
2988func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
2989	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)
2990	if r1 == socket_error {
2991		err = errnoErr(e1)
2992	}
2993	return
2994}
2995
2996func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
2997	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)))
2998	if r1 == socket_error {
2999		err = errnoErr(e1)
3000	}
3001	return
3002}
3003
3004func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
3005	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)
3006	if r1 == socket_error {
3007		err = errnoErr(e1)
3008	}
3009	return
3010}
3011
3012func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
3013	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)))
3014	if r1 == socket_error {
3015		err = errnoErr(e1)
3016	}
3017	return
3018}
3019
3020func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
3021	r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
3022	if r0 != 0 {
3023		sockerr = syscall.Errno(r0)
3024	}
3025	return
3026}
3027
3028func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
3029	r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
3030	if r1 == socket_error {
3031		err = errnoErr(e1)
3032	}
3033	return
3034}
3035
3036func Closesocket(s Handle) (err error) {
3037	r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
3038	if r1 == socket_error {
3039		err = errnoErr(e1)
3040	}
3041	return
3042}
3043
3044func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
3045	r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
3046	if r1 == socket_error {
3047		err = errnoErr(e1)
3048	}
3049	return
3050}
3051
3052func GetHostByName(name string) (h *Hostent, err error) {
3053	var _p0 *byte
3054	_p0, err = syscall.BytePtrFromString(name)
3055	if err != nil {
3056		return
3057	}
3058	return _GetHostByName(_p0)
3059}
3060
3061func _GetHostByName(name *byte) (h *Hostent, err error) {
3062	r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
3063	h = (*Hostent)(unsafe.Pointer(r0))
3064	if h == nil {
3065		err = errnoErr(e1)
3066	}
3067	return
3068}
3069
3070func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
3071	r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
3072	if r1 == socket_error {
3073		err = errnoErr(e1)
3074	}
3075	return
3076}
3077
3078func GetProtoByName(name string) (p *Protoent, err error) {
3079	var _p0 *byte
3080	_p0, err = syscall.BytePtrFromString(name)
3081	if err != nil {
3082		return
3083	}
3084	return _GetProtoByName(_p0)
3085}
3086
3087func _GetProtoByName(name *byte) (p *Protoent, err error) {
3088	r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
3089	p = (*Protoent)(unsafe.Pointer(r0))
3090	if p == nil {
3091		err = errnoErr(e1)
3092	}
3093	return
3094}
3095
3096func GetServByName(name string, proto string) (s *Servent, err error) {
3097	var _p0 *byte
3098	_p0, err = syscall.BytePtrFromString(name)
3099	if err != nil {
3100		return
3101	}
3102	var _p1 *byte
3103	_p1, err = syscall.BytePtrFromString(proto)
3104	if err != nil {
3105		return
3106	}
3107	return _GetServByName(_p0, _p1)
3108}
3109
3110func _GetServByName(name *byte, proto *byte) (s *Servent, err error) {
3111	r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0)
3112	s = (*Servent)(unsafe.Pointer(r0))
3113	if s == nil {
3114		err = errnoErr(e1)
3115	}
3116	return
3117}
3118
3119func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
3120	r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
3121	if r1 == socket_error {
3122		err = errnoErr(e1)
3123	}
3124	return
3125}
3126
3127func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
3128	r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
3129	if r1 == socket_error {
3130		err = errnoErr(e1)
3131	}
3132	return
3133}
3134
3135func listen(s Handle, backlog int32) (err error) {
3136	r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
3137	if r1 == socket_error {
3138		err = errnoErr(e1)
3139	}
3140	return
3141}
3142
3143func Ntohs(netshort uint16) (u uint16) {
3144	r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0)
3145	u = uint16(r0)
3146	return
3147}
3148
3149func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) {
3150	var _p0 *byte
3151	if len(buf) > 0 {
3152		_p0 = &buf[0]
3153	}
3154	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)))
3155	n = int32(r0)
3156	if n == -1 {
3157		err = errnoErr(e1)
3158	}
3159	return
3160}
3161
3162func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) {
3163	var _p0 *byte
3164	if len(buf) > 0 {
3165		_p0 = &buf[0]
3166	}
3167	r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen))
3168	if r1 == socket_error {
3169		err = errnoErr(e1)
3170	}
3171	return
3172}
3173
3174func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
3175	r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
3176	if r1 == socket_error {
3177		err = errnoErr(e1)
3178	}
3179	return
3180}
3181
3182func shutdown(s Handle, how int32) (err error) {
3183	r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
3184	if r1 == socket_error {
3185		err = errnoErr(e1)
3186	}
3187	return
3188}
3189
3190func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
3191	r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol))
3192	handle = Handle(r0)
3193	if handle == InvalidHandle {
3194		err = errnoErr(e1)
3195	}
3196	return
3197}
3198
3199func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) {
3200	r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0)
3201	if r1 == 0 {
3202		err = errnoErr(e1)
3203	}
3204	return
3205}
3206
3207func WTSFreeMemory(ptr uintptr) {
3208	syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0)
3209	return
3210}
3211
3212func WTSQueryUserToken(session uint32, token *Token) (err error) {
3213	r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0)
3214	if r1 == 0 {
3215		err = errnoErr(e1)
3216	}
3217	return
3218}
3219