src/windows/native/java/lang/java_props_md.c

Print this page




 697             GetSystemInfo(&si);
 698 
 699         /*
 700          * From msdn page on OSVERSIONINFOEX, current as of this
 701          * writing, decoding of dwMajorVersion and dwMinorVersion.
 702          *
 703          *  Operating system            dwMajorVersion  dwMinorVersion
 704          * ==================           ==============  ==============
 705          *
 706          * Windows 95                   4               0
 707          * Windows 98                   4               10
 708          * Windows ME                   4               90
 709          * Windows 3.51                 3               51
 710          * Windows NT 4.0               4               0
 711          * Windows 2000                 5               0
 712          * Windows XP 32 bit            5               1
 713          * Windows Server 2003 family   5               2
 714          * Windows XP 64 bit            5               2
 715          *       where ((&ver.wServicePackMinor) + 2) = 1
 716          *       and  si.wProcessorArchitecture = 9
 717          * Windows Vista family         6               0
 718          * Windows 2008                 6               0
 719          *       where ((&ver.wServicePackMinor) + 2) = 1
 720          * Windows 7                    6               1
 721          *
 722          * This mapping will presumably be augmented as new Windows
 723          * versions are released.
 724          */
 725         switch (ver.dwPlatformId) {
 726         case VER_PLATFORM_WIN32s:
 727             sprops.os_name = "Windows 3.1";
 728             break;
 729         case VER_PLATFORM_WIN32_WINDOWS:
 730            if (ver.dwMajorVersion == 4) {
 731                 switch (ver.dwMinorVersion) {
 732                 case  0: sprops.os_name = "Windows 95";           break;
 733                 case 10: sprops.os_name = "Windows 98";           break;
 734                 case 90: sprops.os_name = "Windows Me";           break;
 735                 default: sprops.os_name = "Windows 9X (unknown)"; break;
 736                 }
 737             } else {
 738                 sprops.os_name = "Windows 9X (unknown)";
 739             }
 740             break;


 751                     *
 752                     * "Because the version numbers for Windows Server 2003
 753                     * and Windows XP 6u4 bit are identical, you must also test
 754                     * whether the wProductType member is VER_NT_WORKSTATION.
 755                     * and si.wProcessorArchitecture is
 756                     * PROCESSOR_ARCHITECTURE_AMD64 (which is 9)
 757                     * If it is, the operating system is Windows XP 64 bit;
 758                     * otherwise, it is Windows Server 2003."
 759                     */
 760                     if(ver.wProductType == VER_NT_WORKSTATION &&
 761                        si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
 762                         sprops.os_name = "Windows XP"; /* 64 bit */
 763                     } else {
 764                         sprops.os_name = "Windows 2003";
 765                     }
 766                     break;
 767                 default: sprops.os_name = "Windows NT (unknown)"; break;
 768                 }
 769             } else if (ver.dwMajorVersion == 6) {
 770                 /*
 771                  * From MSDN OSVERSIONINFOEX documentation:
 772                  *
 773                  * "Because the version numbers for Windows Server 2008
 774                  * and Windows Vista are identical, you must also test
 775                  * whether the wProductType member is VER_NT_WORKSTATION.
 776                  * If wProductType is VER_NT_WORKSTATION, the operating
 777                  * system is Windows Vista or 7; otherwise, it is Windows
 778                  * Server 2008."
 779                  */
 780                 if (ver.wProductType == VER_NT_WORKSTATION) {
 781                     switch (ver.dwMinorVersion) {
 782                     case  0: sprops.os_name = "Windows Vista";        break;
 783                     case  1: sprops.os_name = "Windows 7";            break;
 784                     default: sprops.os_name = "Windows NT (unknown)";
 785                     }
 786                 } else {
 787                     sprops.os_name = "Windows Server 2008";



 788                 }

 789             } else {
 790                 sprops.os_name = "Windows NT (unknown)";
 791             }
 792             break;
 793         default:
 794             sprops.os_name = "Windows (unknown)";
 795             break;
 796         }
 797         sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion);
 798         sprops.os_version = strdup(buf);
 799 #if _M_IA64
 800         sprops.os_arch = "ia64";
 801 #elif _M_AMD64
 802         sprops.os_arch = "amd64";
 803 #elif _X86_
 804         sprops.os_arch = "x86";
 805 #else
 806         sprops.os_arch = "unknown";
 807 #endif
 808 




 697             GetSystemInfo(&si);
 698 
 699         /*
 700          * From msdn page on OSVERSIONINFOEX, current as of this
 701          * writing, decoding of dwMajorVersion and dwMinorVersion.
 702          *
 703          *  Operating system            dwMajorVersion  dwMinorVersion
 704          * ==================           ==============  ==============
 705          *
 706          * Windows 95                   4               0
 707          * Windows 98                   4               10
 708          * Windows ME                   4               90
 709          * Windows 3.51                 3               51
 710          * Windows NT 4.0               4               0
 711          * Windows 2000                 5               0
 712          * Windows XP 32 bit            5               1
 713          * Windows Server 2003 family   5               2
 714          * Windows XP 64 bit            5               2
 715          *       where ((&ver.wServicePackMinor) + 2) = 1
 716          *       and  si.wProcessorArchitecture = 9
 717          * Windows Vista family         6               0  (VER_NT_WORKSTATION)
 718          * Windows Server 2008          6               0  (!VER_NT_WORKSTATION)
 719          * Windows 7                    6               1  (VER_NT_WORKSTATION)
 720          * Windows Server 2008 R2       6               1  (!VER_NT_WORKSTATION)
 721          *
 722          * This mapping will presumably be augmented as new Windows
 723          * versions are released.
 724          */
 725         switch (ver.dwPlatformId) {
 726         case VER_PLATFORM_WIN32s:
 727             sprops.os_name = "Windows 3.1";
 728             break;
 729         case VER_PLATFORM_WIN32_WINDOWS:
 730            if (ver.dwMajorVersion == 4) {
 731                 switch (ver.dwMinorVersion) {
 732                 case  0: sprops.os_name = "Windows 95";           break;
 733                 case 10: sprops.os_name = "Windows 98";           break;
 734                 case 90: sprops.os_name = "Windows Me";           break;
 735                 default: sprops.os_name = "Windows 9X (unknown)"; break;
 736                 }
 737             } else {
 738                 sprops.os_name = "Windows 9X (unknown)";
 739             }
 740             break;


 751                     *
 752                     * "Because the version numbers for Windows Server 2003
 753                     * and Windows XP 6u4 bit are identical, you must also test
 754                     * whether the wProductType member is VER_NT_WORKSTATION.
 755                     * and si.wProcessorArchitecture is
 756                     * PROCESSOR_ARCHITECTURE_AMD64 (which is 9)
 757                     * If it is, the operating system is Windows XP 64 bit;
 758                     * otherwise, it is Windows Server 2003."
 759                     */
 760                     if(ver.wProductType == VER_NT_WORKSTATION &&
 761                        si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
 762                         sprops.os_name = "Windows XP"; /* 64 bit */
 763                     } else {
 764                         sprops.os_name = "Windows 2003";
 765                     }
 766                     break;
 767                 default: sprops.os_name = "Windows NT (unknown)"; break;
 768                 }
 769             } else if (ver.dwMajorVersion == 6) {
 770                 /*
 771                  * See table in MSDN OSVERSIONINFOEX documentation.







 772                  */
 773                 if (ver.wProductType == VER_NT_WORKSTATION) {
 774                     switch (ver.dwMinorVersion) {
 775                     case  0: sprops.os_name = "Windows Vista";        break;
 776                     case  1: sprops.os_name = "Windows 7";            break;
 777                     default: sprops.os_name = "Windows NT (unknown)";
 778                     }
 779                 } else {
 780                     switch (ver.dwMinorVersion) {
 781                     case  0: sprops.os_name = "Windows Server 2008";    break;
 782                     case  1: sprops.os_name = "Windows Server 2008 R2"; break;
 783                     default: sprops.os_name = "Windows NT (unknown)";
 784                     }
 785                 }
 786             } else {
 787                 sprops.os_name = "Windows NT (unknown)";
 788             }
 789             break;
 790         default:
 791             sprops.os_name = "Windows (unknown)";
 792             break;
 793         }
 794         sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion);
 795         sprops.os_version = strdup(buf);
 796 #if _M_IA64
 797         sprops.os_arch = "ia64";
 798 #elif _M_AMD64
 799         sprops.os_arch = "amd64";
 800 #elif _X86_
 801         sprops.os_arch = "x86";
 802 #else
 803         sprops.os_arch = "unknown";
 804 #endif
 805