• <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>
            隨筆 - 505  文章 - 1034  trackbacks - 0
            <2008年3月>
            2425262728291
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345


            子曾經曰過:編程無他,唯手熟爾!

            常用鏈接

            留言簿(94)

            隨筆分類(649)

            隨筆檔案(505)

            相冊

            BCB

            Crytek

            • crymod
            • Crytek's Offical Modding Portal

            Game Industry

            OGRE

            other

            Programmers

            Qt

            WOW Stuff

            搜索

            •  

            積分與排名

            • 積分 - 911304
            • 排名 - 14

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            今天用到這個了

            http://msdn2.microsoft.com/en-us/library/ms724429.aspx

            #include <windows.h>
            #include 
            <tchar.h>
            #include 
            <stdio.h>

            #define BUFSIZE 80

            typedef 
            void (WINAPI *PGNSI)(LPSYSTEM_INFO);

            int __cdecl _tmain()
            {
               OSVERSIONINFOEX osvi;
               SYSTEM_INFO si;
               PGNSI pGNSI;
               BOOL bOsVersionInfoEx;

               ZeroMemory(
            &si, sizeof(SYSTEM_INFO));
               ZeroMemory(
            &osvi, sizeof(OSVERSIONINFOEX));

               
            // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
               
            // If that fails, try using the OSVERSIONINFO structure.

               osvi.dwOSVersionInfoSize 
            = sizeof(OSVERSIONINFOEX);

               
            if!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *&osvi)) )
               {
                  osvi.dwOSVersionInfoSize 
            = sizeof (OSVERSIONINFO);
                  
            if (! GetVersionEx ( (OSVERSIONINFO *&osvi) ) 
                     
            return FALSE;
               }

               
            // Call GetNativeSystemInfo if supported
               
            // or GetSystemInfo otherwise.

               pGNSI 
            = (PGNSI) GetProcAddress(
                  GetModuleHandle(TEXT(
            "kernel32.dll")), 
                  
            "GetNativeSystemInfo");
               
            if(NULL != pGNSI)
                  pGNSI(
            &si);
               
            else GetSystemInfo(&si);

               
            switch (osvi.dwPlatformId)
               {
                  
            // Test for the Windows NT product family.

                  
            case VER_PLATFORM_WIN32_NT:

                  
            // Test for the specific product.

                  
            if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 )
                  {
                     
            if( osvi.wProductType == VER_NT_WORKSTATION )
                         printf (
            "Windows Vista ");
                     
            else printf ("Windows Server \"Longhorn\" " );
                  }

                  
            if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
                  {
                     
            if( GetSystemMetrics(SM_SERVERR2) )
                        printf( 
            "Microsoft Windows Server 2003 \"R2\" ");
                     
            else if( osvi.wProductType == VER_NT_WORKSTATION &&
                        si.wProcessorArchitecture
            ==PROCESSOR_ARCHITECTURE_AMD64)
                     {
                        printf( 
            "Microsoft Windows XP Professional x64 Edition ");
                     }
                     
            else 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 &&
                          si.wProcessorArchitecture
            !=PROCESSOR_ARCHITECTURE_AMD64)
                     {
                        
            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 ( si.wProcessorArchitecture ==
                                PROCESSOR_ARCHITECTURE_IA64 )
                           {
                               
            if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
                                  printf ( 
            "Datacenter Edition "
                                           
            "for Itanium-based Systems" );
                               
            else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
                                  printf ( 
            "Enterprise Edition "
                                           
            "for Itanium-based Systems" );
                           }

                           
            else if ( si.wProcessorArchitecture ==
                                     PROCESSOR_ARCHITECTURE_AMD64 )
                           {
                               
            if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
                                  printf ( 
            "Datacenter x64 Edition " );
                               
            else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
                                  printf ( 
            "Enterprise x64 Edition " );
                               
            else printf( "Standard x64 Edition " );
                           }

                           
            else
                           {
                               
            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;
                     TCHAR szProductType[BUFSIZE];
                     DWORD dwBufLen
            =BUFSIZE*sizeof(TCHAR);
                     LONG lRet;

                     lRet 
            = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
                        TEXT(
            "SYSTEM\\CurrentControlSet\\Control\\"
                             
            "ProductOptions"), 0, KEY_QUERY_VALUE, &hKey );
                     
            if( lRet != ERROR_SUCCESS )
                        
            return FALSE;

                     lRet 
            = RegQueryValueEx( hKey, TEXT("ProductType"),
                        NULL, NULL, (LPBYTE) szProductType, 
            &dwBufLen);
                     RegCloseKey( hKey );

                     
            if( (lRet != ERROR_SUCCESS) ||
                         (dwBufLen 
            > BUFSIZE*sizeof(TCHAR)) )
                        
            return FALSE;

                     
            if ( lstrcmpi( TEXT("WINNT"), szProductType) == 0 )
                        printf( 
            "Workstation " );
                     
            if ( lstrcmpi( TEXT("LANMANNT"), szProductType) == 0 )
                        printf( 
            "Server " );
                     
            if ( lstrcmpi( TEXT("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, TEXT(
            "Service Pack 6") ) == 0 )
                  { 
                     HKEY hKey;
                     LONG lRet;

                     
            // Test for SP6 versus SP6a.
                     lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
                        TEXT(
            "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
                     {
                        _tprintf( TEXT(
            "%s (Build %d)\n"),
                           osvi.szCSDVersion,
                           osvi.dwBuildNumber 
            & 0xFFFF);
                     }

                     RegCloseKey( hKey );
                  }
                  
            else // not Windows NT 4.0 
                  {
                     _tprintf( TEXT(
            "%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' || osvi.szCSDVersion[1]=='B')
                         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 2007-05-09 20:49 七星重劍 閱讀(1117) 評論(1)  編輯 收藏 引用 所屬分類: PL--c/c++

            FeedBack:
            # re: 判斷操作系統版本 2007-05-23 21:36 秒大刀
            阿來加油!你是最棒的!  回復  更多評論
              
            久久九九免费高清视频| 大伊人青草狠狠久久| 久久99久久成人免费播放| 久久精品亚洲男人的天堂| 亚洲AⅤ优女AV综合久久久| 中文精品久久久久人妻不卡| 久久水蜜桃亚洲av无码精品麻豆 | 久久亚洲高清综合| 欧美日韩精品久久久久| 久久99精品久久只有精品| 精品一久久香蕉国产线看播放| 精品国产乱码久久久久软件| 久久99国产精品久久| 久久乐国产综合亚洲精品| 久久精品国内一区二区三区| 青青青青久久精品国产h久久精品五福影院1421 | 久久久久99精品成人片欧美| 久久精品国产99国产精品| 日韩av无码久久精品免费| 久久影院久久香蕉国产线看观看| 亚洲熟妇无码另类久久久| 久久免费视频一区| 久久91精品久久91综合| 亚洲AV无码1区2区久久| 日韩欧美亚洲国产精品字幕久久久| 久久国产色AV免费观看| 中文字幕精品久久久久人妻| 国产L精品国产亚洲区久久| 久久大香香蕉国产| 日产精品99久久久久久| 天天影视色香欲综合久久| 国产亚洲美女精品久久久| 久久精品一区二区三区不卡| 久久婷婷国产综合精品| 伊人久久大香线蕉综合影院首页| 久久久国产亚洲精品| 日日狠狠久久偷偷色综合免费| 品成人欧美大片久久国产欧美...| 久久国产精品久久国产精品| avtt天堂网久久精品| 99久久99这里只有免费的精品|