Version Information Spy Build Instructions

Introduction

Version Information Spy is written in Object Pascal and is targeted at Delphi 2010. The Delphi IDE can be used to modify the source and to perform test builds. Final builds should be built using the provided build scripts, but you can get away with using the IDE if you don't change any resources.

Dependencies

Several DelphiDabbler libraries and components are required in to compile Version Information Spy. They are:

1 These components must be installed into the Delphi component palette since they are required at design time.

2 These components and classes must be available on Delphi's library path. They are not required at design time.

All the components and classes must be installed in the same directory, so the easiest thing to do is to install everything into the Delphi user design time package. See here if you need help doing this.

In addition the VIBinData.dll executable is required in order for the Version Information Spy programs to run and for the installer to be built. This library is available here. The source code for the DLL is available from this repository. The DLL source is not required to build Version Information Spy.

Build Tools

You can edit and test compile parts of the project using the Delphi IDE. Delphi 2010 is the preferred compiler, and the rest of these instructions assume it is being used. The code may compile with later Delphis, but this is not guaranteed.

The following command line tools are required to compile the whole project using the build scripts.

DCC32
The Delphi command line compiler.
BRCC32
The Borland resource compiler. This is used to compile resource source (.rc) files. BRCC32 is supplied with Delphi 2010.
HHC
Microsoft HTML Help compiler. This command line compiler is supplied with Microsoft HTML Help Workshop. It is used to compile program's HTML Help file. You can get HTML Help Workshop from Microsoft. Requires release 1.3 or later.
ISCC
The Unicode version of the Inno Setup command line compiler. v5.4 or later is required with a matching version of ISPP. You can get Inno Setup from the InnoSetup site.
VIEd
DelphiDabbler Version Information Editor, available from DelphiDabbler.com. Requires v2.11 or later.
ZIP
This program is used to create the release file. You can get a Windows command line version from StahlWorks. If you don't intend to create a release file then ZIP is not required.

Preparation

Get the Source Code

First you need to get the source code of Version Information Spy. There are two choices:

  1. Download the source code of the latest release from the Version Information Spy Download Page. Unzip the download into a suitable folder, preserving the directory structure.
  2. Get the source code of either the latest development tree (which may not be stable) or of a specified stable release using Subversion.
    Check out the latest development tree into a folder named vis by doing:
    > svn checkoput http://verinfo-tools.googlecode.com/svn/trunk/vis/ vis
    Alternatively check out the source code of a release by doing
    > svn checkout http://verinfo-tools.googlecode.com/svn/tags/vis/release-9.9.9/ vis
    Replace 9.9.9 with the version number of the required release. All available releases can be viewed in this branch of the SVN repository.

Configure the Environment

The build scripts require the following environment variables to be set:

DELPHI2010
Set to the install directory of Delphi 2010: used to find DCC32 and BRCC32.
DELPHIDABLIBD2010
Set to the directory where the required DelphiDabbler components are installed in Delphi 2010.
INNOSETUP
Set to the install directory of Inno Setup 5.

The following environment variables are optional:

HHCROOT
Set to the install directory of the Microsoft HTML Help Compiler, HHC.exe. If this environment variable is not set then HHC.exe is expected to be found on the system path.
VIEDROOT
Set to the install directory of DelphiDabbler Version Information Editor, VIEd.exe. If this environment variable is not set the VIED.exe must be on the system path.
ZIPROOT
Set to the install directory of Zip.exe. If this environment variable is not set then Zip.exe must be on the path.

You may find it convenient to create a batch file that sets up the required environment for you. You can then run it before using the build scripts.

Configure the Source Tree

After checking out or downloading and extracting the source code you should have the following directory structure:

./
  |
  +-- DevTools               - scripts used to build project
  |
  +-- Docs                   - documentation
  |
  +-- Src                    - root of soruce code tree, contains .bpg file
      |
      +-- App                - main GUI application source
      |   |
      |   +-- Images         - images included in main app resources
      |
      +-- CmdApp             - command line app source
      |   |
      |   +-- Images         - images included in command line app resources
      |
      +-- CtxMenu            - context menu handler source
      |   |
      |   +-- Exports        - interfaces exported by context menu handler
      |
      +-- Help               - project HTML help file source
      |   |
      |   +-- CSS            - help file's style sheet(s)
      |   |
      |   +-- HTML           - help file's HTML topic files
      |   |
      |   +-- Images         - images included in HTML topic files
      |
      +-- Imports            - interfaces to third party DLLs
      |
      +-- Installer          - source code of installer
      |
      +-- Reader             - source of reader DLL
      |   |
      |   +-- Exports        - interfaces exported by reader DLL
      |
      +-- Reporter           - source of reporter DLL
      |   |
      |   +-- Exports        - interfaces exported by reporter DLL
      |   |
      |   +-- Res            - assets included in reporter DLL resources
      |
      +-- Shared             - common code shared by different projects

If your source tree also contains one or more of the Bin, Exe or Release directories that's OK, as will become clear later. Subversion users will also have the usual hidden .svn directories.

The first thing to do before attempting to hack the code is to configure the source tree. Open a console window and navigate to the DevTools directory. Run any script you have created to set the environment variables then do:

