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