summaryrefslogtreecommitdiff
path: root/zen/win_ver.h
blob: ca075bbefcf47672bfa357ace32511d0d1d2381a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html       *
// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de)                    *
// **************************************************************************

#ifndef WINDOWS_VERSION_HEADER_238470348254325
#define WINDOWS_VERSION_HEADER_238470348254325

#include "win.h"

namespace zen
{
bool winXpOrLater();
bool winServer2003orLater();
bool vistaOrLater();
bool win7OrLater();


















//######################### implementation #########################
namespace impl
{
inline
bool winXyOrLater(DWORD major, DWORD minor)
{
    OSVERSIONINFO osvi = {};
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    if (::GetVersionEx(&osvi))
        return osvi.dwMajorVersion > major ||
               (osvi.dwMajorVersion == major && osvi.dwMinorVersion >= minor);
    return false;
}
}

//version overview: http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx

//2000        is version 5.0
//XP          is version 5.1
//Server 2003 is version 5.2
//Vista       is version 6.0
//Seven       is version 6.1

inline
bool winXpOrLater() { return impl::winXyOrLater(5, 1); }

inline
bool winServer2003orLater() { return impl::winXyOrLater(5, 2); }

inline
bool vistaOrLater() { return impl::winXyOrLater(6, 0); }

inline
bool win7OrLater() { return impl::winXyOrLater(6, 1); }
}

#endif //WINDOWS_VERSION_HEADER_238470348254325
bgstack15