|
Creating an Installation Program
An installation program typically has the following goals:
- To place files in the correct location.
- To notify the user if the installation program is replacing an existing file
with a version that is significantly different
for example, replacing a German-language file with an English-language file,
or replacing a newer file with an older file.
When writing the installation program, the developer must have the following
information for each file on the installation disk(s):
- The name and location of the file (referred to as the source file).
- The name of the equivalent file on the user's hard disk (referred to as the
destination file). This name is usually the same as the filename on the
installation disk.
- The sharing status of the file
that is, whether the file is private to the application being installed or
could be shared by multiple applications.
For each file on the installation disk(s), the installation program must, at a
minimum, call the VerFindFile and VerInstallFile functions. These functions are described briefly in the following paragraphs.
The installation program can use VerFindFile with the destination-file name to determine where the file should be copied
on the disk. This function can also be used to specify whether the file is
private to the application or can be shared. If a problem occurs in finding the
file, VerFindFile returns an error value. For example, if Windows is using the destination
file, VerFindFile returns VFF_FILEINUSE. The installation program must notify the user of the
problem and respond to the user's decision to continue or to end the
installation.
VerInstallFile copies the source file to a temporary file in the directory specified by VerFindFile. If necessary, VerInstallFile expands the file by using the functions in the data decompression library.
VerInstallFile compares the version information of the temporary file to that of the
destination file. If the two differ, VerInstallFile returns one or more error values. For example, it returns VIF_SRCOLD if the
temporary file is older than the destination file and VIF_DIFFLANG if the files
have different language identifiers or code-page values. The installation
program must notify the user of the problem and respond to the user's decision to
continue or to end the installation.
Some VerInstallFile errors are recoverable. That is, the installation program can call VerInstallFile again, specifying the VIFF_FORCEINSTALL option, to install the file
regardless of the version conflict. If VerInstallFile returns VIF_TEMPFILE and the user chooses not to force the installation, the
installation program should delete the temporary file.
VerInstallFile could encounter a nonrecoverable error when attempting to force installation,
even though the error did not exist previously. For example, the file could be
locked by another user before the installation program attempted to force
installation. If an installation program attempts to force installation after a
non-recoverable error, VerInstallFile fails. The installation program must contain routines to recover from this
type of error.
The recommended solution is to display for all errors a common dialog box with
the buttons Install, Skip, and Install All. (Another solution is a dialog box
with the buttons Yes, Yes to All, Skip, and Cancel.) The Install All button
should prevent the installation program from prompting the user about similar
errors by including the VIFF_FORCEINSTALL option in all subsequent uses of VerInstallFile. For nonrecoverable errors, the Install and Install All buttons should be
disabled.
To display a useful error message to the user, the installation program
usually must retrieve information from the version resources of the conflicting
files. The file installation library provides four functions the installation
program can use for this purpose: GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue, and VerLanguageName. GetFileVersionInfoSize returns the size of the version information. GetFileVersionInfo uses information retrieved by GetFileVersionInfoSize to retrieve a structure that contains the version information. VerQueryValue retrieves a specific member from that structure.
For example, if VerInstallFile returns the VIF_DIFFTYPE error, the installation program should use the GetFileVersionInfoSize, GetFileVersionInfo, and VerQueryValue functions on the temporary and destination files to obtain the general type
of each file. If the languages of the files conflict, the installation program
should also use VerLanguageName to translate the binary language identifier into a text representation of the
language. (For example, 0x040C translates to the string "French.")
If VerInstallFile returns a file error, such as VIF_ACCESSVIOLATION, the installation program
should use the GetLastError function to retrieve the most recent error value. The program should
translate this value into an informative message to display to the user. The program
must not yield control between the calls to VerInstallFile and GetLastError.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|