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