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:
- 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.
- 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.
- 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
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
Here is sample output from ShowVer.exe:
VERSIONINFO for file "w:\winnt\system32\mshtml.dll": (type:0)
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
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.