• <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>

            得到系統版本-操作注冊表

            #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 閱讀(767) 評論(0)  編輯 收藏 引用

            導航

            <2010年5月>
            2526272829301
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            統計

            常用鏈接

            留言簿(19)

            隨筆檔案

            文章檔案

            收藏夾

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久久中文字幕日本| 99久久无色码中文字幕| 久久噜噜久久久精品66| 一级A毛片免费观看久久精品| 久久午夜无码鲁丝片午夜精品| 久久久久波多野结衣高潮| 久久亚洲AV成人无码国产| 99久久人妻无码精品系列蜜桃| 国产成人精品久久亚洲高清不卡| 香蕉99久久国产综合精品宅男自 | 一级做a爰片久久毛片看看| 久久久久亚洲精品日久生情| 国产精品久久自在自线观看| 日批日出水久久亚洲精品tv| 潮喷大喷水系列无码久久精品| 日日狠狠久久偷偷色综合0 | 久久黄视频| 99精品国产在热久久无毒不卡| 性做久久久久久久久老女人| 精品久久一区二区三区| 久久久久亚洲AV片无码下载蜜桃| 精品国产91久久久久久久a| 色综合久久综合中文综合网| 午夜精品久久久久成人| 中文字幕亚洲综合久久2| 国内精品人妻无码久久久影院| 伊色综合久久之综合久久| 品成人欧美大片久久国产欧美...| 亚洲精品tv久久久久久久久| 一级女性全黄久久生活片免费 | 97超级碰碰碰久久久久| 国产精品乱码久久久久久软件| 激情久久久久久久久久| 亚洲国产天堂久久综合网站| 99久久国语露脸精品国产| 久久天天躁狠狠躁夜夜96流白浆| 久久久久久曰本AV免费免费| 色播久久人人爽人人爽人人片AV| 三级韩国一区久久二区综合 | 久久人搡人人玩人妻精品首页| 久久国产精品免费一区二区三区 |