mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-27 13:16:11 +03:00
* Added IArchSystem::getPlatformName()
* Added CArchSystemWindows::isWOW64() * Changed "Synergy" into "Synergy+" in various locations * Added output of platform name to startup message
This commit is contained in:
parent
6d0ddb6a6b
commit
5c89bc4b17
@ -51,7 +51,7 @@ CInfo::init(HWND hwnd)
|
||||
{
|
||||
// collect info
|
||||
CString version =
|
||||
CStringUtil::format(getString(IDS_TITLE).c_str(), VERSION);
|
||||
CStringUtil::format(getString(IDS_TITLE).c_str(), kApplication, kVersion);
|
||||
CString hostname = ARCH->getHostName();
|
||||
CString address = ARCH->addrToString(ARCH->nameToAddr(hostname));
|
||||
CString userConfig = ARCH->getUserDirectory();
|
||||
|
@ -398,7 +398,7 @@ initMainWindow(HWND hwnd)
|
||||
{
|
||||
// append version number to title
|
||||
CString titleFormat = getString(IDS_TITLE);
|
||||
setWindowText(hwnd, CStringUtil::format(titleFormat.c_str(), VERSION));
|
||||
setWindowText(hwnd, CStringUtil::format(titleFormat.c_str(), kApplication, kVersion));
|
||||
|
||||
// load configuration
|
||||
bool configLoaded =
|
||||
|
@ -566,7 +566,7 @@ BEGIN
|
||||
IDS_UNINSTALLED_SYSTEM "Removed auto-start. Synergy will not automatically start each time you start or reboot your computer."
|
||||
IDS_UNINSTALLED_USER "Removed auto-start. Synergy will not automatically start each time you log in."
|
||||
IDS_INVALID_SERVER_NAME "Server name `%{1}' is invalid."
|
||||
IDS_TITLE "Synergy - Version %{1}"
|
||||
IDS_TITLE "%{1} Version %{2}"
|
||||
IDS_SERVER_IS_CLIENT "Please enter the name of the computer sharing a\nkeyboard and mouse, not the name of this computer,\nin the Other Computer's Host Name field."
|
||||
IDS_ADD_SCREEN "Add Screen"
|
||||
IDS_EDIT_SCREEN "Edit Screen %{1}"
|
||||
|
@ -1039,7 +1039,7 @@ parse(int argc, const char* const* argv)
|
||||
}
|
||||
|
||||
// identify system
|
||||
LOG((CLOG_INFO "Synergy server %s on %s", kVersion, ARCH->getOSName().c_str()));
|
||||
LOG((CLOG_INFO "%s Server on %s %s", kAppVersion, ARCH->getOSName().c_str(), ARCH->getPlatformName().c_str()));
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -614,6 +614,12 @@ CArch::getOSName() const
|
||||
return m_system->getOSName();
|
||||
}
|
||||
|
||||
std::string
|
||||
CArch::getPlatformName() const
|
||||
{
|
||||
return m_system->getPlatformName();
|
||||
}
|
||||
|
||||
void
|
||||
CArch::addReceiver(IArchTaskBarReceiver* receiver)
|
||||
{
|
||||
|
@ -174,6 +174,7 @@ public:
|
||||
|
||||
// IArchSystem overrides
|
||||
virtual std::string getOSName() const;
|
||||
virtual std::string getPlatformName() const;
|
||||
|
||||
// IArchTaskBar
|
||||
virtual void addReceiver(IArchTaskBarReceiver*);
|
||||
|
@ -41,10 +41,20 @@ CArchSystemUnix::getOSName() const
|
||||
msg += info.release;
|
||||
msg += " ";
|
||||
msg += info.version;
|
||||
msg += " ";
|
||||
msg += info.machine;
|
||||
return msg;
|
||||
}
|
||||
#endif
|
||||
return "Unix <unknown>";
|
||||
return "Unix";
|
||||
}
|
||||
|
||||
std::string
|
||||
CArchSystemUnix::getPlatformName() const
|
||||
{
|
||||
#if defined(HAVE_SYS_UTSNAME_H)
|
||||
struct utsname info;
|
||||
if (uname(&info) == 0) {
|
||||
return std::string(info.machine);
|
||||
}
|
||||
#endif
|
||||
return "unknown";
|
||||
}
|
@ -27,6 +27,7 @@ public:
|
||||
|
||||
// IArchSystem overrides
|
||||
virtual std::string getOSName() const;
|
||||
virtual std::string getPlatformName() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -34,16 +34,39 @@ CArchSystemWindows::~CArchSystemWindows()
|
||||
std::string
|
||||
CArchSystemWindows::getOSName() const
|
||||
{
|
||||
#if WINVER >= _WIN32_WINNT_WIN2K
|
||||
OSVERSIONINFOEX info;
|
||||
#else
|
||||
OSVERSIONINFO info;
|
||||
#endif
|
||||
|
||||
info.dwOSVersionInfoSize = sizeof(info);
|
||||
if (GetVersionEx(&info)) {
|
||||
if (GetVersionEx((OSVERSIONINFO*) &info)) {
|
||||
switch (info.dwPlatformId) {
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
#if WINVER >= _WIN32_WINNT_WIN2K
|
||||
if (info.dwMajorVersion == 6) {
|
||||
if(info.dwMinorVersion == 0) {
|
||||
if (info.wProductType == VER_NT_WORKSTATION) {
|
||||
return "Microsoft Windows Vista";
|
||||
} else {
|
||||
return "Microsoft Windows Server 2008";
|
||||
}
|
||||
} else if(info.dwMinorVersion == 1) {
|
||||
if (info.wProductType == VER_NT_WORKSTATION) {
|
||||
return "Microsoft Windows 7";
|
||||
} else {
|
||||
return "Microsoft Windows Server 2008 R2";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (info.dwMajorVersion == 5 && info.dwMinorVersion == 2) {
|
||||
return "Microsoft Windows Server 2003";
|
||||
}
|
||||
if (info.dwMajorVersion == 5 && info.dwMinorVersion == 1) {
|
||||
return "Microsoft Windows Server XP";
|
||||
return "Microsoft Windows XP";
|
||||
}
|
||||
if (info.dwMajorVersion == 5 && info.dwMinorVersion == 0) {
|
||||
return "Microsoft Windows Server 2000";
|
||||
@ -84,3 +107,37 @@ CArchSystemWindows::getOSName() const
|
||||
}
|
||||
return "Microsoft Windows <unknown>";
|
||||
}
|
||||
|
||||
std::string
|
||||
CArchSystemWindows::getPlatformName() const
|
||||
{
|
||||
#ifdef _X86_
|
||||
if(isWOW64())
|
||||
return "x86 (WOW64)";
|
||||
else
|
||||
return "x86";
|
||||
#endif
|
||||
#ifdef _AMD64_
|
||||
return "x64";
|
||||
#endif
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
bool
|
||||
CArchSystemWindows::isWOW64() const
|
||||
{
|
||||
#if WINVER >= _WIN32_WINNT_WINXP
|
||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||
LPFN_ISWOW64PROCESS fnIsWow64Process =
|
||||
(LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
|
||||
|
||||
BOOL bIsWow64 = FALSE;
|
||||
if(NULL != fnIsWow64Process &&
|
||||
fnIsWow64Process(GetCurrentProcess(), &bIsWow64) &&
|
||||
bIsWow64)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
@ -27,6 +27,9 @@ public:
|
||||
|
||||
// IArchSystem overrides
|
||||
virtual std::string getOSName() const;
|
||||
virtual std::string getPlatformName() const;
|
||||
|
||||
bool isWOW64() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -33,6 +33,11 @@ public:
|
||||
*/
|
||||
virtual std::string getOSName() const = 0;
|
||||
|
||||
//! Identify the platform
|
||||
/*!
|
||||
Returns a string identifying the platform this OS is running on.
|
||||
*/
|
||||
virtual std::string getPlatformName() const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user