Windows Version Verification

BOOL IsWin7OrLater()
{
    // Initialization.
    OSVERSIONINFOEX osVerInfo = {};
    osVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
    osVerInfo.dwMajorVersion = 6;
    osVerInfo.dwMinorVersion = 1;
    // Set condition.
    DWORDLONG conditionMask = 0;
    int op = VER_GREATER_EQUAL;
    VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, op);
    VER_SET_CONDITION(conditionMask, VER_MINORVERSION, op);

    // Verification.
    return VerifyVersionInfo(&osVerInfo, 
                             VER_MAJORVERSION | VER_MINORVERSION , 
                             conditionMask);
}

 

Operating systemVersion number
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-Bit Edition 5.2
Windows XP 5.1
Windows 2000 5.0

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx

posted @ 2012-08-07 09:41  walfud  阅读(472)  评论(0编辑  收藏  举报