> Config

This script does two things:

  1. It creates the Bin, Exe and Release directories, along with various sub-directories of Bin that are required to receive the binary code. If any of these directories already existed they will have been emptied.
  2. It creates .cfg files for each Delphi sub-project from template files. .cfg files are required to configure the Delphi command line compiler. These new files will be ignored by Subversion.

You must now place a copy of VIBinData.dll into the Exe directory. Version Information Spy requires this DLL, which is not part of the project, in order to run. See above for details of where to get the DLL.

If you are intending to edit and compile the code using the Delphi IDE you must also run the following script from the DevTools directory:

> BuildResources

This creates the resource files that the IDE needs to link into compiled executables.

You are now ready to modify the code if you wish and to build the source.

Building Version Information Spy

There are two ways of building the code:

  1. By building each sub-project separately: each sub-directory of Src except Imports and Shared contains a script named Build.bat that is used to build that sub-project.
  2. The DevTools directory contains various scripts that can be used to build the whole project and to create releases.

Using the DevTools Scripts

All these scripts are run from a console window with current directory set to DevTools. The environment variables described above must be set before using the scripts.

The available tools are:

BuildResources
Builds all the resources required by any of the project's applications and DLLs. The generated .res files are placed in the appropriate sub-directories of Bin. This script must be run before using BuildPascal.
BuildPascal
Builds the Pascal source code for all the project's applications and DLLs and links in resources to create the final executables. The executables are placed in the Exe directory. BuildResources must be run before running this script.
BuildHelp
Generates the project's binary HTML help file and places it in the Exe directory.
BuildInstaller
Creates the setup program. The executable and help files must have been generated and VIBinData.dll must have been copied to the Exe directory before running this script. The resulting program is placed in the Exe directory.
BuildAll
This script builds all the executable files, the help file and the installer. It is a shortcut for all the preceeding commands. VIBinData.dll must have been copied to the Exe directory before running this script.
Release
Creates a .zip file containing the install file and a read-me file. The .zip file is placed in the Release directory.
Tidy
This script deletes temporary files and directories.
Config
Configures the source tree. See the previous section for details.

Using the Separate Build Scripts

Sub projects can be built using the Build.bat scripts found in the sub project's source directory. The scripts are controlled by passing parameters to them. They are described below.

To use a script open a console window, set up the environment if necessary, then set the console's working directory to the appropriate source directory.

The available build scripts are:

.\Src\App\Build.bat
Builds the main GUI application. Use one of the following parameters:
.\Src\CmdApp\Build.bat
Builds the command line application. Parameters are:
.\Src\CtxMenu\Build.bat
Builds the context menu handler. The following parameters are available:
.\Src\Help\Build.bat
Builds the HTML help file. No parameters are required or supported.
.\Src\Installer\Build.bat
Builds the installer. No parameters are required or supported. All the executable and help files must have been built before running this script and VIBinData.dll must have been copied to the Exe directory.
.\Src\Reader\Build.bat
Builds the Version Information Reader DLL. Parameters are:
.\Src\Reporter\Build.bat
Builds the Reporter DLL. Parameters are:

Note: Many of the DevTools scripts call these scripts.

Compiling & Testing FileVerCM.dll

Because FileVerCM.dll hooks into Windows Explorer it can be difficult to test and may sometimes refuse to compile.

Testing

So that the development version of the DLL is used by Explorer on its context menu and in the file property sheet, you need to make sure that the correct file is used by Explorer.

The easiest way to do this is to first ensure there is a valid install of Version Information Spy because this creates the required registry entries. Next run RegEdit with administrator privileges and find all sub-keys in HKEY_CLASSES_ROOT\CLSID that contain a path to FileVerCM.dll and change them to reference the development version of the file. You can change them back later by re-installing the program or by manually changing the paths back to their old values.

You may also want to change the FileVer.exe sub-key of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths to reference the development exe file and path. This will enable FileVerCM.dll to find the development version of the GUI program rather than starting the installed version. Again, a fresh install should restore the original value.

Compiling

Once FileVerCM.dll has been used by Explorer you may find that the DLL remains loaded and can't be overwritten by a fresh compile. Close all Explorer windows and check if the compile now succeeds. If this doesn't help (and it often doesn't) you need to restart Explorer entirely. Do this as follows:

  1. Open Windows Task Manager by pressing Ctrl+Shift+Esc.
  2. Go to the Processes tab, find explorer.exe and stop it by right clicking and choosing the End Process from the context menu. This action kills the desktop and task bar so don't close Task Manager!
  3. Select Task Manager's File | New Task (Run) menu option and enter explorer.exe in the resulting Create New Task dialog box. Click OK to restart Explorer. The desktop and taskbar should come back.

FileVerCM.dll should now have been unloaded and a fresh compile should succeed. If this fails try repeating the above procedure but do the recompile between steps 2 and 3 while Explorer is not running.

Copyright

If you are planning to re-use or modify any of the code, please see SourceCodeLicenses.txt in the Docs directory for an overview of the various open source licenses that apply to the Version Information Spy source code.