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