diff options
author | CrystalP <CrystalP@xbmc.org> | 2011-09-17 21:35:22 -0400 |
---|---|---|
committer | CrystalP <CrystalP@xbmc.org> | 2011-09-17 22:37:04 -0400 |
commit | f8e99f8654aa5e5376998510c609c9ca58ef72bb (patch) | |
tree | c27295956ff2635edee33ac7febb4534e73c7420 | |
parent | c6df92eeb98e3c18985c5dd23295a55a492a3748 (diff) |
[WIN] fix platform and feature tokens in user agent string
-rw-r--r-- | xbmc/utils/SystemInfo.cpp | 39 | ||||
-rw-r--r-- | xbmc/utils/SystemInfo.h | 3 |
2 files changed, 40 insertions, 2 deletions
diff --git a/xbmc/utils/SystemInfo.cpp b/xbmc/utils/SystemInfo.cpp index 0a363f2ed2..3c39d7c507 100644 --- a/xbmc/utils/SystemInfo.cpp +++ b/xbmc/utils/SystemInfo.cpp @@ -547,13 +547,48 @@ CStdString CSysInfo::GetUnameVersion() } #endif +#if defined(TARGET_WINDOWS) +CStdString CSysInfo::GetUAWindowsVersion() +{ + OSVERSIONINFOEX osvi = {}; + + osvi.dwOSVersionInfoSize = sizeof(osvi); + CStdString strVersion = "Windows NT"; + + if (GetVersionEx((OSVERSIONINFO *)&osvi)) + { + strVersion.AppendFormat(" %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); + } + + SYSTEM_INFO si = {}; + GetSystemInfo(&si); + + BOOL bIsWow = FALSE; + if (IsWow64Process(GetCurrentProcess(), &bIsWow)) + { + if (bIsWow) + { + strVersion.append(";WOW64"); + GetNativeSystemInfo(&si); // different function to read the info under Wow + } + } + + if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) + strVersion.append(";Win64;x64"); + else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64) + strVersion.append(";Win64;IA64"); + + return strVersion; +} +#endif + + CStdString CSysInfo::GetUserAgent() { CStdString result; result = "XBMC/" + g_infoManager.GetLabel(SYSTEM_BUILD_VERSION) + " ("; #if defined(_WIN32) - result += "Windows; "; - result += GetKernelVersion(); + result += GetUAWindowsVersion(); #elif defined(__APPLE__) #if defined(__arm__) result += "iOS; "; diff --git a/xbmc/utils/SystemInfo.h b/xbmc/utils/SystemInfo.h index 89298ce177..c6753d33a9 100644 --- a/xbmc/utils/SystemInfo.h +++ b/xbmc/utils/SystemInfo.h @@ -95,6 +95,9 @@ public: #ifdef _LINUX CStdString GetUnameVersion(); #endif +#if defined(TARGET_WINDOWS) + CStdString CSysInfo::GetUAWindowsVersion(); +#endif CStdString GetUserAgent(); bool HasInternet(); bool IsAppleTV(); |