22 #ifndef LLVM_SUPPORT_WINDOWSSUPPORT_H 23 #define LLVM_SUPPORT_WINDOWSSUPPORT_H 30 #define _WIN32_WINNT 0x0601 31 #define _WIN32_IE 0x0800 // MinGW at it again. FIXME: verify if still needed. 32 #define WIN32_LEAN_AND_MEAN 41 #include "llvm/Config/config.h" 47 #include <system_error> 67 bool MakeErrMsg(std::string *ErrMsg,
const std::string &prefix);
69 template <
typename HandleTraits>
71 typedef typename HandleTraits::handle_type handle_type;
78 : Handle(HandleTraits::GetInvalid()) {}
84 if (HandleTraits::IsValid(Handle))
85 HandleTraits::Close(Handle);
89 handle_type t = Handle;
90 Handle = HandleTraits::GetInvalid();
95 if (HandleTraits::IsValid(Handle))
96 HandleTraits::Close(Handle);
102 explicit operator bool()
const {
103 return HandleTraits::IsValid(Handle) ?
true :
false;
106 operator handle_type()
const {
115 return INVALID_HANDLE_VALUE;
123 return h != GetInvalid();
141 ::CryptReleaseContext(h, 0);
145 return h != GetInvalid();
161 return h != GetInvalid();
194 ULARGE_INTEGER TimeInteger;
195 TimeInteger.LowPart = Time.dwLowDateTime;
196 TimeInteger.HighPart = Time.dwHighDateTime;
199 return std::chrono::nanoseconds(100 * TimeInteger.QuadPart);
203 ULARGE_INTEGER TimeInteger;
204 TimeInteger.LowPart = Time.dwLowDateTime;
205 TimeInteger.HighPart = Time.dwHighDateTime;
208 TimeInteger.QuadPart -= 11644473600ll * 10000000;
211 return TimePoint<>(std::chrono::nanoseconds(100 * TimeInteger.QuadPart));
215 ULARGE_INTEGER TimeInteger;
216 TimeInteger.QuadPart = TP.time_since_epoch().count() / 100;
217 TimeInteger.QuadPart += 11644473600ll * 10000000;
220 Time.dwLowDateTime = TimeInteger.LowPart;
221 Time.dwHighDateTime = TimeInteger.HighPart;
ScopedHandle< JobHandleTraits > ScopedJobHandle
std::error_code GetCommandLineArguments(SmallVectorImpl< const char *> &Args, BumpPtrAllocator &Alloc)
This class represents lattice values for constants.
FILETIME toFILETIME(TimePoint<> TP)
ScopedHandle< FileHandleTraits > ScopedFileHandle
static void Close(handle_type h)
void push_back(const T &Elt)
ScopedHandle< FindHandleTraits > ScopedFindHandle
block Block Frequency true
ScopedHandle< CommonHandleTraits > ScopedCommonHandle
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
static bool IsValid(handle_type h)
static bool IsValid(handle_type h)
static void Close(handle_type h)
static bool IsValid(handle_type h)
Allocate memory in an ever growing pool, as if by bump-pointer.
static handle_type GetInvalid()
TimePoint toTimePoint(FILETIME Time)
ScopedHandle< CryptContextTraits > ScopedCryptContext
static handle_type GetInvalid()
ScopedHandle< RegTraits > ScopedRegHandle
bool RunningWindows8OrGreater()
Determines if the program is running on Windows 8 or newer.
llvm::VersionTuple GetWindowsOSVersion()
Returns the Windows version as Major.Minor.0.BuildNumber.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
ScopedHandle & operator=(handle_type h)
static void Close(handle_type h)
static void Close(handle_type h)
static handle_type GetInvalid()
bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix)
ScopedHandle(handle_type h)
Represents a version number in the form major[.minor[.subminor[.build]]].
pointer data()
Return a pointer to the vector's buffer, even if empty().
static handle_type GetInvalid()
Defines the llvm::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
std::chrono::nanoseconds toDuration(FILETIME Time)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.