* 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:
sveith 2009-04-07 21:35:55 +00:00
parent 6d0ddb6a6b
commit 5c89bc4b17
11 changed files with 92 additions and 9 deletions

View File

@ -51,7 +51,7 @@ CInfo::init(HWND hwnd)
{ {
// collect info // collect info
CString version = CString version =
CStringUtil::format(getString(IDS_TITLE).c_str(), VERSION); CStringUtil::format(getString(IDS_TITLE).c_str(), kApplication, kVersion);
CString hostname = ARCH->getHostName(); CString hostname = ARCH->getHostName();
CString address = ARCH->addrToString(ARCH->nameToAddr(hostname)); CString address = ARCH->addrToString(ARCH->nameToAddr(hostname));
CString userConfig = ARCH->getUserDirectory(); CString userConfig = ARCH->getUserDirectory();

View File

@ -398,7 +398,7 @@ initMainWindow(HWND hwnd)
{ {
// append version number to title // append version number to title
CString titleFormat = getString(IDS_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 // load configuration
bool configLoaded = bool configLoaded =

View File

@ -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_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_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_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_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_ADD_SCREEN "Add Screen"
IDS_EDIT_SCREEN "Edit Screen %{1}" IDS_EDIT_SCREEN "Edit Screen %{1}"

View File

@ -1039,7 +1039,7 @@ parse(int argc, const char* const* argv)
} }
// identify system // 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 static

View File

@ -614,6 +614,12 @@ CArch::getOSName() const
return m_system->getOSName(); return m_system->getOSName();
} }
std::string
CArch::getPlatformName() const
{
return m_system->getPlatformName();
}
void void
CArch::addReceiver(IArchTaskBarReceiver* receiver) CArch::addReceiver(IArchTaskBarReceiver* receiver)
{ {

View File

@ -174,6 +174,7 @@ public:
// IArchSystem overrides // IArchSystem overrides
virtual std::string getOSName() const; virtual std::string getOSName() const;
virtual std::string getPlatformName() const;
// IArchTaskBar // IArchTaskBar
virtual void addReceiver(IArchTaskBarReceiver*); virtual void addReceiver(IArchTaskBarReceiver*);

View File

@ -41,10 +41,20 @@ CArchSystemUnix::getOSName() const
msg += info.release; msg += info.release;
msg += " "; msg += " ";
msg += info.version; msg += info.version;
msg += " ";
msg += info.machine;
return msg; return msg;
} }
#endif #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";
}

View File

@ -27,6 +27,7 @@ public:
// IArchSystem overrides // IArchSystem overrides
virtual std::string getOSName() const; virtual std::string getOSName() const;
virtual std::string getPlatformName() const;
}; };
#endif #endif

View File

@ -34,16 +34,39 @@ CArchSystemWindows::~CArchSystemWindows()
std::string std::string
CArchSystemWindows::getOSName() const CArchSystemWindows::getOSName() const
{ {
#if WINVER >= _WIN32_WINNT_WIN2K
OSVERSIONINFOEX info;
#else
OSVERSIONINFO info; OSVERSIONINFO info;
#endif
info.dwOSVersionInfoSize = sizeof(info); info.dwOSVersionInfoSize = sizeof(info);
if (GetVersionEx(&info)) { if (GetVersionEx((OSVERSIONINFO*) &info)) {
switch (info.dwPlatformId) { switch (info.dwPlatformId) {
case VER_PLATFORM_WIN32_NT: 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) { if (info.dwMajorVersion == 5 && info.dwMinorVersion == 2) {
return "Microsoft Windows Server 2003"; return "Microsoft Windows Server 2003";
} }
if (info.dwMajorVersion == 5 && info.dwMinorVersion == 1) { if (info.dwMajorVersion == 5 && info.dwMinorVersion == 1) {
return "Microsoft Windows Server XP"; return "Microsoft Windows XP";
} }
if (info.dwMajorVersion == 5 && info.dwMinorVersion == 0) { if (info.dwMajorVersion == 5 && info.dwMinorVersion == 0) {
return "Microsoft Windows Server 2000"; return "Microsoft Windows Server 2000";
@ -84,3 +107,37 @@ CArchSystemWindows::getOSName() const
} }
return "Microsoft Windows <unknown>"; 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;
}

View File

@ -27,6 +27,9 @@ public:
// IArchSystem overrides // IArchSystem overrides
virtual std::string getOSName() const; virtual std::string getOSName() const;
virtual std::string getPlatformName() const;
bool isWOW64() const;
}; };
#endif #endif

View File

@ -33,6 +33,11 @@ public:
*/ */
virtual std::string getOSName() const = 0; 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;
//@} //@}
}; };