github.com/HACKERALERT/Picocrypt/src/external/sys@v0.0.0-20210609020157-e519952f829f/windows/zsyscall_windows.go (about) 1 // Code generated by 'go generate'; DO NOT EDIT. 2 3 package windows 4 5 import ( 6 "syscall" 7 "unsafe" 8 ) 9 10 var _ unsafe.Pointer 11 12 // Do the interface allocations only once for common 13 // Errno values. 14 const ( 15 errnoERROR_IO_PENDING = 997 16 ) 17 18 var ( 19 errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) 20 errERROR_EINVAL error = syscall.EINVAL 21 ) 22 23 // errnoErr returns common boxed Errno values, to prevent 24 // allocations at runtime. 25 func errnoErr(e syscall.Errno) error { 26 switch e { 27 case 0: 28 return errERROR_EINVAL 29 case errnoERROR_IO_PENDING: 30 return errERROR_IO_PENDING 31 } 32 // TODO: add more here, after collecting data on the common 33 // error values see on Windows. (perhaps when running 34 // all.bat?) 35 return e 36 } 37 38 var ( 39 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 procCreateProcessAsUserW = modadvapi32.NewProc("CreateProcessAsUserW") 73 procCreateServiceW = modadvapi32.NewProc("CreateServiceW") 74 procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid") 75 procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW") 76 procCryptGenRandom = modadvapi32.NewProc("CryptGenRandom") 77 procCryptReleaseContext = modadvapi32.NewProc("CryptReleaseContext") 78 procDeleteService = modadvapi32.NewProc("DeleteService") 79 procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource") 80 procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx") 81 procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") 82 procEqualSid = modadvapi32.NewProc("EqualSid") 83 procFreeSid = modadvapi32.NewProc("FreeSid") 84 procGetLengthSid = modadvapi32.NewProc("GetLengthSid") 85 procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW") 86 procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl") 87 procGetSecurityDescriptorDacl = modadvapi32.NewProc("GetSecurityDescriptorDacl") 88 procGetSecurityDescriptorGroup = modadvapi32.NewProc("GetSecurityDescriptorGroup") 89 procGetSecurityDescriptorLength = modadvapi32.NewProc("GetSecurityDescriptorLength") 90 procGetSecurityDescriptorOwner = modadvapi32.NewProc("GetSecurityDescriptorOwner") 91 procGetSecurityDescriptorRMControl = modadvapi32.NewProc("GetSecurityDescriptorRMControl") 92 procGetSecurityDescriptorSacl = modadvapi32.NewProc("GetSecurityDescriptorSacl") 93 procGetSecurityInfo = modadvapi32.NewProc("GetSecurityInfo") 94 procGetSidIdentifierAuthority = modadvapi32.NewProc("GetSidIdentifierAuthority") 95 procGetSidSubAuthority = modadvapi32.NewProc("GetSidSubAuthority") 96 procGetSidSubAuthorityCount = modadvapi32.NewProc("GetSidSubAuthorityCount") 97 procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation") 98 procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf") 99 procInitializeSecurityDescriptor = modadvapi32.NewProc("InitializeSecurityDescriptor") 100 procInitiateSystemShutdownExW = modadvapi32.NewProc("InitiateSystemShutdownExW") 101 procIsTokenRestricted = modadvapi32.NewProc("IsTokenRestricted") 102 procIsValidSecurityDescriptor = modadvapi32.NewProc("IsValidSecurityDescriptor") 103 procIsValidSid = modadvapi32.NewProc("IsValidSid") 104 procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid") 105 procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW") 106 procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW") 107 procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") 108 procMakeAbsoluteSD = modadvapi32.NewProc("MakeAbsoluteSD") 109 procMakeSelfRelativeSD = modadvapi32.NewProc("MakeSelfRelativeSD") 110 procNotifyServiceStatusChangeW = modadvapi32.NewProc("NotifyServiceStatusChangeW") 111 procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken") 112 procOpenSCManagerW = modadvapi32.NewProc("OpenSCManagerW") 113 procOpenServiceW = modadvapi32.NewProc("OpenServiceW") 114 procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") 115 procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W") 116 procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW") 117 procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW") 118 procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus") 119 procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx") 120 procRegCloseKey = modadvapi32.NewProc("RegCloseKey") 121 procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW") 122 procRegNotifyChangeKeyValue = modadvapi32.NewProc("RegNotifyChangeKeyValue") 123 procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW") 124 procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW") 125 procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW") 126 procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW") 127 procReportEventW = modadvapi32.NewProc("ReportEventW") 128 procRevertToSelf = modadvapi32.NewProc("RevertToSelf") 129 procSetEntriesInAclW = modadvapi32.NewProc("SetEntriesInAclW") 130 procSetKernelObjectSecurity = modadvapi32.NewProc("SetKernelObjectSecurity") 131 procSetNamedSecurityInfoW = modadvapi32.NewProc("SetNamedSecurityInfoW") 132 procSetSecurityDescriptorControl = modadvapi32.NewProc("SetSecurityDescriptorControl") 133 procSetSecurityDescriptorDacl = modadvapi32.NewProc("SetSecurityDescriptorDacl") 134 procSetSecurityDescriptorGroup = modadvapi32.NewProc("SetSecurityDescriptorGroup") 135 procSetSecurityDescriptorOwner = modadvapi32.NewProc("SetSecurityDescriptorOwner") 136 procSetSecurityDescriptorRMControl = modadvapi32.NewProc("SetSecurityDescriptorRMControl") 137 procSetSecurityDescriptorSacl = modadvapi32.NewProc("SetSecurityDescriptorSacl") 138 procSetSecurityInfo = modadvapi32.NewProc("SetSecurityInfo") 139 procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus") 140 procSetThreadToken = modadvapi32.NewProc("SetThreadToken") 141 procSetTokenInformation = modadvapi32.NewProc("SetTokenInformation") 142 procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW") 143 procStartServiceW = modadvapi32.NewProc("StartServiceW") 144 procCertAddCertificateContextToStore = modcrypt32.NewProc("CertAddCertificateContextToStore") 145 procCertCloseStore = modcrypt32.NewProc("CertCloseStore") 146 procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext") 147 procCertDeleteCertificateFromStore = modcrypt32.NewProc("CertDeleteCertificateFromStore") 148 procCertDuplicateCertificateContext = modcrypt32.NewProc("CertDuplicateCertificateContext") 149 procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore") 150 procCertFindCertificateInStore = modcrypt32.NewProc("CertFindCertificateInStore") 151 procCertFindChainInStore = modcrypt32.NewProc("CertFindChainInStore") 152 procCertFindExtension = modcrypt32.NewProc("CertFindExtension") 153 procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain") 154 procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext") 155 procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain") 156 procCertGetNameStringW = modcrypt32.NewProc("CertGetNameStringW") 157 procCertOpenStore = modcrypt32.NewProc("CertOpenStore") 158 procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW") 159 procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy") 160 procCryptAcquireCertificatePrivateKey = modcrypt32.NewProc("CryptAcquireCertificatePrivateKey") 161 procCryptDecodeObject = modcrypt32.NewProc("CryptDecodeObject") 162 procCryptProtectData = modcrypt32.NewProc("CryptProtectData") 163 procCryptQueryObject = modcrypt32.NewProc("CryptQueryObject") 164 procCryptUnprotectData = modcrypt32.NewProc("CryptUnprotectData") 165 procPFXImportCertStore = modcrypt32.NewProc("PFXImportCertStore") 166 procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W") 167 procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W") 168 procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree") 169 procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses") 170 procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") 171 procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") 172 procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") 173 procCancelIo = modkernel32.NewProc("CancelIo") 174 procCancelIoEx = modkernel32.NewProc("CancelIoEx") 175 procCloseHandle = modkernel32.NewProc("CloseHandle") 176 procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") 177 procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW") 178 procCreateEventExW = modkernel32.NewProc("CreateEventExW") 179 procCreateEventW = modkernel32.NewProc("CreateEventW") 180 procCreateFileMappingW = modkernel32.NewProc("CreateFileMappingW") 181 procCreateFileW = modkernel32.NewProc("CreateFileW") 182 procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW") 183 procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") 184 procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW") 185 procCreateMutexExW = modkernel32.NewProc("CreateMutexExW") 186 procCreateMutexW = modkernel32.NewProc("CreateMutexW") 187 procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW") 188 procCreatePipe = modkernel32.NewProc("CreatePipe") 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 428 func 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 440 func 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 452 func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { 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 460 func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) { 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 468 func 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 476 func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) { 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 484 func 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 492 func 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 500 func 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 508 func 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 516 func 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 524 func 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 533 func _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 541 func 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 549 func 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 557 func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { 558 var _p0 uint32 559 if inheritHandles { 560 _p0 = 1 561 } 562 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) 563 if r1 == 0 { 564 err = errnoErr(e1) 565 } 566 return 567 } 568 569 func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) { 570 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) 571 handle = Handle(r0) 572 if handle == 0 { 573 err = errnoErr(e1) 574 } 575 return 576 } 577 578 func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { 579 r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0) 580 if r1 == 0 { 581 err = errnoErr(e1) 582 } 583 return 584 } 585 586 func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { 587 r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) 588 if r1 == 0 { 589 err = errnoErr(e1) 590 } 591 return 592 } 593 594 func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { 595 r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) 596 if r1 == 0 { 597 err = errnoErr(e1) 598 } 599 return 600 } 601 602 func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { 603 r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) 604 if r1 == 0 { 605 err = errnoErr(e1) 606 } 607 return 608 } 609 610 func DeleteService(service Handle) (err error) { 611 r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0) 612 if r1 == 0 { 613 err = errnoErr(e1) 614 } 615 return 616 } 617 618 func DeregisterEventSource(handle Handle) (err error) { 619 r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0) 620 if r1 == 0 { 621 err = errnoErr(e1) 622 } 623 return 624 } 625 626 func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { 627 r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) 628 if r1 == 0 { 629 err = errnoErr(e1) 630 } 631 return 632 } 633 634 func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { 635 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) 636 if r1 == 0 { 637 err = errnoErr(e1) 638 } 639 return 640 } 641 642 func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { 643 r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0) 644 isEqual = r0 != 0 645 return 646 } 647 648 func FreeSid(sid *SID) (err error) { 649 r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) 650 if r1 != 0 { 651 err = errnoErr(e1) 652 } 653 return 654 } 655 656 func GetLengthSid(sid *SID) (len uint32) { 657 r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) 658 len = uint32(r0) 659 return 660 } 661 662 func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { 663 var _p0 *uint16 664 _p0, ret = syscall.UTF16PtrFromString(objectName) 665 if ret != nil { 666 return 667 } 668 return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd) 669 } 670 671 func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { 672 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) 673 if r0 != 0 { 674 ret = syscall.Errno(r0) 675 } 676 return 677 } 678 679 func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) { 680 r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) 681 if r1 == 0 { 682 err = errnoErr(e1) 683 } 684 return 685 } 686 687 func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) { 688 var _p0 uint32 689 if *daclPresent { 690 _p0 = 1 691 } 692 var _p1 uint32 693 if *daclDefaulted { 694 _p1 = 1 695 } 696 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) 697 *daclPresent = _p0 != 0 698 *daclDefaulted = _p1 != 0 699 if r1 == 0 { 700 err = errnoErr(e1) 701 } 702 return 703 } 704 705 func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) { 706 var _p0 uint32 707 if *groupDefaulted { 708 _p0 = 1 709 } 710 r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) 711 *groupDefaulted = _p0 != 0 712 if r1 == 0 { 713 err = errnoErr(e1) 714 } 715 return 716 } 717 718 func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) { 719 r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) 720 len = uint32(r0) 721 return 722 } 723 724 func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) { 725 var _p0 uint32 726 if *ownerDefaulted { 727 _p0 = 1 728 } 729 r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) 730 *ownerDefaulted = _p0 != 0 731 if r1 == 0 { 732 err = errnoErr(e1) 733 } 734 return 735 } 736 737 func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) { 738 r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) 739 if r0 != 0 { 740 ret = syscall.Errno(r0) 741 } 742 return 743 } 744 745 func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) { 746 var _p0 uint32 747 if *saclPresent { 748 _p0 = 1 749 } 750 var _p1 uint32 751 if *saclDefaulted { 752 _p1 = 1 753 } 754 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) 755 *saclPresent = _p0 != 0 756 *saclDefaulted = _p1 != 0 757 if r1 == 0 { 758 err = errnoErr(e1) 759 } 760 return 761 } 762 763 func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { 764 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) 765 if r0 != 0 { 766 ret = syscall.Errno(r0) 767 } 768 return 769 } 770 771 func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { 772 r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) 773 authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) 774 return 775 } 776 777 func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { 778 r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0) 779 subAuthority = (*uint32)(unsafe.Pointer(r0)) 780 return 781 } 782 783 func getSidSubAuthorityCount(sid *SID) (count *uint8) { 784 r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) 785 count = (*uint8)(unsafe.Pointer(r0)) 786 return 787 } 788 789 func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { 790 r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) 791 if r1 == 0 { 792 err = errnoErr(e1) 793 } 794 return 795 } 796 797 func ImpersonateSelf(impersonationlevel uint32) (err error) { 798 r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) 799 if r1 == 0 { 800 err = errnoErr(e1) 801 } 802 return 803 } 804 805 func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) { 806 r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0) 807 if r1 == 0 { 808 err = errnoErr(e1) 809 } 810 return 811 } 812 813 func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) { 814 var _p0 uint32 815 if forceAppsClosed { 816 _p0 = 1 817 } 818 var _p1 uint32 819 if rebootAfterShutdown { 820 _p1 = 1 821 } 822 r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) 823 if r1 == 0 { 824 err = errnoErr(e1) 825 } 826 return 827 } 828 829 func isTokenRestricted(tokenHandle Token) (ret bool, err error) { 830 r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0) 831 ret = r0 != 0 832 if !ret { 833 err = errnoErr(e1) 834 } 835 return 836 } 837 838 func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) { 839 r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) 840 isValid = r0 != 0 841 return 842 } 843 844 func isValidSid(sid *SID) (isValid bool) { 845 r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) 846 isValid = r0 != 0 847 return 848 } 849 850 func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { 851 r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0) 852 isWellKnown = r0 != 0 853 return 854 } 855 856 func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { 857 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) 858 if r1 == 0 { 859 err = errnoErr(e1) 860 } 861 return 862 } 863 864 func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { 865 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) 866 if r1 == 0 { 867 err = errnoErr(e1) 868 } 869 return 870 } 871 872 func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { 873 r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) 874 if r1 == 0 { 875 err = errnoErr(e1) 876 } 877 return 878 } 879 880 func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) { 881 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) 882 if r1 == 0 { 883 err = errnoErr(e1) 884 } 885 return 886 } 887 888 func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) { 889 r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) 890 if r1 == 0 { 891 err = errnoErr(e1) 892 } 893 return 894 } 895 896 func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) { 897 r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) 898 if r0 != 0 { 899 ret = syscall.Errno(r0) 900 } 901 return 902 } 903 904 func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { 905 r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) 906 if r1 == 0 { 907 err = errnoErr(e1) 908 } 909 return 910 } 911 912 func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) { 913 r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) 914 handle = Handle(r0) 915 if handle == 0 { 916 err = errnoErr(e1) 917 } 918 return 919 } 920 921 func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) { 922 r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) 923 handle = Handle(r0) 924 if handle == 0 { 925 err = errnoErr(e1) 926 } 927 return 928 } 929 930 func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) { 931 var _p0 uint32 932 if openAsSelf { 933 _p0 = 1 934 } 935 r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) 936 if r1 == 0 { 937 err = errnoErr(e1) 938 } 939 return 940 } 941 942 func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { 943 r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) 944 if r1 == 0 { 945 err = errnoErr(e1) 946 } 947 return 948 } 949 950 func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) { 951 r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) 952 if r1 == 0 { 953 err = errnoErr(e1) 954 } 955 return 956 } 957 958 func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { 959 r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) 960 if r1 == 0 { 961 err = errnoErr(e1) 962 } 963 return 964 } 965 966 func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { 967 r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0) 968 if r1 == 0 { 969 err = errnoErr(e1) 970 } 971 return 972 } 973 974 func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { 975 r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) 976 if r1 == 0 { 977 err = errnoErr(e1) 978 } 979 return 980 } 981 982 func RegCloseKey(key Handle) (regerrno error) { 983 r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) 984 if r0 != 0 { 985 regerrno = syscall.Errno(r0) 986 } 987 return 988 } 989 990 func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { 991 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) 992 if r0 != 0 { 993 regerrno = syscall.Errno(r0) 994 } 995 return 996 } 997 998 func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) { 999 var _p0 uint32 1000 if watchSubtree { 1001 _p0 = 1 1002 } 1003 var _p1 uint32 1004 if asynchronous { 1005 _p1 = 1 1006 } 1007 r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0) 1008 if r0 != 0 { 1009 regerrno = syscall.Errno(r0) 1010 } 1011 return 1012 } 1013 1014 func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { 1015 r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) 1016 if r0 != 0 { 1017 regerrno = syscall.Errno(r0) 1018 } 1019 return 1020 } 1021 1022 func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { 1023 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))) 1024 if r0 != 0 { 1025 regerrno = syscall.Errno(r0) 1026 } 1027 return 1028 } 1029 1030 func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { 1031 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))) 1032 if r0 != 0 { 1033 regerrno = syscall.Errno(r0) 1034 } 1035 return 1036 } 1037 1038 func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { 1039 r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0) 1040 handle = Handle(r0) 1041 if handle == 0 { 1042 err = errnoErr(e1) 1043 } 1044 return 1045 } 1046 1047 func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) { 1048 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))) 1049 if r1 == 0 { 1050 err = errnoErr(e1) 1051 } 1052 return 1053 } 1054 1055 func RevertToSelf() (err error) { 1056 r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) 1057 if r1 == 0 { 1058 err = errnoErr(e1) 1059 } 1060 return 1061 } 1062 1063 func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) { 1064 r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0) 1065 if r0 != 0 { 1066 ret = syscall.Errno(r0) 1067 } 1068 return 1069 } 1070 1071 func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { 1072 r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) 1073 if r1 == 0 { 1074 err = errnoErr(e1) 1075 } 1076 return 1077 } 1078 1079 func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { 1080 var _p0 *uint16 1081 _p0, ret = syscall.UTF16PtrFromString(objectName) 1082 if ret != nil { 1083 return 1084 } 1085 return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl) 1086 } 1087 1088 func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { 1089 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) 1090 if r0 != 0 { 1091 ret = syscall.Errno(r0) 1092 } 1093 return 1094 } 1095 1096 func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) { 1097 r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) 1098 if r1 == 0 { 1099 err = errnoErr(e1) 1100 } 1101 return 1102 } 1103 1104 func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) { 1105 var _p0 uint32 1106 if daclPresent { 1107 _p0 = 1 1108 } 1109 var _p1 uint32 1110 if daclDefaulted { 1111 _p1 = 1 1112 } 1113 r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0) 1114 if r1 == 0 { 1115 err = errnoErr(e1) 1116 } 1117 return 1118 } 1119 1120 func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) { 1121 var _p0 uint32 1122 if groupDefaulted { 1123 _p0 = 1 1124 } 1125 r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) 1126 if r1 == 0 { 1127 err = errnoErr(e1) 1128 } 1129 return 1130 } 1131 1132 func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) { 1133 var _p0 uint32 1134 if ownerDefaulted { 1135 _p0 = 1 1136 } 1137 r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) 1138 if r1 == 0 { 1139 err = errnoErr(e1) 1140 } 1141 return 1142 } 1143 1144 func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) { 1145 syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) 1146 return 1147 } 1148 1149 func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) { 1150 var _p0 uint32 1151 if saclPresent { 1152 _p0 = 1 1153 } 1154 var _p1 uint32 1155 if saclDefaulted { 1156 _p1 = 1 1157 } 1158 r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0) 1159 if r1 == 0 { 1160 err = errnoErr(e1) 1161 } 1162 return 1163 } 1164 1165 func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { 1166 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) 1167 if r0 != 0 { 1168 ret = syscall.Errno(r0) 1169 } 1170 return 1171 } 1172 1173 func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) { 1174 r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0) 1175 if r1 == 0 { 1176 err = errnoErr(e1) 1177 } 1178 return 1179 } 1180 1181 func SetThreadToken(thread *Handle, token Token) (err error) { 1182 r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) 1183 if r1 == 0 { 1184 err = errnoErr(e1) 1185 } 1186 return 1187 } 1188 1189 func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { 1190 r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) 1191 if r1 == 0 { 1192 err = errnoErr(e1) 1193 } 1194 return 1195 } 1196 1197 func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { 1198 r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0) 1199 if r1 == 0 { 1200 err = errnoErr(e1) 1201 } 1202 return 1203 } 1204 1205 func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) { 1206 r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) 1207 if r1 == 0 { 1208 err = errnoErr(e1) 1209 } 1210 return 1211 } 1212 1213 func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { 1214 r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) 1215 if r1 == 0 { 1216 err = errnoErr(e1) 1217 } 1218 return 1219 } 1220 1221 func CertCloseStore(store Handle, flags uint32) (err error) { 1222 r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) 1223 if r1 == 0 { 1224 err = errnoErr(e1) 1225 } 1226 return 1227 } 1228 1229 func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { 1230 r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) 1231 context = (*CertContext)(unsafe.Pointer(r0)) 1232 if context == nil { 1233 err = errnoErr(e1) 1234 } 1235 return 1236 } 1237 1238 func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { 1239 r1, _, e1 := syscall.Syscall(procCertDeleteCertificateFromStore.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) 1240 if r1 == 0 { 1241 err = errnoErr(e1) 1242 } 1243 return 1244 } 1245 1246 func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) { 1247 r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) 1248 dupContext = (*CertContext)(unsafe.Pointer(r0)) 1249 return 1250 } 1251 1252 func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { 1253 r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) 1254 context = (*CertContext)(unsafe.Pointer(r0)) 1255 if context == nil { 1256 err = errnoErr(e1) 1257 } 1258 return 1259 } 1260 1261 func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) { 1262 r0, _, e1 := syscall.Syscall6(procCertFindCertificateInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) 1263 cert = (*CertContext)(unsafe.Pointer(r0)) 1264 if cert == nil { 1265 err = errnoErr(e1) 1266 } 1267 return 1268 } 1269 1270 func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) { 1271 r0, _, e1 := syscall.Syscall6(procCertFindChainInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) 1272 certchain = (*CertChainContext)(unsafe.Pointer(r0)) 1273 if certchain == nil { 1274 err = errnoErr(e1) 1275 } 1276 return 1277 } 1278 1279 func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) { 1280 r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) 1281 ret = (*CertExtension)(unsafe.Pointer(r0)) 1282 return 1283 } 1284 1285 func CertFreeCertificateChain(ctx *CertChainContext) { 1286 syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) 1287 return 1288 } 1289 1290 func CertFreeCertificateContext(ctx *CertContext) (err error) { 1291 r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) 1292 if r1 == 0 { 1293 err = errnoErr(e1) 1294 } 1295 return 1296 } 1297 1298 func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { 1299 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) 1300 if r1 == 0 { 1301 err = errnoErr(e1) 1302 } 1303 return 1304 } 1305 1306 func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) { 1307 r0, _, _ := syscall.Syscall6(procCertGetNameStringW.Addr(), 6, uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) 1308 chars = uint32(r0) 1309 return 1310 } 1311 1312 func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { 1313 r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) 1314 handle = Handle(r0) 1315 if handle == 0 { 1316 err = errnoErr(e1) 1317 } 1318 return 1319 } 1320 1321 func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { 1322 r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) 1323 store = Handle(r0) 1324 if store == 0 { 1325 err = errnoErr(e1) 1326 } 1327 return 1328 } 1329 1330 func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { 1331 r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) 1332 if r1 == 0 { 1333 err = errnoErr(e1) 1334 } 1335 return 1336 } 1337 1338 func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) { 1339 var _p0 uint32 1340 if *callerFreeProvOrNCryptKey { 1341 _p0 = 1 1342 } 1343 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))) 1344 *callerFreeProvOrNCryptKey = _p0 != 0 1345 if r1 == 0 { 1346 err = errnoErr(e1) 1347 } 1348 return 1349 } 1350 1351 func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) { 1352 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) 1353 if r1 == 0 { 1354 err = errnoErr(e1) 1355 } 1356 return 1357 } 1358 1359 func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { 1360 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) 1361 if r1 == 0 { 1362 err = errnoErr(e1) 1363 } 1364 return 1365 } 1366 1367 func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) { 1368 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) 1369 if r1 == 0 { 1370 err = errnoErr(e1) 1371 } 1372 return 1373 } 1374 1375 func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { 1376 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) 1377 if r1 == 0 { 1378 err = errnoErr(e1) 1379 } 1380 return 1381 } 1382 1383 func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) { 1384 r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) 1385 store = Handle(r0) 1386 if store == 0 { 1387 err = errnoErr(e1) 1388 } 1389 return 1390 } 1391 1392 func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { 1393 r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) 1394 same = r0 != 0 1395 return 1396 } 1397 1398 func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { 1399 var _p0 *uint16 1400 _p0, status = syscall.UTF16PtrFromString(name) 1401 if status != nil { 1402 return 1403 } 1404 return _DnsQuery(_p0, qtype, options, extra, qrs, pr) 1405 } 1406 1407 func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { 1408 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))) 1409 if r0 != 0 { 1410 status = syscall.Errno(r0) 1411 } 1412 return 1413 } 1414 1415 func DnsRecordListFree(rl *DNSRecord, freetype uint32) { 1416 syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) 1417 return 1418 } 1419 1420 func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { 1421 r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0) 1422 if r0 != 0 { 1423 errcode = syscall.Errno(r0) 1424 } 1425 return 1426 } 1427 1428 func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { 1429 r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) 1430 if r0 != 0 { 1431 errcode = syscall.Errno(r0) 1432 } 1433 return 1434 } 1435 1436 func GetIfEntry(pIfRow *MibIfRow) (errcode error) { 1437 r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) 1438 if r0 != 0 { 1439 errcode = syscall.Errno(r0) 1440 } 1441 return 1442 } 1443 1444 func AssignProcessToJobObject(job Handle, process Handle) (err error) { 1445 r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) 1446 if r1 == 0 { 1447 err = errnoErr(e1) 1448 } 1449 return 1450 } 1451 1452 func CancelIo(s Handle) (err error) { 1453 r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) 1454 if r1 == 0 { 1455 err = errnoErr(e1) 1456 } 1457 return 1458 } 1459 1460 func CancelIoEx(s Handle, o *Overlapped) (err error) { 1461 r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) 1462 if r1 == 0 { 1463 err = errnoErr(e1) 1464 } 1465 return 1466 } 1467 1468 func CloseHandle(handle Handle) (err error) { 1469 r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) 1470 if r1 == 0 { 1471 err = errnoErr(e1) 1472 } 1473 return 1474 } 1475 1476 func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { 1477 r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0) 1478 if r1 == 0 { 1479 err = errnoErr(e1) 1480 } 1481 return 1482 } 1483 1484 func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { 1485 r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) 1486 if r1 == 0 { 1487 err = errnoErr(e1) 1488 } 1489 return 1490 } 1491 1492 func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { 1493 r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) 1494 handle = Handle(r0) 1495 if handle == 0 || e1 == ERROR_ALREADY_EXISTS { 1496 err = errnoErr(e1) 1497 } 1498 return 1499 } 1500 1501 func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { 1502 r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) 1503 handle = Handle(r0) 1504 if handle == 0 || e1 == ERROR_ALREADY_EXISTS { 1505 err = errnoErr(e1) 1506 } 1507 return 1508 } 1509 1510 func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { 1511 r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) 1512 handle = Handle(r0) 1513 if handle == 0 || e1 == ERROR_ALREADY_EXISTS { 1514 err = errnoErr(e1) 1515 } 1516 return 1517 } 1518 1519 func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { 1520 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) 1521 handle = Handle(r0) 1522 if handle == InvalidHandle { 1523 err = errnoErr(e1) 1524 } 1525 return 1526 } 1527 1528 func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { 1529 r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) 1530 if r1&0xff == 0 { 1531 err = errnoErr(e1) 1532 } 1533 return 1534 } 1535 1536 func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { 1537 r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) 1538 handle = Handle(r0) 1539 if handle == 0 { 1540 err = errnoErr(e1) 1541 } 1542 return 1543 } 1544 1545 func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { 1546 r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) 1547 handle = Handle(r0) 1548 if handle == 0 { 1549 err = errnoErr(e1) 1550 } 1551 return 1552 } 1553 1554 func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { 1555 r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) 1556 handle = Handle(r0) 1557 if handle == 0 || e1 == ERROR_ALREADY_EXISTS { 1558 err = errnoErr(e1) 1559 } 1560 return 1561 } 1562 1563 func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) { 1564 var _p0 uint32 1565 if initialOwner { 1566 _p0 = 1 1567 } 1568 r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) 1569 handle = Handle(r0) 1570 if handle == 0 || e1 == ERROR_ALREADY_EXISTS { 1571 err = errnoErr(e1) 1572 } 1573 return 1574 } 1575 1576 func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) { 1577 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) 1578 handle = Handle(r0) 1579 if handle == InvalidHandle { 1580 err = errnoErr(e1) 1581 } 1582 return 1583 } 1584 1585 func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { 1586 r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) 1587 if r1 == 0 { 1588 err = errnoErr(e1) 1589 } 1590 return 1591 } 1592 1593 func 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 1605 func 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 1613 func 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 1622 func 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 1630 func 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 1638 func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) { 1639 syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0) 1640 return 1641 } 1642 1643 func 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 1651 func 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 1659 func 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 1671 func ExitProcess(exitcode uint32) { 1672 syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) 1673 return 1674 } 1675 1676 func 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 1684 func 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 1692 func 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 1701 func _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 1714 func 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 1723 func 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 1732 func 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 1741 func 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 1749 func 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 1757 func 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 1765 func 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 1773 func 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 1782 func 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 1790 func 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 1798 func 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 1806 func 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 1814 func 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 1827 func 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 1835 func 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 1843 func 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 1851 func GetACP() (acp uint32) { 1852 r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) 1853 acp = uint32(r0) 1854 return 1855 } 1856 1857 func 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 1865 func GetCommandLine() (cmd *uint16) { 1866 r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) 1867 cmd = (*uint16)(unsafe.Pointer(r0)) 1868 return 1869 } 1870 1871 func 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 1879 func 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 1887 func 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 1895 func 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 1903 func 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 1912 func GetCurrentProcessId() (pid uint32) { 1913 r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) 1914 pid = uint32(r0) 1915 return 1916 } 1917 1918 func GetCurrentThreadId() (id uint32) { 1919 r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) 1920 id = uint32(r0) 1921 return 1922 } 1923 1924 func 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 1932 func 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 1938 func 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 1947 func 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 1956 func 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 1964 func 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 1972 func 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 1981 func 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 1989 func 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 1997 func 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 2006 func 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 2015 func 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 2024 func 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 2032 func 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 2041 func 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 2050 func 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 2059 func 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 2068 func 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 2076 func 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 2084 func 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 2092 func 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 2104 func 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 2113 func 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 2122 func _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 2131 func 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 2140 func 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 2148 func 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 2156 func 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 2164 func 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 2169 func 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 2177 func 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 2186 func 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 2194 func 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 2203 func 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 2212 func 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 2220 func GetSystemTimeAsFileTime(time *Filetime) { 2221 syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) 2222 return 2223 } 2224 2225 func GetSystemTimePreciseAsFileTime(time *Filetime) { 2226 syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) 2227 return 2228 } 2229 2230 func 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 2239 func 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 2248 func 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 2256 func getTickCount64() (ms uint64) { 2257 r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) 2258 ms = uint64(r0) 2259 return 2260 } 2261 2262 func 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 2271 func 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 2279 func 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 2288 func 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 2296 func 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 2304 func 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 2312 func 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 2320 func 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 2328 func 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 2337 func 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 2345 func 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 2358 func 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 2370 func 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 2379 func _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 2388 func 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 2397 func _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 2406 func 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 2415 func 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 2424 func 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 2433 func 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 2441 func 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 2450 func 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 2459 func 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 2467 func 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 2475 func 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 2484 func 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 2497 func 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 2510 func 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 2523 func 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 2536 func 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 2544 func 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 2552 func 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 2560 func 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 2568 func 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 2576 func 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 2585 func 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 2593 func 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 2601 func 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 2609 func 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 2621 func 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 2633 func 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 2641 func 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 2649 func 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 2657 func 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 2666 func 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 2674 func 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 2682 func 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 2690 func 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 2698 func 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 2706 func 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 2715 func _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 2723 func 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 2731 func 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 2739 func SetErrorMode(mode uint32) (ret uint32) { 2740 r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) 2741 ret = uint32(r0) 2742 return 2743 } 2744 2745 func 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 2753 func 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 2761 func 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 2769 func 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 2777 func 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 2786 func 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 2794 func 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 2802 func 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 2811 func 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 2819 func 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 2827 func 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 2839 func 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 2847 func 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 2855 func 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 2863 func 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 2871 func 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 2879 func 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 2888 func 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 2898 func 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 2906 func 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 2914 func 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 2922 func 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 2930 func 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 2938 func 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 2946 func 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 2954 func 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 2963 func 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 2971 func 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 2979 func 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 2987 func 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 2995 func 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 3008 func 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 3017 func 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 3025 func 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 3037 func 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 3045 func 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 3050 func 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 3058 func 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 3066 func 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 3074 func 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 3082 func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) { 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 3090 func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) { 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 3098 func 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 3106 func 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 3114 func 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 3122 func 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 3130 func 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 3138 func RtlGetCurrentPeb() (peb *PEB) { 3139 r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0) 3140 peb = (*PEB)(unsafe.Pointer(r0)) 3141 return 3142 } 3143 3144 func 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 3149 func 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 3157 func RtlInitString(destinationString *NTString, sourceString *byte) { 3158 syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) 3159 return 3160 } 3161 3162 func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) { 3163 syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) 3164 return 3165 } 3166 3167 func 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 3173 func 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 3181 func 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 3189 func 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 3197 func 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 3205 func CoTaskMemFree(address unsafe.Pointer) { 3206 syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) 3207 return 3208 } 3209 3210 func CoUninitialize() { 3211 syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0) 3212 return 3213 } 3214 3215 func 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 3221 func 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 3233 func 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 3245 func 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 3254 func 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 3262 func 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 3270 func 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 3279 func 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 3287 func 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 3295 func 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 3303 func GetShellWindow() (shellWindow HWND) { 3304 r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) 3305 shellWindow = HWND(r0) 3306 return 3307 } 3308 3309 func 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 3318 func 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 3327 func 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 3339 func 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 3347 func 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 3355 func 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 3363 func FreeAddrInfoW(addrinfo *AddrinfoW) { 3364 syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) 3365 return 3366 } 3367 3368 func 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 3376 func 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 3384 func 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 3393 func 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 3405 func 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 3413 func 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 3421 func 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 3429 func 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 3437 func 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 3445 func 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 3454 func 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 3462 func 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 3470 func 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 3478 func 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 3486 func 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 3495 func _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 3504 func 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 3512 func 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 3521 func _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 3530 func 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 3544 func _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 3553 func 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 3561 func 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 3569 func 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 3577 func Ntohs(netshort uint16) (u uint16) { 3578 r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) 3579 u = uint16(r0) 3580 return 3581 } 3582 3583 func 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 3596 func 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 3608 func 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 3616 func 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 3624 func 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 3633 func 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 3641 func WTSFreeMemory(ptr uintptr) { 3642 syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) 3643 return 3644 } 3645 3646 func 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 }