mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-12 19:31:47 +00:00
Perform windows version discovery.
This commit is contained in:
parent
66c839b557
commit
790a3ae26f
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#if defined _MSC_VER || defined __CYGWIN__
|
#if defined _MSC_VER || defined __CYGWIN__
|
||||||
# include <lmcons.h>
|
# include <lmcons.h>
|
||||||
|
extern "C" typedef LONG (WINAPI *t_RtlGetVersion)( PRTL_OSVERSIONINFOW );
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
@ -162,10 +163,32 @@ static const char* GetHostInfo()
|
|||||||
{
|
{
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
auto ptr = buf;
|
auto ptr = buf;
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER || defined __CYGWIN__
|
||||||
ptr += sprintf( ptr, "OS: Windows\n" );
|
# ifdef UNICODE
|
||||||
#elif defined __CYGWIN__
|
t_RtlGetVersion RtlGetVersion = (t_RtlGetVersion)GetProcAddress( GetModuleHandle( L"ntdll.dll" ), "RtlGetVersion" );
|
||||||
ptr += sprintf( ptr, "OS: Windows (Cygwin)\n" );
|
# else
|
||||||
|
t_RtlGetVersion RtlGetVersion = (t_RtlGetVersion)GetProcAddress( GetModuleHandle( "ntdll.dll" ), "RtlGetVersion" );
|
||||||
|
# endif
|
||||||
|
|
||||||
|
if( !RtlGetVersion )
|
||||||
|
{
|
||||||
|
# ifndef __CYGWIN__
|
||||||
|
ptr += sprintf( ptr, "OS: Windows\n" );
|
||||||
|
# else
|
||||||
|
ptr += sprintf( ptr, "OS: Windows (Cygwin)\n" );
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RTL_OSVERSIONINFOW ver = { sizeof( RTL_OSVERSIONINFOW ) };
|
||||||
|
RtlGetVersion( &ver );
|
||||||
|
|
||||||
|
# ifndef __CYGWIN__
|
||||||
|
ptr += sprintf( ptr, "OS: Windows %i.%i.%i\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
||||||
|
# else
|
||||||
|
ptr += sprintf( ptr, "OS: Windows %i.%i.%i (Cygwin)\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
||||||
|
# endif
|
||||||
|
}
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
# if defined __ANDROID__
|
# if defined __ANDROID__
|
||||||
ptr += sprintf( ptr, "OS: Linux (Android)\n" );
|
ptr += sprintf( ptr, "OS: Linux (Android)\n" );
|
||||||
|
Loading…
Reference in New Issue
Block a user