[Spice-commits] common/vdcommon.cpp
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 3 22:43:23 UTC 2019
common/vdcommon.cpp | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
New commits:
commit dc185029ff5ed5cba53881781dff4612575e0b4b
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Nov 29 20:34:41 2019 +0000
vdcommon: Do not use GetVersionEx to get Windows version
GetVersionEx was deprecated by Microsoft in favour of utilities
in versionhelpers.h.
The new function returns the same results as:
- GetVersionEx returns maximum 6.2 version and also 6.0 version
is Vista, not Windows 7 so SYS_VER_WIN_7_CLASS was returned
for all system from Windows Vista;
- We don't support version earlier than Windows XP and no Windows
versions had version >= 5.2 and < 6.0 so SYS_VER_WIN_XP_CLASS
was returned from Windows XP;
- we don't support any system before Windows XP.
Tested under Windows XP, 7 and 10.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/common/vdcommon.cpp b/common/vdcommon.cpp
index bd746bd..d711c4e 100644
--- a/common/vdcommon.cpp
+++ b/common/vdcommon.cpp
@@ -15,24 +15,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdarg.h>
-
#include "vdcommon.h"
+#include <stdarg.h>
+#include <versionhelpers.h>
+
SystemVersion supported_system_version()
{
- OSVERSIONINFOEX osvi;
-
- ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- if (!GetVersionEx((OSVERSIONINFO*)&osvi)) {
- vd_printf("GetVersionEx() failed: %lu", GetLastError());
- return SYS_VER_UNSUPPORTED;
+ if (IsWindowsVistaOrGreater()) {
+ return SYS_VER_WIN_7_CLASS;
}
- if (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion == 1 || osvi.dwMinorVersion == 2)) {
+ if (IsWindowsXPOrGreater()) {
return SYS_VER_WIN_XP_CLASS;
- } else if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 0 && osvi.dwMinorVersion <= 2) {
- return SYS_VER_WIN_7_CLASS;
}
return SYS_VER_UNSUPPORTED;
}
More information about the Spice-commits
mailing list