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