Click here to Skip to main content
15,867,453 members
Articles / Desktop Programming / MFC
Article

ShowVer.exe command-line VERSIONINFO display program

Rate me:
Please Sign up or sign in to vote.
4.53/5 (22 votes)
18 Jun 20022 min read 166.9K   4.3K   32   22
A command-line program that interprets and displays VERSIONINFO resource values from a DLL or EXE.

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


Written By
Web Developer
Anonymous Proxy Anonymous Proxy
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.

Comments and Discussions

 
QuestionMicrosoft visual C+ error Pin
Dimsok8-Feb-22 20:14
Dimsok8-Feb-22 20:14 
GeneralMy vote of 1 Pin
jamseyang11-Jul-14 0:00
jamseyang11-Jul-14 0:00 
QuestionPrint Unicode Pin
acourier12-Apr-12 2:47
acourier12-Apr-12 2:47 
GeneralResourceLib: same thing in C# with r/w Pin
dB.8-Oct-08 12:27
dB.8-Oct-08 12:27 
GeneralSee also sigcheck from sysinternals Pin
brofield29-Jan-07 7:23
brofield29-Jan-07 7:23 
GeneralRelayer's comment - A fix for this Pin
Anonymous29-Sep-05 15:52
Anonymous29-Sep-05 15:52 
GeneralRe: Relayer's comment - A fix for this Pin
relayer_delirium29-Sep-05 16:00
relayer_delirium29-Sep-05 16:00 
GeneralUnderstanding the code Pin
lstoumbos7-Sep-05 5:09
lstoumbos7-Sep-05 5:09 
GeneralLoading ALL strings from my stringtable Pin
Alex Evans4-May-05 15:05
Alex Evans4-May-05 15:05 
Hi there

How can I (using VC6 / MFC) load ALL strings from a stringtable, one-by-one, getting the IDS value as well as the actual text, for all strings in my program's stringtable?

Thanks

Alex
Generaldebug assertion failed Pin
Karen Amstutz13-Jul-04 11:03
Karen Amstutz13-Jul-04 11:03 
GeneralRe: debug assertion failed Pin
acourier12-Apr-12 1:56
acourier12-Apr-12 1:56 
Generalincorrect search order Pin
relayer_delirium9-Mar-04 15:37
relayer_delirium9-Mar-04 15:37 
GeneralProblem vc to call VB form dll Pin
Member 89939229-Feb-04 23:26
Member 89939229-Feb-04 23:26 
GeneralThis is exactly what i want, thanks. Pin
t2di4u17-Dec-03 23:27
t2di4u17-Dec-03 23:27 
Generaldoes not run in win9X Pin
SeaGate225-Mar-03 15:12
SeaGate225-Mar-03 15:12 
GeneralRe: does not run in win9X Pin
Renato MAURO14-Apr-03 22:06
Renato MAURO14-Apr-03 22:06 
GeneralProblems Pin
Mike C19-Jun-02 8:17
Mike C19-Jun-02 8:17 
GeneralRe: Problems Pin
tpeck1-Jul-02 17:51
tpeck1-Jul-02 17:51 
GeneralFile Date in VS_FIXEDFILEINFO Pin
Claudius Mokler19-Jun-02 1:24
Claudius Mokler19-Jun-02 1:24 
GeneralRe: File Date in VS_FIXEDFILEINFO Pin
tpeck1-Jul-02 18:08
tpeck1-Jul-02 18:08 
GeneralRe: File Date in VS_FIXEDFILEINFO Pin
Member 8199519-Feb-04 4:22
Member 8199519-Feb-04 4:22 
GeneralRe: File Date in VS_FIXEDFILEINFO Pin
David Crow3-Mar-04 6:03
David Crow3-Mar-04 6:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.