-
Notifications
You must be signed in to change notification settings - Fork 0
/
os_version.h
139 lines (123 loc) · 4.6 KB
/
os_version.h
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef __OS_VERSION_H
#define __OS_VERSION_H
///////////////////////////////////////////////////////////////////////////////
//
// AutoIt
//
// Copyright (C)1999-2003:
// - Jonathan Bennett <jon@hiddensoft.com>
// - Others listed at http://www.autoitscript.com/autoit3/docs/credits.htm
//
// This program 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 2 of the License, or
// (at your option) any later version.
//
///////////////////////////////////////////////////////////////////////////////
//
// os_version.h
//
// A standalone class for easy checking of the OS version.
//
///////////////////////////////////////////////////////////////////////////////
// Includes
#include <windows.h>
class OS_Version
{
public:
// Functions
OS_Version() { Init(); } // Constructor
void Init(void); // Call first before use
#ifdef CONFIG_WIN9X
bool IsWinNT(void) {return m_bWinNT;} // Returns true if NT/2k/XP and family.
bool IsWin9x(void) {return m_bWin9x;} // Returns true if 9x
#else // VC++ 2008: Win9x is not supported.
bool IsWinNT(void) {return true;}
bool IsWin9x(void) {return false;}
#endif
#ifdef CONFIG_WIN2K
bool IsWin2000(void) {return m_bWin2000;} // Returns true if Win2000
#else
bool IsWin2000(void) {return false;}
#endif
bool IsWinXP(void) {return m_bWinXP;} // Returns true if WinXP
bool IsWin2003(void) {return m_bWin2003;} // Returns true if Win2003
bool IsWinVista(void) {return m_bWinVista;} // Returns true if WinVista (v1.0.44.13)
bool IsWin7(void) {return m_bWin7; } // Returns true if Win7
bool IsWin8(void) {return m_bWin8; } // Returns true if Win8
bool IsWin8_1(void) {return m_bWin8_1; } // Returns true if Win8.1
#if defined(CONFIG_WIN9X) || defined(CONFIG_WINNT4)
bool IsWin2000orLater(void) {return m_bWin2000orLater;} // Returns true if Win2000+
#else
bool IsWin2000orLater(void) {return true;}
#endif
#ifdef CONFIG_WIN2K
bool IsWinXPorLater(void) {return m_bWinXPorLater;} // Returns true if WinXP+
#else
bool IsWinXPorLater(void) {return true;}
#endif
bool IsWinVistaOrLater(void) {return m_bWinVistaOrLater;}// Returns true if WinVista or later (v1.0.48.01)
bool IsWin7OrLater(void) {return m_bWin7OrLater; } // Returns true if Win7+
#ifdef CONFIG_WIN9X
bool IsWin95(void) {return m_bWin95;} // Returns true if 95
bool IsWin98(void) {return m_bWin98;} // Returns true if 98
bool IsWinMe(void) {return m_bWinMe;} // Returns true if Me
bool IsWin95orLater(void) {return m_bWin95orLater;} // Returns true if 95+
bool IsWin98orLater(void) {return m_bWin98orLater;} // Returns true if 98+
bool IsWinMeorLater(void) {return m_bWinMeorLater;} // Returns true if Me+
#else // VC++ 2008: "The Windows 95, Windows 98, Windows ME, and Windows NT platforms are no longer supported."
bool IsWin95(void) {return false;}
bool IsWin98(void) {return false;}
bool IsWinMe(void) {return false;}
bool IsWin95orLater(void) {return false;}
bool IsWin98orLater(void) {return false;}
bool IsWinMeorLater(void) {return false;}
#endif
#ifdef CONFIG_WINNT4
bool IsWinNT4(void) {return m_bWinNT4;} // Returns true if WinNT 4
bool IsWinNT4orLater(void) {return m_bWinNT4orLater;} // Returns true if WinNT 4+
#else
bool IsWinNT4(void) {return false;}
bool IsWinNT4orLater(void) {return true;}
#endif
DWORD BuildNumber(void) {return m_dwBuildNumber;}
//LPCTSTR CSD(void) {return m_szCSDVersion;}
LPCTSTR Version() {return m_szVersion;}
private:
// Variables
OSVERSIONINFOW m_OSvi; // OS Version data
DWORD m_dwMajorVersion; // Major OS version
DWORD m_dwMinorVersion; // Minor OS version
DWORD m_dwBuildNumber; // Build number
//TCHAR m_szCSDVersion[128];
TCHAR m_szVersion[32]; // "Major.Minor.Build" -- longest known number is 9 chars (plus terminator), but 32 should be future-proof.
#ifdef CONFIG_WIN9X
bool m_bWinNT;
bool m_bWin9x;
bool m_bWin95;
bool m_bWin95orLater;
bool m_bWin98;
bool m_bWin98orLater;
bool m_bWinMe;
bool m_bWinMeorLater;
#endif
#ifdef CONFIG_WINNT4
bool m_bWinNT4;
bool m_bWinNT4orLater;
#endif
#ifdef CONFIG_WIN2K
bool m_bWin2000;
bool m_bWin2000orLater; // For simplicity, this is always left in even though it is not used when !(CONFIG_WIN9X || CONFIG_WINNT4).
bool m_bWinXPorLater;
#endif
bool m_bWinXP;
bool m_bWin2003;
bool m_bWinVista;
bool m_bWinVistaOrLater;
bool m_bWin7;
bool m_bWin7OrLater;
bool m_bWin8;
bool m_bWin8_1;
};
///////////////////////////////////////////////////////////////////////////////
#endif