티스토리 뷰
728x90
#include <iostream>
#include <windows.h>
typedef LONG NTSTATUS, * PNTSTATUS;
#define STATUS_SUCCESS (0x00000000)
extern "C" NTSTATUS NTAPI RtlGetVersion( PRTL_OSVERSIONINFOW lpVersionInformation );
#ifndef NT_SUCCESS
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
#endif
class cWinVersion
{
DECLARE_NO_SELF_CLASS( nxcWinVersion );
static bool IsSystem64Bit() {
SYSTEM_INFO si;
GetNativeSystemInfo( &si );
// PROCESSOR_ARCHITECTURE_AMD64 indicates 64-bit, PROCESSOR_ARCHITECTURE_INTEL indicates 32-bit
return si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
}
static bool IsWow64Mode() {
BOOL bIsWow64 = FALSE;
if( IsWow64Process( GetCurrentProcess(), &bIsWow64 ) ) {
if( bIsWow64 ) {
std::cout << "Architecture: 64-bit system\n";
}
else {
std::cout << "Architecture: 32-bit system\n";
}
}
else {
std::cout << "Failed to determine architecture.\n";
}
return bIsWow64;
}
static bool IsWin11() {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof( rovi );
NTSTATUS status = RtlGetVersion( &rovi );
return NT_SUCCESS( status ) && rovi.dwMajorVersion == 10 && rovi.dwBuildNumber >= 22000;
}
static bool IsWin10() {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof( rovi );
NTSTATUS status = RtlGetVersion( &rovi );
return NT_SUCCESS( status ) && rovi.dwMajorVersion == 10 && rovi.dwBuildNumber < 22000;
}
static bool IsWin8_1() {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof( rovi );
NTSTATUS status = RtlGetVersion( &rovi );
return NT_SUCCESS( status ) && rovi.dwMajorVersion == 6 && rovi.dwMinorVersion == 3;
}
static bool IsWin8() {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof( rovi );
NTSTATUS status = RtlGetVersion( &rovi );
return NT_SUCCESS( status ) && rovi.dwMajorVersion == 6 && rovi.dwMinorVersion == 2;
}
static bool IsWin7() {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof( rovi );
NTSTATUS status = RtlGetVersion( &rovi );
return NT_SUCCESS( status ) && rovi.dwMajorVersion == 6 && rovi.dwMinorVersion == 1;
}
static bool IsWinVista() {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof( rovi );
NTSTATUS status = RtlGetVersion( &rovi );
return NT_SUCCESS( status ) && rovi.dwMajorVersion == 6 && rovi.dwMinorVersion == 0;
}
static bool IsWinXp() {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof( rovi );
NTSTATUS status = RtlGetVersion( &rovi );
return NT_SUCCESS( status ) && rovi.dwMajorVersion == 5 && (rovi.dwMinorVersion == 1 || rovi.dwMinorVersion == 2);
}
};
반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Effective c++
- script
- OpenSource
- 울릉도
- 외돌개
- DLL
- 패턴
- C
- 서귀포
- 암호화
- Build
- 블루버블
- 제주도
- PowerShell
- 현포다이브
- 블루버블다이브팀
- 서귀포블루버블
- C++
- C#.NET
- C# 고급 기술
- 스쿠버다이빙
- Windows
- Linux
- 블루버블다이빙팀
- C#
- effective
- 네트워크 정보
- 성산블루버블
- 스쿠버 다이빙
- CMake
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함
250x250