diff --git a/cmd/launcher/CInfo.cpp b/cmd/launcher/CInfo.cpp index 669da0e2..73d4085a 100644 --- a/cmd/launcher/CInfo.cpp +++ b/cmd/launcher/CInfo.cpp @@ -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(); diff --git a/cmd/launcher/launcher.cpp b/cmd/launcher/launcher.cpp index 938822da..e144b54b 100644 --- a/cmd/launcher/launcher.cpp +++ b/cmd/launcher/launcher.cpp @@ -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 = diff --git a/cmd/launcher/launcher.rc b/cmd/launcher/launcher.rc index e6ff5b8d..21cfeef1 100644 --- a/cmd/launcher/launcher.rc +++ b/cmd/launcher/launcher.rc @@ -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}" diff --git a/cmd/synergys/synergys.cpp b/cmd/synergys/synergys.cpp index 4319af1e..46428450 100644 --- a/cmd/synergys/synergys.cpp +++ b/cmd/synergys/synergys.cpp @@ -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 diff --git a/lib/arch/CArch.cpp b/lib/arch/CArch.cpp index 80c613ab..6d0a8c07 100644 --- a/lib/arch/CArch.cpp +++ b/lib/arch/CArch.cpp @@ -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) { diff --git a/lib/arch/CArch.h b/lib/arch/CArch.h index 644f015c..d5d5b9d3 100644 --- a/lib/arch/CArch.h +++ b/lib/arch/CArch.h @@ -174,6 +174,7 @@ public: // IArchSystem overrides virtual std::string getOSName() const; + virtual std::string getPlatformName() const; // IArchTaskBar virtual void addReceiver(IArchTaskBarReceiver*); diff --git a/lib/arch/CArchSystemUnix.cpp b/lib/arch/CArchSystemUnix.cpp index 541038db..47f60b99 100644 --- a/lib/arch/CArchSystemUnix.cpp +++ b/lib/arch/CArchSystemUnix.cpp @@ -41,10 +41,20 @@ CArchSystemUnix::getOSName() const msg += info.release; msg += " "; msg += info.version; - msg += " "; - msg += info.machine; return msg; } #endif - return "Unix "; + 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"; +} \ No newline at end of file diff --git a/lib/arch/CArchSystemUnix.h b/lib/arch/CArchSystemUnix.h index 525aed1c..57e3dcbf 100644 --- a/lib/arch/CArchSystemUnix.h +++ b/lib/arch/CArchSystemUnix.h @@ -27,6 +27,7 @@ public: // IArchSystem overrides virtual std::string getOSName() const; + virtual std::string getPlatformName() const; }; #endif diff --git a/lib/arch/CArchSystemWindows.cpp b/lib/arch/CArchSystemWindows.cpp index b634b4bc..9f86c350 100644 --- a/lib/arch/CArchSystemWindows.cpp +++ b/lib/arch/CArchSystemWindows.cpp @@ -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 "; } + +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; +} \ No newline at end of file diff --git a/lib/arch/CArchSystemWindows.h b/lib/arch/CArchSystemWindows.h index e23913d0..c40868a8 100644 --- a/lib/arch/CArchSystemWindows.h +++ b/lib/arch/CArchSystemWindows.h @@ -27,6 +27,9 @@ public: // IArchSystem overrides virtual std::string getOSName() const; + virtual std::string getPlatformName() const; + + bool isWOW64() const; }; #endif diff --git a/lib/arch/IArchSystem.h b/lib/arch/IArchSystem.h index 7a6c941b..dcea106b 100644 --- a/lib/arch/IArchSystem.h +++ b/lib/arch/IArchSystem.h @@ -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; //@} };