19#include "llvm/ADT/SmallString.h"
20#include "llvm/Support/ConvertUTF.h"
21#include "llvm/Support/FileSystem.h"
22#include "llvm/Support/ManagedStatic.h"
23#include "llvm/Support/Path.h"
24#include "llvm/Support/Threading.h"
25#include "llvm/Support/raw_ostream.h"
44 ::CoInitializeEx(
nullptr, COINIT_MULTITHREADED);
54 SYSTEM_INFO systemInfo;
55 GetNativeSystemInfo(&systemInfo);
56 return systemInfo.dwPageSize;
62 ZeroMemory(&info,
sizeof(OSVERSIONINFOEX));
63 info.dwOSVersionInfoSize =
sizeof(OSVERSIONINFOEX);
65#pragma warning(disable : 4996)
70 if (GetVersionEx((LPOSVERSIONINFO)&info) == 0)
71 return llvm::VersionTuple();
74 return llvm::VersionTuple(info.dwMajorVersion, info.dwMinorVersion,
75 info.wServicePackMajor);
83 return "Windows NT " + version.getAsString();
91 wchar_t buffer[MAX_COMPUTERNAME_LENGTH + 1];
92 DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
93 if (!::GetComputerNameW(buffer, &dwSize))
98 return llvm::convertWideToUTF8(buffer, s);
102 static llvm::once_flag g_once_flag;
103 llvm::call_once(g_once_flag, []() {
104 std::vector<wchar_t> buffer(
PATH_MAX);
105 ::GetModuleFileNameW(NULL, buffer.data(), buffer.size());
107 llvm::convertWideToUTF8(buffer.data(), path);
121 return FileSpec(
"C:\\Windows\\system32\\cmd.exe");
126 std::wstring wvar_name;
127 if (!llvm::ConvertUTF8toWide(var_name, wvar_name))
130 if (
const wchar_t *wvar = _wgetenv(wvar_name.c_str()))
131 return llvm::convertWideToUTF8(wvar, var);
static llvm::ManagedStatic< PosixUserIDResolver > g_user_id_resolver
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
void(FileSpec &this_file) SharedLibraryDirectoryHelper
A helper function for determining the liblldb location.
static void Initialize(SharedLibraryDirectoryHelper *helper=nullptr)
static llvm::VersionTuple GetOSVersion()
static FileSpec GetProgramFileSpec()
static UserIDResolver & GetUserIDResolver()
static std::optional< std::string > GetOSBuildString()
static bool GetHostname(std::string &s)
static void Initialize(SharedLibraryDirectoryHelper *helper=nullptr)
static std::optional< std::string > GetOSKernelDescription()
static FileSpec m_program_filespec
static size_t GetPageSize()
static FileSpec GetDefaultShell()
static bool GetEnvironmentVar(const std::string &var_name, std::string &var)
An abstract interface for things that know how to map numeric user/group IDs into names.
virtual std::optional< std::string > DoGetGroupName(id_t gid)=0
virtual std::optional< std::string > DoGetUserName(id_t uid)=0
A class that represents a running process on the host machine.