|
发表于 2025-3-21 09:46:28
|
显示全部楼层
山东省青岛市
本帖最后由 LXFaYX 于 2025-3-21 09:50 编辑
|
系统_取系统版本 | 文本型 | | |
参_主要版本号 | | | | | 参_次要版本号 | | | | | 参_内部版本号 | | | | | 参_是否带名称 | 逻辑型 | | | | 参_是否取位数 | 逻辑型 | | | | 参_取SP版本号 | 逻辑型 | | | | 参_取内部版本 | 逻辑型 | | | | 参_取修正版本 | 逻辑型 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | m_osvi | OSVERSIONINFOEX | | | m_si | SYSTEM_INFO | | | m_dwType | | | | m_system | 文本型 | | | m_version | 文本型 | | | m_dwMajorVersion | 整数型 | | | m_dwMinorVersion | 整数型 | | | m_dwBuildNumber | 短整数型 | | | m_retrun | 文本型 | | | m_isWOW64 | 逻辑型 | | | m_szCSDVersion | 文本型 | | | m_CurrentBuild | 文本型 | | | m_strMark | 文本型 | | |
m_osvi.dwOSVersionInfoSize = 156 如果真 (GetVersionEx (m_osvi )) GetSystemInfo (m_si ) IsWow64Process (-1, m_isWOW64 ) RtlGetNtVersionNumbers (m_osvi.dwMajorVersion, m_osvi.dwMinorVersion, m_dwBuildNumber ) 参_主要版本号 = m_osvi.dwMajorVersion  参_次要版本号 = m_osvi.dwMinorVersion  参_内部版本号 = m_dwBuildNumber  判断 (m_osvi.dwMajorVersion = 10 )  判断 (m_osvi.dwMinorVersion = 0 )     如果 (m_osvi.wProductType = #VER_NT_WORKSTATION )    m_system = “Windows 10”    m_system = 取文本注册项 ( #本地机器, “SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName”, )              判断 (m_osvi.dwMajorVersion = 6 )  判断 (m_osvi.dwMinorVersion = 0 )   m_system = 选择 (m_osvi.wProductType = #VER_NT_WORKSTATION, “Windows Vista”, “Windows Server 2008”)  判断 (m_osvi.dwMinorVersion = 1 )   m_system = 选择 (m_osvi.wProductType = #VER_NT_WORKSTATION, “Windows 7”, “Windows Server 2008 R2”)  判断 (m_osvi.dwMinorVersion = 2 )   m_system = 选择 (m_osvi.wProductType = #VER_NT_WORKSTATION, “Windows 8”, “Windows Server 2012”)  判断 (m_osvi.dwMinorVersion = 3 )   m_system = 选择 (m_osvi.wProductType = #VER_NT_WORKSTATION, “Windows 8.1”, “Windows Server 2012 R2”)          判断 (m_osvi.dwMajorVersion = 5 且 m_osvi.dwMinorVersion = 0 )  m_system = “Windows 2000”  如果 (m_osvi.wProductType = 1 )   m_version = “Professional”   如果真 (位与 (m_osvi.wSuiteMask, 128 ) = 0 )   m_version = “Datacenter Server”  如果 (位与 (m_osvi.wSuiteMask, 2 ) = 0 )   m_version = “Advanced Server”   m_version = “Server”       判断 (m_osvi.dwMajorVersion = 5 且 m_osvi.dwMinorVersion = 1 )  m_system = “Windows XP”  如果 (位与 (m_osvi.wSuiteMask, 512 ) = 1 )   m_version = “Home Edition”    m_version = “Professional”     判断 (m_osvi.dwMajorVersion = 5 且 m_osvi.dwMinorVersion = 2 )  判断 (GetSystemMetrics (89 ) ≠ 0 )   m_system = “Windows Server 2003 R2, ”  判断 (位与 (m_osvi.wSuiteMask, 8192 ) = 8192 )   m_system = “Windows Storage Server 2003”  判断 (位与 (m_osvi.wSuiteMask, 32768 ) = 32768 )   m_system = “Windows Home Server”  判断 (m_osvi.wProductType = 1 且 m_si.wProcessorArchitecture = 9 )   m_system = “Windows XP Professional x64 Edition”    m_system = “Windows Server 2003, ”    判断 (m_osvi.dwMajorVersion = 4 且 m_osvi.dwMinorVersion = 10 )  m_system = “Windows 98”     如果真 (m_osvi.dwMajorVersion ≥ 6 ) RtlGetProductInfo (m_osvi.dwMajorVersion, m_osvi.dwMinorVersion, 0, 0, m_dwType )  判断 (m_dwType = 1 )    m_version = “Ultimate Edition”  判断 (m_dwType = 2 )    m_version = “Home Basic Edition”  判断 (m_dwType = 3 )    m_version = “Home Premium Edition”  判断 (m_dwType = 4 )    m_version = “Enterprise Edition”  判断 (m_dwType = 6 )    m_version = “Business Edition”  判断 (m_dwType = 7 )    m_version = “Standard”  判断 (m_dwType = 8 )    m_version = “Datacenter Edition”  判断 (m_dwType = 9 )    m_version = “Small Business Server”  判断 (m_dwType = 10 )    m_version = “Enterprise Edition”  判断 (m_dwType = 11 )    m_version = “Starter Edition”  判断 (m_dwType = 12 )    m_version = “Datacenter Edition (core installation)”  判断 (m_dwType = 13 )    m_version = “Standard Edition (core installation)”  判断 (m_dwType = 14 )    m_version = “Enterprise Edition (core installation)”  判断 (m_dwType = 15 )    m_version = “Enterprise Edition for Itanium-based Systems”  判断 (m_dwType = 16 )    m_version = “Business N”  判断 (m_dwType = 17 )    m_version = “Web Server (full installation)”  判断 (m_dwType = 18 )    m_version = “HPC Edition”  判断 (m_dwType = 19 )    m_version = “Windows Storage Server 2008 R2 Essentials”  判断 (m_dwType = 20 )    m_version = “Storage Server Express”  判断 (m_dwType = 21 )    m_version = “Storage Server Standard”  判断 (m_dwType = 22 )    m_version = “Storage Server Workgroup”  判断 (m_dwType = 23 )    m_version = “Storage Server Enterprise”  判断 (m_dwType = 25 )   m_version = “Small Business Server Premium Edition”  判断 (m_dwType = 48 )    m_version = “Professional”  判断 (m_dwType = 121 )    m_version = “Education”       m_system = 到文本 (m_osvi.dwMajorVersion) + “.” + 到文本 (m_osvi.dwMinorVersion) + “ ” + m_version m_retrun = m_system 判断 (参_主要版本号 = 10 且 参_次要版本号 = 0 且 参_内部版本号 ≥ 22000 )  m_retrun = 选择 (参_是否带名称, “Windows 11”, m_retrun )  m_retrun = 选择 (参_是否带名称, “Windows 10”, m_retrun ) m_retrun = 选择 (参_是否带名称, m_retrun + “ ” + 选择 (寻找文本 (m_retrun, m_version, , 假) = -1, m_version, “”), m_retrun) m_retrun = 选择 (参_是否取位数, 选择 (m_isWOW64, m_retrun + “ X64”, m_retrun + “ X86”), m_retrun ) 如果真 (参_取SP版本号 )  m_szCSDVersion = 到文本 (m_osvi.szCSDVersion )  如果真 (取文本长度 (m_szCSDVersion ) = 0 )   m_szCSDVersion = 取文本注册项 ( #本地机器, “SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion”, ) m_strMark = 选择 (取文本长度 (m_szCSDVersion) > 2, m_szCSDVersion, “”) 如果真 (参_取内部版本 )  如果 (参_内部版本号 = 0 )   m_CurrentBuild = 取文本注册项 ( #本地机器, “SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuild”, )   m_CurrentBuild = 到文本 (参_内部版本号 )  如果 (m_strMark ≠ “”)  m_strMark = m_strMark + “,” + m_CurrentBuild    m_strMark = “” + m_CurrentBuild      如果真 (参_取修正版本 )  如果真 (到文本 (取数值注册项 ( #本地机器, “SOFTWARE\Microsoft\Windows NT\CurrentVersion\UBR”, )) ≠ “”)   m_strMark = m_strMark + “.” + 到文本 (取数值注册项 ( #本地机器, “SOFTWARE\Microsoft\Windows NT\CurrentVersion\UBR”, ))     如果真 (m_strMark ≠ “”)  m_strMark = “ (” + m_strMark + “)” 返回 (m_retrun + m_strMark)返回 (“”)
感谢分享,但是还有点Bug,比如Win10带名称不显示,我修改了一下,不知道对否,还增加了一个取修正版本号的判断,比如Win10 19045.6666。
|
|