../OSInfo.cpp:74:113: warning: passing NULL to non-pointer argument 3 of 'LONG RegOpenKeyExW(HKEY, LPCWSTR, DWORD, REGSAM, PHKEY)' [-Wconversion-null]
err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", NULL, KEY_READ, &key);
^
../OSInfo.cpp: In static member function 'static QString OSInfo::getOSVersion()':
../OSInfo.cpp:197:135: warning: format '%d' expects argument of type 'int', but argument 3 has type 'DWORD {aka long unsigned int}' [-Wformat=]
os.sprintf("%d.%d.%d.%d", ovi.dwMajorVersion, ovi.dwMinorVersion, ovi.dwBuildNumber, (ovi.wProductType == VER_NT_WORKSTATION) ? 1 : 0);
^
../OSInfo.cpp:197:135: warning: format '%d' expects argument of type 'int', but argument 4 has type 'DWORD {aka long unsigned int}' [-Wformat=]
../OSInfo.cpp:197:135: warning: format '%d' expects argument of type 'int', but argument 5 has type 'DWORD {aka long unsigned int}' [-Wformat=]
../OSInfo.cpp: In static member function 'static QString OSInfo::getOSDisplayableVersion()':
../OSInfo.cpp:466:86: warning: format '%d' expects argument of type 'int', but argument 3 has type 'DWORD {aka long unsigned int}' [-Wformat=]
osv.sprintf(" - %d.%d.%d", ovi.dwMajorVersion, ovi.dwMinorVersion, ovi.dwBuildNumber);
^
../OSInfo.cpp:466:86: warning: format '%d' expects argument of type 'int', but argument 4 has type 'DWORD {aka long unsigned int}' [-Wformat=]
../OSInfo.cpp:466:86: warning: format '%d' expects argument of type 'int', but argument 5 has type 'DWORD {aka long unsigned int}' [-Wformat=]
These strings from the registry are NUL terminated, but in practice, this
isn't guaranteed.
This means that the displayable version string for Windows 10 currently
contains NUL values.
The Mumble client doesn't care, but it isn't very nice. It breaks things
like CVP providers that don't sanitize Murmur's output.
To fix the problem, this change introduces a regString function that
converts a wchar_t string to QString. Any NUL value in the input
string will terminate the string.
Fixesmumble-voip/mumble#2469
This change also removes the architecture
from the OSInfo string, since it is noisy.
The old code would always emit "i386", seemingly
since that's the "lowest" fatch arch that the current
OS X x86_64 kernels will run binaries from.
I tried to update the code, but instead of x86_64, I
got "x86_64h", which is Apple's arch string for
Haswell chips.
I don't think it makes sense anymore to have the
architecture string in the OSInfo on OS X. All
Macs running the modern OSes are x86_64 anyway.
Fixesmumble-voip/mumble#1341
The official name for the server version of Windows 10
is "Windows 10 Server Technical Preview" but since
"Technical Preview" is a detail, I haven't included it.
Closes#1435
The OS string from OSInfo is used in places such as log files, and
in the Server Info and User Info dialogs.
I think it'll be beneficial in the long run to be able to
distinguish an x86 build from an amd64 on in these places.
Technically, the full OSInfo dump has an is64bit flag, but it's not
visible in the aforementioned places - only the OS string is. The
isb64bit flag is only used when submitting usage stats.
This adds a new method, OSInfo::getOSDisplayableVersion(),
which returns a version string that is suitable for displaying
to regular users.
Furthermore, Mumble's User Information dialog and Murmur have been
modified to use this new method when displaying OS version strings
to users.
On Windows, the new method returns the full product version of the
OS, such as "Windows 8 Pro" (as opposed to 6.2.9200, which is the
equivalent result of the getOSVersion() method).
There are places in Mumble where the original "simple" version
string is required for compatibility or aesthetic reasons, such
as statistics and Mumble's HTTP user agent. Those places keep
the older version (by keeping their calls to the original
getOSVersion() instead of switching to the "displayable" variant).
It might seem overkill to jump through hoops to be able to show the
full product version, but it can be helpful for, say, server admins
to have access to the full product version if they need to
troubleshoot issues with their users.