5,421,850 members and growing! (22,602 online)
Email Password   helpLost your password?
General Programming » DLLs & Assemblies » General     Intermediate

ShowVer.exe command-line VERSIONINFO display program

By tpeck

A command-line program that interprets and displays VERSIONINFO resource values from a DLL or EXE.
VC6, VC7, C++Windows, Win2K, WinXP, Visual Studio, MFC, Dev

Posted: 18 Jun 2002
Updated: 18 Jun 2002
Views: 77,953
Bookmarked: 19 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
18 votes for this Article.
Popularity: 5.26 Rating: 4.19 out of 5
1 vote, 7.1%
1
0 votes, 0.0%
2
1 vote, 7.1%
3
3 votes, 21.4%
4
9 votes, 64.3%
5

Introduction

Did you ever wish for a way to quickly peek inside a mystery DLL to see who wrote it and what it does? If the DLL has version information built in, you could browse to the DLL file in Windows Explorer and then click through the items in the Version tab of the Properties context menu dialog for the file. That's kind of a nuisance for me, so I wrote this handy program, ShowVer.exe. ShowVer will show you all the version info at once.

The source code for ShowVer will also show you how to traverse the tree of information that a VERSIONINFO resource contains, bypassing the need to use the VerQueryValue Win32 API to retrieve individual strings based on a particular hard-coded key name and language/locale ID that you might be expecting to be present.

ShowVer.exe is a command-line program that displays the complete VERSIONINFO contents of a named file. It works on EXE's and DLL's. It is useful for 3 reasons:

  1. It shows all the version info from a file, in all its languages. It does this by interpreting the raw data structures that compose a VERSIONINFO resource. The Win32 APIs (VerQueryValue) will only show you a value from the VERSIONINFO resource if you ask for it by name.
  2. It allows you to name the file whose information you want to see. Often the file you want to examine resides in the System32 directory, which is crowded and unpleasant to browse through using Windows Explorer.
  3. It is a standalone command-line utility that operates on external files, unlike DLLVersion which is a tool you incorporate into a running process.

The source code to ShowVer demonstrates how to load (using GetFileVersionInfo and GetFileVersionInfoSize), parse and traverse the tree of pseudo-structures that make up a VERSIONINFO resource (VS_VERSIONINFO, String, StringTable, StringFileInfo, Var, VarFileInfo).

It will also display a hex dump of the raw VERSIONINFO resource block if you rebuild it with '#define HDUMP 1'. One interesting observation from the hex dump feature is that GetFileVersionInfo never seems to fill up the whole memory buffer that GetFileVersionInfoSize requests.

Here is sample output from ShowVer.exe:

N:\work\ShowVer\Debug>ShowVer w:\winnt\system32\mshtml.dll
VERSIONINFO for file "w:\winnt\system32\mshtml.dll":  (type:0)
  Signature:       feef04bd
  StrucVersion:    1.0
  FileVersion:     6.0.2600.0
  ProductVersion:  6.0.2600.0
  FileFlagsMask:   0x3f
  FileFlags:       0
  FileOS:          VOS_NT_WINDOWS32
  FileType:        VFT_DLL
  FileDate:        0.0
 LangID: 040904B0
  CompanyName       : Microsoft Corporation
  FileDescription   : Microsoft (R) HTML Viewer
  FileVersion       : 6.00.2600.0000
  InternalName      : MSHTML
  LegalCopyright    : ¬ Microsoft Corporation. All rights reserved.
  OriginalFilename  : MSHTML.DLL
  ProductName       : Microsoft« Windows« Operating System
  ProductVersion    : 6.00.2600.0000
  OleSelfRegister   :
 Translation: 040904b0

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

tpeck


Ted Peck is a consultant with over 20 years' experience in software development and technical management. His company, Roundwave Development, specializes in designing GUI, network and database tools and systems.

Ted believes in thoughtful systems design with the aim of maximizing utility while minimizing complexity. If you're careful you can build software that's both powerful and easy to use.
Occupation: Web Developer
Location: Anonymous Proxy Anonymous Proxy

Other popular DLLs & Assemblies articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 17 of 17 (Total in Forum: 17) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralSee also sigcheck from sysinternalsmemberbrofield8:23 29 Jan '07  
GeneralRelayer's comment - A fix for thissussAnonymous16:52 29 Sep '05  
GeneralRe: Relayer's comment - A fix for thismemberrelayer_delirium17:00 29 Sep '05  
GeneralUnderstanding the codememberlstoumbos6:09 7 Sep '05  
GeneralLoading ALL strings from my stringtablememberAlex Evans16:05 4 May '05  
Generaldebug assertion failedmemberKaren Amstutz12:03 13 Jul '04  
Generalincorrect search ordermemberrelayer_delirium16:37 9 Mar '04  
GeneralProblem vc to call VB form dllmemberchi-yuchan@rocketmail.com0:26 1 Mar '04  
GeneralThis is exactly what i want, thanks.membert2di4u0:27 18 Dec '03  
Generaldoes not run in win9XsussHae Moon, Kwon16:12 25 Mar '03  
GeneralRe: does not run in win9XsussRenato Mauro23:06 14 Apr '03  
GeneralProblemsmemberMike C9:17 19 Jun '02  
GeneralRe: Problemsmembertpeck18:51 1 Jul '02  
GeneralFile Date in VS_FIXEDFILEINFOmemberClaudius Mokler2:24 19 Jun '02  
GeneralRe: File Date in VS_FIXEDFILEINFOmembertpeck19:08 1 Jul '02  
GeneralRe: File Date in VS_FIXEDFILEINFOmembercasanova_n775:22 9 Feb '04  
GeneralRe: File Date in VS_FIXEDFILEINFOmemberDavidCrow7:03 3 Mar '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 18 Jun 2002
Editor: Chris Maunder
Copyright 2002 by tpeck
Everything else Copyright © CodeProject, 1999-2008
Web13 | Advertise on the Code Project