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