github.com/xingly-cn/shorturl-go@v0.0.0-20220110130535-e21de4659f74/pkg/mod/golang.org/x/sys@v0.0.0-20200323222414-85ca7c5b95cd/windows/zsyscall_windows.go (about)

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