github.com/giovannyortegon/go@v0.0.0-20220115155912-8890063f5bdd/src/pkg/mod/golang.org/x/sys@v0.0.0-20210927094055-39ccf1dd6fa6/windows/zsyscall_windows.go (about)

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