Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hsSystemInfo for gathering basic system info. #1014

Merged
merged 5 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sources/Plasma/CoreLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(CoreLib_SOURCES
hsSTLStream.cpp
hsStream.cpp
hsStringTokenizer.cpp
hsSystemInfo.cpp
hsThread.cpp
hsWide.cpp
pcSmallRect.cpp
Expand Down Expand Up @@ -58,6 +59,7 @@ set(CoreLib_HEADERS
hsSTLStream.h
hsStream.h
hsStringTokenizer.h
hsSystemInfo.h
hsThread.h
hsWide.h
hsWindows.h
Expand All @@ -84,6 +86,8 @@ target_link_libraries(
string_theory
Threads::Threads
$<$<AND:$<CONFIG:Debug>,$<BOOL:${USE_VLD}>>:VLD::VLD>
PRIVATE
"$<$<PLATFORM_ID:Darwin>:-framework CoreFoundation>"
)
target_include_directories(
CoreLib
Expand Down
88 changes: 0 additions & 88 deletions Sources/Plasma/CoreLib/HeadSpin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,91 +478,3 @@ char *hsWStringToString( const wchar_t *str )

return sStr;
}

//
// Microsoft SAMPLE CODE
// returns array of allocated version info strings or nil
//
std::vector<ST::string> DisplaySystemVersion()
{
std::vector<ST::string> versionStrs;
#if HS_BUILD_FOR_WIN32
#ifndef VER_SUITE_PERSONAL
#define VER_SUITE_PERSONAL 0x200
#endif
const RTL_OSVERSIONINFOEXW& version = hsGetWindowsVersion();

switch (version.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:

// Test for the product.

if ( version.dwMajorVersion <= 4 )
versionStrs.push_back("Microsoft Windows NT ");

if ( version.dwMajorVersion == 5 && version.dwMinorVersion == 0 )
versionStrs.push_back("Microsoft Windows 2000 ");

if ( version.dwMajorVersion == 5 && version.dwMinorVersion == 1 )
versionStrs.push_back("Microsoft Windows XP ");

if ( version.dwMajorVersion == 6 && version.dwMinorVersion == 0 )
versionStrs.push_back("Microsoft Windows Vista ");

if ( version.dwMajorVersion == 6 && version.dwMinorVersion == 1 )
versionStrs.push_back("Microsoft Windows 7 ");

if ( version.dwMajorVersion == 6 && version.dwMinorVersion == 2 )
versionStrs.push_back("Microsoft Windows 8 ");

if ( version.dwMajorVersion == 6 && version.dwMinorVersion == 3 )
versionStrs.push_back("Microsoft Windows 8.1 ");

if ( version.dwMajorVersion == 10 && version.dwMinorVersion == 0 )
versionStrs.push_back("Microsoft Windows 10 ");

// Test for product type.

if ( version.wProductType == VER_NT_WORKSTATION )
{
if( version.wSuiteMask & VER_SUITE_PERSONAL )
versionStrs.push_back("Personal ");
else
versionStrs.push_back("Professional ");
}
else if ( version.wProductType == VER_NT_SERVER )
{
if( version.wSuiteMask & VER_SUITE_DATACENTER )
versionStrs.push_back("DataCenter Server ");
else if( version.wSuiteMask & VER_SUITE_ENTERPRISE )
versionStrs.push_back("Advanced Server ");
else
versionStrs.push_back("Server ");
}

// Display version, service pack (if any), and build number.

if ( version.dwMajorVersion <= 4 )
{
versionStrs.push_back(ST::format("version {}.{} {} (Build {})\n",
version.dwMajorVersion,
version.dwMinorVersion,
version.szCSDVersion,
version.dwBuildNumber & 0xFFFF));
}
else
{
versionStrs.push_back(ST::format("{} (Build {})\n",
version.szCSDVersion,
version.dwBuildNumber & 0xFFFF));
}
break;
}
#elif HS_BUILD_FOR_UNIX
struct utsname sysinfo;
uname(&sysinfo);
versionStrs.push_back(ST::format("{} {} ({})\n", sysinfo.sysname, sysinfo.release, sysinfo.machine));
#endif
return versionStrs;
}
Loading