为什么Windows 10中的kernel32.dll上的GetFileVersionInfo返回版本6.2? [英] Why does GetFileVersionInfo on kernel32.dll in windows 10 returns version 6.2?

查看:1272
本文介绍了为什么Windows 10中的kernel32.dll上的GetFileVersionInfo返回版本6.2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下代码,我试图检索kernel32.dll版本,以执行Windows版本检查。
,由于某种原因,即使kernel32.dll版本(如在文件属性中看到的)是10.0.10586.0,返回的版本是:6.2.10586.0
怎么来?

using the following code, I am trying to retrieve kernel32.dll version in order to perform a windows version check. yet, for some reason, even though kernel32.dll version (as seen in file properties) is 10.0.10586.0, the returned version is: 6.2.10586.0 how come?

    DWORD dwDummy;
    DWORD dwFVISize = GetFileVersionInfoSize(lpszFilePath, &dwDummy);
    LPBYTE lpVersionInfo = new BYTE[dwFVISize];
    if (GetFileVersionInfo(lpszFilePath, 0, dwFVISize, lpVersionInfo) == 0)
    {
        return FALSE;
    }

    UINT uLen;
    VS_FIXEDFILEINFO *lpFfi;
    BOOL bVer = VerQueryValue(lpVersionInfo, L"\\", (LPVOID *)&lpFfi, &uLen);

    if (!bVer || uLen == 0)
    {
        return FALSE;
    }
    DWORD dwFileVersionMS = lpFfi->dwFileVersionMS;
    DWORD dwFileVersionLS = lpFfi->dwFileVersionLS;
    delete[] lpVersionInfo;

    DWORD dwLeftMost = HIWORD(dwFileVersionMS);
    DWORD dwSecondLeft = LOWORD(dwFileVersionMS);
    DWORD dwSecondRight = HIWORD(dwFileVersionLS);
    DWORD dwRightMost = LOWORD(dwFileVersionLS);

Kernel32.dll属性(与SysWow64中的相同):

Kernel32.dll properties (same as in SysWow64):

推荐答案

您从此任务的版本信息中读取了错误的字段。而不是 dwFileVersionMS dwFileVersionLS 使用 dwProductVersionMS dwProductVersionLS

You are reading the wrong fields from the version information for this task. Instead of dwFileVersionMS and dwFileVersionLS use dwProductVersionMS and dwProductVersionLS.

文件版本字段需符合 supportedOS 兼容性问题。这是他们的值取决于在应用程序清单中声明的​​ supportedOS 级别。另一方面,产品版本字段不依赖于清单。

The file version fields are subject to supportedOS compatibility issues. That is their values depend on the supportedOS levels declared in your application manifest. On the other hand the product version fields do not depend on the manifest.

这篇关于为什么Windows 10中的kernel32.dll上的GetFileVersionInfo返回版本6.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