...

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

Documentation: cmd/vendor/golang.org/x/sys/windows

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

View as plain text