Version Information of DLL/Exe File

Posted on 2007-10-18
Last Modified: 2013-12-14
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.
Question by:arunperi_ee
    LVL 43

    Expert Comment

    I thought the version info should be numeric - 'a' not allowed.
    (I'm not certain about that though).
    LVL 49

    Expert Comment

    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

    Author Comment

    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.

    LVL 49

    Accepted Solution

    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.
    LVL 49

    Expert Comment

    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

    Author Comment

    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.
    LVL 49

    Expert Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now