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