다음 표에는 가장 최근의 운영 체제 버전 번호가 요약됩니다.
운영 체제버전 번호
Windows 11 | 10.0* |
Windows 10 | 10.0* |
Windows Server 2022 | 10.0* |
Windows Server 2019 | 10.0* |
Windows Server 2016 | 10.0* |
Windows 8.1 | 6.3* |
Windows Server 2012 R2 | 6.3* |
Windows 8 | 6.2 |
Windows Server 2012 | 6.2 |
Windows 7 | 6.1 |
Windows Server 2008 R2 | 6.1 |
Windows Server 2008 | 6.0 |
Windows Vista | 6.0 |
Windows Server 2003 R2 | 5.2 |
Windows Server 2003 | 5.2 |
Windows XP 64비트 버전 | 5.2 |
Windows XP | 5.1 |
Windows 2000 | 5.0 |
https://learn.microsoft.com/ko-kr/windows/win32/sysinfo/operating-system-version
운영 체제 버전 - Win32 apps
버전 API 도우미 함수는 현재 실행 중인 운영 체제의 버전을 결정하는 데 사용됩니다. 자세한 내용은 시스템 버전 가져오기를 참조하세요.
learn.microsoft.com
소스코드
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
|
#include <stdio.h>
#include <Windows.h>
#include <Lm.h>
#pragma comment(lib, "netapi32.lib")
int GetWindowsMajorVersionNumber();
BOOL GetNetWinVersion(DWORD &dwMajor, DWORD &dwMinor);
BOOL IsWindows10OrLater();
void main()
{
if (IsWindows10OrLater())
printf("10이상\n");
else
printf("10미만\n");
}
int GetWindowsMajorVersionNumber()
{
LONG lResult;
HKEY hKey;
DWORD dwType;
DWORD dwBytes;
int buffer = 0;
// open Regstry Key
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
0, KEY_QUERY_VALUE, &hKey);
if (lResult != ERROR_SUCCESS)
{
return -1;
}
// Read Regstry Key
lResult = RegQueryValueEx(hKey, L"CurrentMajorVersionNumber", 0, &dwType, (LPBYTE)&buffer, &dwBytes);
if (lResult == ERROR_SUCCESS)
return buffer;
RegCloseKey(hKey);
return -1;
}
BOOL GetNetWinVersion(DWORD &dwMajor, DWORD &dwMinor)
{
DWORD dwMajorCache = 0, dwMinorCache = 0;
if (0 != dwMajorCache)
{
dwMajor = dwMajorCache;
dwMinor = dwMinorCache;
return TRUE;
}
LPWKSTA_INFO_100 pBuf = NULL;
if (NERR_Success != NetWkstaGetInfo(NULL, 100, (LPBYTE*)&pBuf))
return FALSE;
dwMajor = dwMajorCache = pBuf->wki100_ver_major;
dwMinor = dwMinorCache = pBuf->wki100_ver_minor;
NetApiBufferFree(pBuf);
printf("Major : %d Minor : %d\n", dwMajor, dwMinor);
return TRUE;
}
BOOL IsWindows10OrLater()
{
DWORD mg = 0, mn = 0;
GetNetWinVersion(mg, mn);
if (mg >= 10)
return TRUE;
if (GetWindowsMajorVersionNumber() >= 10)
return TRUE;
return FALSE;
}
|
cs |
'C++ > C++ 코드 기록' 카테고리의 다른 글
디렉터리에 파일 나열 (0) | 2022.11.04 |
---|---|
레지스트리 값 구하는 방법 (0) | 2022.11.04 |
shlwapi 의 파일 경로 관련 API 모음 (0) | 2022.07.12 |
c++ UTF-8 인코딩 (0) | 2022.01.24 |
c/c++ 문자열 변환 : 멀티바이트 <-> 유니코드 <-> UTF-8 (0) | 2021.10.23 |