From c608fdb8564875a68be12eedb62e2a31cb6e2c6c Mon Sep 17 00:00:00 2001 From: AnotherCommander Date: Thu, 11 Jan 2018 18:32:09 +0100 Subject: [PATCH] Windows port: For cleanness, print UBR in the log only when the UBR registry value is available. --- src/Core/OOCPUInfo.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Core/OOCPUInfo.m b/src/Core/OOCPUInfo.m index a9068e48..185ea198 100644 --- a/src/Core/OOCPUInfo.m +++ b/src/Core/OOCPUInfo.m @@ -109,7 +109,7 @@ NSUInteger OOCPUCount(void) NSString* operatingSystemFullVersion(void) { OSVERSIONINFOW osver; - DWORD UBRValue = 0; + char outUBRString[65] = ""; osver.dwOSVersionInfoSize = sizeof(osver); GetVersionExW (&osver); @@ -122,12 +122,15 @@ NSString* operatingSystemFullVersion(void) DWORD dwUBR = 0; if (RegQueryValueEx(hKey,"UBR", NULL, NULL, (BYTE*)&dwUBR, &dwUBRSize) == ERROR_SUCCESS) { - UBRValue = dwUBR; + char strUBR[64] = ""; + ltoa(dwUBR, strUBR, 10); + strcpy(outUBRString, "."); + strcat(outUBRString, strUBR); } } - return [NSString stringWithFormat:@"%d.%d.%d.%d %S", - osver.dwMajorVersion, osver.dwMinorVersion, osver.dwBuildNumber, UBRValue, osver.szCSDVersion]; + return [NSString stringWithFormat:@"%d.%d.%d%s %S", + osver.dwMajorVersion, osver.dwMinorVersion, osver.dwBuildNumber, outUBRString, osver.szCSDVersion]; } /*