Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1072
  • Last Modified:

Version Information of DLL/Exe File

I am getting version information of a file using GetFileVersionInfo. After calling this function I got all the parameters in VS_FIXEDFILEINFO.

In this I am not able to get all the version information of the file. I have a file with version "1.2.3a". I am able to get 1.2.3 but I am missing the charater beside 3 which is "a".

How can I get the character also. Can anyone help me.
  • 4
  • 2
1 Solution
I thought the version info should be numeric - 'a' not allowed.
(I'm not certain about that though).
The version info is in a Resource in the executable.

If you generated the EXE yourself, then check that resource (it may be in a file named "MyProg.Rc2")

If somebody else generated it, then perhaps they did not include it.

The FILEVERSION portion of a VERSIONINFO resource *is* numeric.
But the FileVersion value in the StringFileInfo is a string.

The former shows up at the top of the Properties box (and in the yellow popup that you see when hovering the mouse over the EXE in the Windows Explorer).  The latter shows up in the lower section of the Properties box (right-click, select Properties, select Version tab, look to the "Other version information" box in the middle).

-- Dan
arunperi_eeAuthor Commented:
Hi Dan,

I need the information from the lower section as quoted by you which is infact a string value. The Exe/DLL is not generated by me. Hence I cannot modify that.

I have tried getting the same by a call initially to:
GetFileVersionInfo and then to

But then it is not returning me the actual value.

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Try using this as the param in VerQueryValue:


   char*     lpValueData;
   DWORD dwValueDataLen;

   BOOL fSuccess= VerQueryValue(
         pBlock,  // used in GetFileVersionInfo
        "\\StringFileInfo\\040904B0\\FileVersion",  // 0x0409 = U.S. English, 0x04B0 = Unicode

After the call, the text at lpValueData should be the same as seen in the Windows Explorer in the lower box when you click the "File Version" text on the left hand side.

THe magic number
is the international language and codepage, expressed as sets of four hex digits.  I'll guess that they mean "English" -- all I know is that's what I'm seeing in by existing program that has a VERSIONINFO resource.
You can open the EXE as a resource to learn the proper value for that "translation block" value:

1) In Visual Studio, select File/Open
2)  in the bottom box, select "Resources"
3) pick the file using the pic-a-file controls

The resource Editor may show dialogs etc.  Open the "Version" resource, and it probably has a "1" below that.  Click that to see what's in there.

-- Dan
arunperi_eeAuthor Commented:
Earlier I formed the string with Language ID and Character Set received from the version info which infact hasn't worked for the dll.

It worked for other DLL's and exe's but for one I was trying it hasn't worked.

I opened the resource in the IDE and put the same version info in the app in the format: "\\StringFileInfo\\<<LanguageID>>\\FileVersion" and then it worked.

Thanks Dan.
I'm sorry that I could only provide you with a "B" - level answer.   I'll try harder from now on!

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now