I have some reasonably tried and tested code which uses the Windows API calls to read FileVersionInfo strings, like "FileVersion" and "CompanyName".
I found it failed with one particular 3rd party DLL. The problem seems to be this:
Reading the VarFileInfoTranslation
value, I get 040904B0
(US English, Unicode). But when I then attempt to call VerQueryValue
on StringFileInfo40904B0CompanyName
, it returns false.
But tweaking the code to use the Windows Latin-1 ANSI codepage works: StringFileInfo40904E4CompanyName
.
So, the code page in the string table doesn't match the VarFileInfoTranslation
value.
According to the example resource at the bottom of MSDN's VERSIONINFO resource documentation, this is an appropriate thing to do!
Given this, can I use the published VersionInfo APIs to correctly read the strings for this file, without "guessing" the codepage?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…