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