Source file src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go

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

View as plain text