diff options
author | Underground78 <underground78@users.sourceforge.net> | 2012-06-09 16:03:49 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2012-06-09 16:03:49 +0400 |
commit | d93173e3af0cacc4b295e3fb2f588d6e0c59b5fe (patch) | |
tree | 8779d5810e1e300fd3640ba1bcbc28ce1a95151d /src/DSUtil/SysVersion.h | |
parent | 18187f322ca29ce4e03d27a4769e3bc214395125 (diff) |
Move the IsWin* functions into an helper class. The OS version is now cached and the function calls properly inlined.
This code was inspired by TortoiseSVN's SysInfo class.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5057 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/DSUtil/SysVersion.h')
-rw-r--r-- | src/DSUtil/SysVersion.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/DSUtil/SysVersion.h b/src/DSUtil/SysVersion.h new file mode 100644 index 000000000..231db4e6d --- /dev/null +++ b/src/DSUtil/SysVersion.h @@ -0,0 +1,46 @@ +/*
+ * $Id$
+ *
+ * (C) 2012 see Authors.txt
+ *
+ * This file is part of MPC-HC.
+ *
+ * MPC-HC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * MPC-HC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <Windows.h>
+
+class SysVersion
+{
+ SysVersion() {};
+
+ static OSVERSIONINFOEX InitFullVersion();
+
+ static const OSVERSIONINFOEX fullVersion;
+ static const DWORD version;
+
+public:
+ static OSVERSIONINFOEX GetFullVersion() { return fullVersion; }
+ static DWORD GetVersion() { return version; }
+
+ static bool IsXPOrLater() { return (version >= 0x0501); }
+ static bool IsVista() { return (version == 0x0600); }
+ static bool IsVistaOrLater() { return (version >= 0x0600); }
+ static bool Is7() { return (version == 0x0601); }
+ static bool Is7OrLater() { return (version >= 0x0601); }
+ //static bool Is8() { return (version == 0x0602); }
+};
|