3

I have an application that is required to check the versions of various system EXEs and DLLs to determine if they are vulnerable or not. This is a native C++ application which does not provide any specific WinSxS linkages in its manifest. On Windows 7, when I invoke GetFileVersionInfo on an absolute path, for example "c:\windows\system32\taskeng.exe", I receive the version information for "C:\Windows\winsxs\x86_microsoft-windows-taskscheduler-engine_31bf3856ad364e35_6.1.7600.16385_none_e582a352202e02c8\taskeng.exe"

So, to clarify, the version c:\windows\system32\taskeng.exe reported by Windows Explorer is 6.1.7600.16699. The version of c:\windows\system32\taskeng.exe reported by GetFileVersionInfo() is 6.1.7600.16385.

How do I force my app to not have its file redirected via WinSxS?

4

2 に答える 2

5

違いを示す PowerShell スクリプトを次に示します。FileVersion は、[FileMajorPart].[FileMinorPart].[FileBuildPart].[FilePrivatePart] の構成とは異なる文字列です。

PS C:\> [System.Diagnostics.FileVersionInfo]::GetVersionInfo("c:\windows\system32\taskeng.exe") | Format-List -property *


Comments           :
CompanyName        : Microsoft Corporation
FileBuildPart      : 7601
FileDescription    : Task Scheduler Engine
FileMajorPart      : 6
FileMinorPart      : 1
FileName           : c:\windows\system32\taskeng.exe
FilePrivatePart    : 17514
FileVersion        : 6.1.7600.16385 (win7_rtm.090713-1255)
InternalName       : TaskEng
IsDebug            : False
IsPatched          : False
IsPrivateBuild     : False
IsPreRelease       : False
IsSpecialBuild     : False
Language           : English (United States)
LegalCopyright     : © Microsoft Corporation. All rights reserved.
LegalTrademarks    :
OriginalFilename   : taskeng.exe.mui
PrivateBuild       :
ProductBuildPart   : 7601
ProductMajorPart   : 6
ProductMinorPart   : 1
ProductName        : Microsoft® Windows® Operating System
ProductPrivatePart : 17514
ProductVersion     : 6.1.7600.16385
SpecialBuild       :
于 2015-02-24T16:15:33.937 に答える
3

正しいフィールドを見ていますか? GetFileVersionInfo() を使用すると、Explorer と同じことがわかりますが、注意点が 1 つあります。StringFileInfo の FileVersion は 6.1.7600.16385 ですが、VS_FIXEDFILEINFO の FileVersion は 6.1.7600.16699 です。エクスプローラーは、VS_FIXEDFILEINFO からの FileVersion を表示しています。Microsoft は何らかの理由で StringFileInfo を更新しなかったと思います。

于 2011-03-11T15:39:54.907 に答える