No announcement yet.

Version Resources

  • Filter
  • Time
  • Show
Clear All
new posts

  • Version Resources

    I'm trying to use the standard GetFileVersionInfoSize(),
    GetFileVersionInfo() and VerQueryValue() functions
    to read the resources out of EXE files, but I'm getting
    inconsistent results. For some files I can read the text
    info but not the version and vice-versa for other files.
    Yet when I look at the Properties dialog for the given
    files (from Win Explorer) all the information is present.
    Are the functions above outdated?


    Mark Newman
    Mark Newman

  • #2
    Mark --
    If you have VB, try
    If this program (written enough long ago) is able to display necessary
    information, something wrong in your program.



    • #3

      Thanks for the link, I'll look at it. The odd thing here
      is that I can look at PBRES.EXE with my program and it
      will report the "CompanyName" and "LegalCopyright" fields
      correctly, but report 0.0.0 for the version; the Explorer
      File Properties dialog shows "1.5.0000" for the version.

      However, if I look at EXCEL.EXE (Excel 2000) it reports
      that the text fields aren't available, but it correctly
      reports the version as "9.0.2719". Again, the Explorer
      File Properties dialog shows "Microsoft Corporation" for
      the "CompanyName" field.

      One possible answer is that the resources aren't being
      stored in the standard format but are instead custom
      resources that the Win Explorer File Properties dialog
      can decipher.

      Mark Newman
      Mark Newman


      • #4
        It is possible for a Version Info table to contain numeric and/or text-orientated version values - you code will probably need to handle either possibility.

        Have you searched the BBS for "VerQueryVal"? I recall that there was some code posted in the past that handled this exact issue.

        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        mailto:[email protected]


        • #5
          Before posting I had searched for the GetFileVersionInfo() and found
          some stuff. I just searched again for VerQueryVal() and found some more.

          I also tried Karl Peterson's VB FileInfo app that Semen suggested, but it
          doesn't report anything about the PBRES.EXE resources, either text or
          version data, yet it works okay for other apps, same as what I'm doing.

          Mark Newman

          [This message has been edited by Mark Newman (edited June 30, 2000).]
          Mark Newman


          • #6
            In most versions of Windows, the "properties" information shown will be the string version information. In Windows 2000, Microsoft changed this to use the numeric version information. So, the results you will see will depend on the version of Windows you're using, and whether both string and numeric version information is available for a file.

            Tom Hanlin
            PowerBASIC Staff


            • #7
              It does seem that there's a wide variation in resource version implementation,
              both in setting up the resource in the EXE and in reading it.

              Did the Win2K SDK add an additional 23 resource fields, only accessible
              by an incredibly bizarre and complicated sequence of 12 API calls?
              Sometimes the plumbing gets a bit over-thought...

              Mark Newman
              Mark Newman