zorldo

Goofing around with Ebiten
git clone git://bsandro.tech/zorldo
Log | Files | Refs | README

zsyscall_windows.go (159658B)


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