不同Windows版本的版本号相同

用户名

在此页面中,有类似以下内容:

Windows Server 2008年6.0

Windows Vista 6.0

GetVersionEx() 返回版本号(即6.0),但是如您所见,该数字可以映射到两个不同的Windows版本!

因此,有没有一种方法可以确切地知道我拥有的Windows版本?

我检查

GetVersionInfoEx API返回一个完全填充OSVERSIONINFOEX结构(如果需要)。文档包含一个完整的表格,以及有关如何区分具有相同版本号的OS版本的说明:

下表总结了Windows的受支持版本返回的值。使用标记为“其他”的列中的信息来区分具有相同版本号的操作系统。

为了您的具体的例子,你会需要比较OSVERSIONINFOEX.wProductType反对VER_NT_WORKSTATION如果相等,则说明您使用的是Windows Vista,否则,则说明使用的是Windows Server 2008。

为了在Windows 8.1及更高版本上获得可靠的结果,您的应用程序必须证明是兼容的。针对Windows 8.1及更高版本显示应用程序的说明可在“针对Windows应用程序定位”中找到

清单文件示例:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <assemblyIdentity 
        type="win32" 
        name=SXS_ASSEMBLY_NAME
        version=SXS_ASSEMBLY_VERSION
        processorArchitecture=SXS_PROCESSOR_ARCHITECTURE
    />
    <description> my foo exe </description>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel
                    level="asInvoker"
                    uiAccess="false"
                />  
            </requestedPrivileges>
        </security>
    </trustInfo>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
        <application> 
            <!-- Windows 10 --> 
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
            <!-- Windows 8.1 -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!-- Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
        </application> 
    </compatibility>
</assembly>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章