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