• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            得到系統(tǒng)版本-操作注冊(cè)表

            #include <windows.h>
            #include <stdio.h>
            #define BUFSIZE 80
            int main()
            {
            OSVERSIONINFOEX osvi;
            BOOL bOsVersionInfoEx;
            // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
            // If that fails, try using the OSVERSIONINFO structure.
            ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
            osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
            if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
            {
            osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
            if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) )
            return FALSE;
            }
            switch (osvi.dwPlatformId)
            {
            // Test for the Windows NT product family.
            case VER_PLATFORM_WIN32_NT:
            // Test for the specific product.
            if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
            printf ("Microsoft Windows Server 2003, ");
            if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
            printf ("Microsoft Windows XP ");
            if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
            printf ("Microsoft Windows 2000 ");
            if ( osvi.dwMajorVersion <= 4 )
            printf("Microsoft Windows NT ");
            // Test for specific product on Windows NT 4.0 SP6 and later.
            if( bOsVersionInfoEx )
            {
            // Test for the workstation type.
            if ( osvi.wProductType == VER_NT_WORKSTATION )
            {
            if( osvi.dwMajorVersion == 4 )
            printf ( "Workstation 4.0 " );
            else if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
            printf ( "Home Edition " );
            else printf ( "Professional " );
            }
            // Test for the server type.
            else if ( osvi.wProductType == VER_NT_SERVER ||
            osvi.wProductType == VER_NT_DOMAIN_CONTROLLER )
            {
            if(osvi.dwMajorVersion==5 && osvi.dwMinorVersion==2)
            {
            if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
            printf ( "Datacenter Edition " );
            else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
            printf ( "Enterprise Edition " );
            else if ( osvi.wSuiteMask == VER_SUITE_BLADE )
            printf ( "Web Edition " );
            else printf ( "Standard Edition " );
            }
            else if(osvi.dwMajorVersion==5 && osvi.dwMinorVersion==0)
            {
            if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
            printf ( "Datacenter Server " );
            else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
            printf ( "Advanced Server " );
            else printf ( "Server " );
            }
            else  // Windows NT 4.0
            {
            if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
            printf ("Server 4.0, Enterprise Edition " );
            else printf ( "Server 4.0 " );
            }
            }
            }
            // Test for specific product on Windows NT 4.0 SP5 and earlier
            else
            {
            HKEY hKey;
            char szProductType[BUFSIZE];
            DWORD dwBufLen=BUFSIZE;
            LONG lRet;
            lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
            "SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
            0, KEY_QUERY_VALUE, &hKey );
            if( lRet != ERROR_SUCCESS )
            return FALSE;
            lRet = RegQueryValueEx( hKey, "ProductType", NULL, NULL,
            (LPBYTE) szProductType, &dwBufLen);
            if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) )
            return FALSE;
            RegCloseKey( hKey );
            if ( lstrcmpi( "WINNT", szProductType) == 0 )
            printf( "Workstation " );
            if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
            printf( "Server " );
            if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
            printf( "Advanced Server " );
            printf( "%d.%d ", osvi.dwMajorVersion, osvi.dwMinorVersion );
            }
            // Display service pack (if any) and build number.
            if( osvi.dwMajorVersion == 4 &&
            lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 )
            {
            HKEY hKey;
            LONG lRet;
            // Test for SP6 versus SP6a.
            lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
            "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009",
            0, KEY_QUERY_VALUE, &hKey );
            if( lRet == ERROR_SUCCESS )
            printf( "Service Pack 6a (Build %d)\n",
            osvi.dwBuildNumber & 0xFFFF );
            else // Windows NT 4.0 prior to SP6a
            {
            printf( "%s (Build %d)\n",
            osvi.szCSDVersion,
            osvi.dwBuildNumber & 0xFFFF);
            }
            RegCloseKey( hKey );
            }
            else // not Windows NT 4.0
            {
            printf( "%s (Build %d)\n",
            osvi.szCSDVersion,
            osvi.dwBuildNumber & 0xFFFF);
            }
            break;
            // Test for the Windows Me/98/95.
            case VER_PLATFORM_WIN32_WINDOWS:
            if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
            {
            printf ("Microsoft Windows 95 ");
            if (osvi.szCSDVersion[1]=='C' || osvi.szCSDVersion[1]=='B')
            printf("OSR2 " );
            }
            if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
            {
            printf ("Microsoft Windows 98 ");
            if ( osvi.szCSDVersion[1] == 'A' )
            printf("SE " );
            }
            if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
            {
            printf ("Microsoft Windows Millennium Edition\n");
            }
            break;
            case VER_PLATFORM_WIN32s:
            printf ("Microsoft Win32s\n");
            break;
            }
            return TRUE;
            }
            

            posted on 2010-05-09 08:11 wrh 閱讀(769) 評(píng)論(0)  編輯 收藏 引用


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            導(dǎo)航

            <2010年11月>
            31123456
            78910111213
            14151617181920
            21222324252627
            2829301234
            567891011

            統(tǒng)計(jì)

            常用鏈接

            留言簿(19)

            隨筆檔案

            文章檔案

            收藏夾

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            精品久久久久久国产| 无码人妻少妇久久中文字幕蜜桃 | 亚洲国产另类久久久精品| 久久久久亚洲av综合波多野结衣| 久久精品国产免费观看| 久久被窝电影亚洲爽爽爽| 久久99亚洲综合精品首页| 久久亚洲AV成人无码软件| 久久久久免费看成人影片| 日韩久久久久中文字幕人妻 | 伊人久久免费视频| 亚洲综合久久夜AV | 久久精品国产半推半就| 亚洲欧美国产日韩综合久久| 久久国产精品99精品国产| 无码精品久久一区二区三区| 久久w5ww成w人免费| 久久综合久久综合亚洲| 日本精品久久久久中文字幕8| 久久人搡人人玩人妻精品首页| 久久久久久亚洲精品成人| 久久综合亚洲色一区二区三区| 久久99精品国产麻豆蜜芽| 久久亚洲高清观看| 久久综合香蕉国产蜜臀AV| 久久综合亚洲色一区二区三区| 久久国产V一级毛多内射| 色综合久久88色综合天天| 精品久久人妻av中文字幕| 亚洲va国产va天堂va久久| 99久久这里只精品国产免费| 国内精品伊人久久久久网站| 国产精品久久久久久一区二区三区 | 免费无码国产欧美久久18| 一本久道久久综合狠狠躁AV| 久久99精品久久久久久9蜜桃| 欧美777精品久久久久网| 波多野结衣中文字幕久久| 久久亚洲AV成人无码国产| 久久99国产乱子伦精品免费| 精品乱码久久久久久久|