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