物理层与综合布线【笔记】
2014-04-18 23:48
274 查看
一般由系统的dwMajorVersion和dwMinorVersion就可以得到系统版本:
Windows 3.0,
Windows 3.1,
Windows NT, 95(4.0),
Windows 2000 (5.0),
Windows XP (5.1), ....
Windows 7 (6.1), ..... ,
Windows 8.1 (6.3)
struct WindowsNTOSInfo
{
DWORD dwMajorVersion;
DWORD dwMinorVersion;
WORD wServicePackMajor;
//const TCHAR * pcszOSDisplayName;
};
const WindowsNTOSInfo KnownVersionsOfWindows[] =
{
{ 6, 3, 0, },//win8.1,server2012 r2
{ 6, 2, 0, },//win8,server2012
{ 6, 1, 1, },//win7,win2008r2 sp1
{ 6, 1, 0, },//win7,win2008r2
{ 5, 1, 3, },//winxp sp3
{ 5, 1, 2, },//winxp sp2
{ 5, 1, 1, },//winxp sp1
{ 5, 1, 0, },//winxp
{ 6, 0, 2, },//WinVista,server2008 SP2
{ 6, 0, 1, },//WinVista,Server2008 Sp1
{ 6, 0, 0, },//WinVista,Server2008
{ 5, 2, 2, },//Windows Server 2003 Sp2
{ 5, 2, 1, },//Windows Server 2003 Sp1
{ 5, 2, 0, },//Windows Server 2003
{ 5, 1, 4, }, //Windows Server 2000 Sp4
{ 5, 1, 3, }, //Windows Server 2000 Sp3
{ 5, 1, 2, }, //Windows Server 2000 Sp2
{ 5, 1, 2, }, //Windows Server 2000 Sp1
{ 5, 1, 0, }, //Windows Server 2000
};
以下程序可以得出系统是win7还是xp
1)采用VerifyVersionInfo函数
2).
本文出自 “whatever957” 博客,请务必保留此出处http://whatever957.blog.51cto.com/6835003/1633745
Windows 3.0,
Windows 3.1,
Windows NT, 95(4.0),
Windows 2000 (5.0),
Windows XP (5.1), ....
Windows 7 (6.1), ..... ,
Windows 8.1 (6.3)
struct WindowsNTOSInfo
{
DWORD dwMajorVersion;
DWORD dwMinorVersion;
WORD wServicePackMajor;
//const TCHAR * pcszOSDisplayName;
};
const WindowsNTOSInfo KnownVersionsOfWindows[] =
{
{ 6, 3, 0, },//win8.1,server2012 r2
{ 6, 2, 0, },//win8,server2012
{ 6, 1, 1, },//win7,win2008r2 sp1
{ 6, 1, 0, },//win7,win2008r2
{ 5, 1, 3, },//winxp sp3
{ 5, 1, 2, },//winxp sp2
{ 5, 1, 1, },//winxp sp1
{ 5, 1, 0, },//winxp
{ 6, 0, 2, },//WinVista,server2008 SP2
{ 6, 0, 1, },//WinVista,Server2008 Sp1
{ 6, 0, 0, },//WinVista,Server2008
{ 5, 2, 2, },//Windows Server 2003 Sp2
{ 5, 2, 1, },//Windows Server 2003 Sp1
{ 5, 2, 0, },//Windows Server 2003
{ 5, 1, 4, }, //Windows Server 2000 Sp4
{ 5, 1, 3, }, //Windows Server 2000 Sp3
{ 5, 1, 2, }, //Windows Server 2000 Sp2
{ 5, 1, 2, }, //Windows Server 2000 Sp1
{ 5, 1, 0, }, //Windows Server 2000
};
以下程序可以得出系统是win7还是xp
1)采用VerifyVersionInfo函数
BOOL IsWin7() { OSVERSIONINFOEX osvi; DWORDLONG dwlConditionMask = 0; // Initialize the OSVERSIONINFOEX structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = 6; osvi.dwMinorVersion = 1; //osvi.wServicePackMajor = 1; // Initialize the condition mask. VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_EQUAL); VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_EQUAL); //VER_SET_CONDITION(dwlConditionMask, VER_SERVICEPACKMAJOR, VER_EQUAL); // Perform the test. return VerifyVersionInfo( &osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask); } BOOL IsXP() { OSVERSIONINFOEX osvi; DWORDLONG dwlConditionMask = 0; // Initialize the OSVERSIONINFOEX structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = 5; osvi.dwMinorVersion = 1; //osvi.wServicePackMajor = 1; // Initialize the condition mask. VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_EQUAL); VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_EQUAL); //VER_SET_CONDITION(dwlConditionMask, VER_SERVICEPACKMAJOR, VER_EQUAL); // Perform the test. return VerifyVersionInfo( &osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask); } int _tmain(int argc, TCHAR* argv[]) { if (IsWin7()) cout << "win 7" << endl; else if (IsXP()) cout << "xp" << endl; else cout << "unrecognized system" << endl; system("pause"); return 0; }
2).
#include <iostream> #include <Windows.h> // VersionHelpers.h 依赖于 windows.h #include <VersionHelpers.h> // Windows SDK 8.1 才有喔 using namespace std; int main(void) { if (IsWindows8OrGreater()) cout << "Win 8" << endl; else if (IsWindows7OrGreater()) cout << "Win 7" << endl; else if (IsWindowsXPOrGreater()) cout << "xp" << endl; else cout << "unrecognized system" << endl; system("pause"); }
本文出自 “whatever957” 博客,请务必保留此出处http://whatever957.blog.51cto.com/6835003/1633745
相关文章推荐
- 综合布线笔记1
- 综合布线笔记2
- 综合布线设计---运维笔记
- 综合布线系统的施工要点和经验
- SpriteKit学习笔记 - - - 物理系统
- 综合布线系统
- 回顾中国综合布线市场发展历程 推荐
- LTE学习笔记4之物理层信道与信号
- 综合布线系统解决方案(二)
- 转载 关于物理综合优化
- Cocos2d-x 3.x学习笔记:猩先生带你打飞机(三)物理引擎的使用
- 综合布线屏蔽系统的现状与应用
- 汇编学习笔记---2.2物理地址计算
- (笔记)《SQL 2005 技术内幕 T-SQL查询》第二章 物理查询处理
- 802.11笔记:物理层概述
- 文件系统笔记一、磁盘物理结构
- 图形化的机房综合布线管理系统的数据录入
- .net开发笔记之三:取得与虚拟路径关联的物理路径
- ReactNative 学习笔记 物理back键
- html笔记05:html、css、javascript综合案例