cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
terminfo.cpp File Reference
#include <windows.h>
#include "cpp-terminal/cursor.hpp"
#include "cpp-terminal/private/env.hpp"
#include "cpp-terminal/private/file.hpp"
#include "cpp-terminal/terminfo.hpp"
#include <cstddef>
#include <string>

Go to the source code of this file.

Macros

#define ENABLE_VIRTUAL_TERMINAL_PROCESSING   0x0004
 

Functions

bool WindowsVersionGreater (const DWORD &major, const DWORD &minor, const DWORD &patch)
 

Macro Definition Documentation

◆ ENABLE_VIRTUAL_TERMINAL_PROCESSING

#define ENABLE_VIRTUAL_TERMINAL_PROCESSING   0x0004

Function Documentation

◆ WindowsVersionGreater()

bool WindowsVersionGreater ( const DWORD & major,
const DWORD & minor,
const DWORD & patch )

Definition at line 53 of file terminfo.cpp.

54{
55 #if defined(_MSC_VER)
56 #pragma warning(push)
57 #pragma warning(disable : 4191)
58 #else
59 #pragma GCC diagnostic push
60 #pragma GCC diagnostic ignored "-Wcast-function-type"
61 #endif
62 NTSTATUS(WINAPI * getVersion)
63 (PRTL_OSVERSIONINFOW) = (reinterpret_cast<NTSTATUS(WINAPI*)(PRTL_OSVERSIONINFOW)>(GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")), "RtlGetVersion")));
64 #if defined(_MSC_VER)
65 #pragma warning(pop)
66 #else
67 #pragma GCC diagnostic pop
68 #endif
69 if(getVersion != nullptr)
70 {
71 RTL_OSVERSIONINFOW rovi;
72 rovi.dwOSVersionInfoSize = sizeof(rovi);
73 if(getVersion(&rovi) == 0)
74 {
75 if(rovi.dwMajorVersion > major || (rovi.dwMajorVersion == major && (rovi.dwMinorVersion > minor || (rovi.dwMinorVersion == minor && rovi.dwBuildNumber >= patch)))) return true;
76 else
77 return false;
78 }
79 }
80 return false;
81}