www.ethanwiner.com - since 1997

PC Magazine's PC-Setup

by Ethan Winer

This article first appeared in the March 16, 1993 issue of PC Magazine.


Distributing in-house or shareware programs and file updates can produce corporate chaos when novices have to install files into multi-layer directories. Commercial-scale installation utilities guide the unsophisticated user safely through the process, but these are often too elaborate and expensive a solution for smaller-scale programmers. Engineers, hobbyists, and database services that distribute data files regularly by subscription need an install utility scaled to their needs.

If you've got too many users to go from machine to machine and make the installation yourself, yet you're not confident that these users won't mess up the installation if you don't, what you need is PC-Setup. PC-Setup is designed to install any number of program or data files that have been compressed with the shareware utility PKZIP. It supports multiple distribution disks and will use or create any needed directories and subdirectories on the user's hard disk. File installation can be automatic or manual, and you can include comments to guide the user.

After the first installation, there is no need to repeat the procedure in order to install a different printer driver or other optional files. And best of all, no printed user instructions are necessary.

The utilities and programs that appear in PC Magazine may neither be distributed for a fee nor included in a commercial product. However, because of its purpose PC-Setup is in a somewhat different category. While it may not be sold by itself, PC-Setup may be distributed with any software - including commercial programs - provided no additional fee is charged. Click HERE to download a ZIP file containing the source and compiled program files, and a text version of this web page article.

PC-Setup requires a minimum of 256K RAM and DOS 3.0 or later. DOS 3.0 is necessary because PC-Setup uses interrupt services that are not available in earlier DOS versions. In addition to PC-SETUP.EXE, you must also have a copy of PKUNZIP.EXE on your first (or only) distribution disk. PKUNZIP is a shareware program that is available for downloading from the PKWARE web site, CompuServe, my MAIN page, and other bulletin boards. Note that if it is included with commercial software, PKWARE Inc. requires a nominal license fee. (To register PKUNZIP, send $47 to PKWARE Inc., 9025 N. Deerwood Dr., Brown Deer, WI 53223. To inquire about licensing fees, call 414-354-8699.)

The program was written using Microsoft QuickBASIC 4.5. To recreate PC-Setup from the supplied source code, you need QuickBASIC 4.0 or any later version of Microsoft compiled BASIC (including VB-DOS). When linking, you must specify the appropriate library name so that LINK can find the interrupt routine PC-Setup uses. The correct syntax and library names are shown below:

To compile using all versions of BASIC:

BC PC-SETUP /O ;

To link using QuickBASIC 4.0 and 4.5:

LINK PC-SETUP, , NUL, QB.LIB ;

To link using BASIC PDS 7.0 and 7.1:

LINK PC-SETUP, , NUL, QBX.LIB ;

To link using VB/DOS:

LINK PC-SETUP, , NUL, VBDOS.LIB ;

USING PC-SETUP

To begin installing from your distribution disk, the user simply enters:

[d:]PC-SETUP [/B]

where d: is the drive containing the .ZIP files to be decompressed and installed. PC-Setup detects whether a color or monochrome adapter is present and adjusts its display colors accordingly. The optional /B switch is needed only for systems with a composite display, that is, a CGA adapter connected to a monochrome monitor.

The three parts of the main PC-Setup screen display the names of the .ZIP files to be installed, the drive and directory into which they will be stored, and an optional comment that will usually be used to describe each file's contents. On-screen instructions explain each of the keys that are used by PC-Setup, and pop-up dialog boxes are used for any warnings. A brief status message shows the name of each file as it is being installed, further clarifying the program status.

As explained below in the section Setting Up for Installation below, you may elect to have one or all of your distribution files installed automatically. Assuming that the user wants instead to make the installation manually, he selects each .ZIP file to be installed by pressing the Spacebar. A check mark adjacent to the currently highlighted .ZIP filename is turned on or off each time the Spacebar is pressed.

By default, PC-Setup lists the current directory as the destination directory. If this is not correct, the user can enter the destination directory of his choice: The Tab key toggles between selecting .ZIP files for installation and editing the destination directories. If the user enters a destination directory that does not exist, PC-Setup will create it. When installing to an existing directory, the program asks whether to warn before overwriting same-named files.

Once all the desired files are marked and destined, the user presses F2 to begin installation. To exit from PC-Setup, a simple press of the Esc key will suffice. These options are shown at the bottom of the main screen, and operating PC-Setup should be easy enough for even the most inexperienced user.

SETTING UP FOR INSTALLATION

Your installation can use a maximum of 99 distribution disks, each of which may contain up to 19 .ZIP files. No single .ZIP file can be larger than the maximum capacity of a single distribution floppy disk, however. You are not restricted to using the root directory of the disks, though you must be sure to place PC-SETUP.EXE in the same directory as PKUNZIP.EXE. Both of these files must be located on the first distribution disk, together with your .ZIP files.

If your installation takes more than one disk, you must create a file named NUMDISKS.# on the first distribution disk - the one that you label as "Disk 1." The NUMDISKS extension, shown above as #, indicates the total number of disks and enables PC-Setup to prompt for additional disks as they are needed. The file itself can be empty; the filename and extension are the information. If you're operating under DOS, the easiest way to create an empty NUMDISKS file from the DOS command line is like this:

REM > A:NUMDISKS.004

SETTING DESTINATION DIRECTORIES

In preparing your distribution disks, there are several ways to establish the default destination drive(s) and directories for the files to be installed. If you do nothing at all, the user's current drive and directory will be displayed in the "Destination Directory" field for each of the files being installed. However, if the current drive is A: or B:, PC-Setup will substitute Drive C:. The utility won't attempt to unpack the files onto the distribution disk.

You can specify a directory as the global default destination directory by including a file named DEFAULT.DIR in the root directory of the first distribution disk. The one-line contents of this file specify the path for all of the .ZIP files. You can create DEFAULT.DIR either with any standard text editor that saves files in plain ASCII form, or directly from the DOS prompt by entering:

COPY CON: A:DEFAULT.DIR
C:\PRODUCT

and then hitting F6 followed by Enter. (F6 puts a Ctrl-Z, or end-of-file marker at the end of DEFAULT.DIR.)

You can also embed a directory name in the comment field provided for each file by PKZIP. Such an embedded directory name will override the global directory specified in the DEFAULT.DIR file (if one is present). To see how PC-Setup works with PKZIP in such a case calls for a brief explanation.

Comments can be added to .ZIP files by executing the command:

PKZIP filename.zip -z

Normally, your comment might be, for example, "This is the main program." PC-Setup displays such comments in its right-hand column, so the user can know the purpose of a particular .ZIP file. In place of, or appended to such a comment, you can embed a default destination path by entering the box character (ASCII 254), followed by the drive and directory. Thus, for example:

This is the main program (ASCII 254)C:\DIRNAME

The comment will be displayed in the usual manner, but PC-Setup will put the drive and directory in the left-hand, Destination Directory field. You can enter the box character at the DOS command prompt (and in most editors) by holding down the Alt key, typing 2,5, and 4 on the numeric key pad, and then releasing the Alt key.

Note that whichever of the three methods you use to supply a default destination directory, users can override your suggestion and specify a different drive and directory of their own choosing.

SELECTING FILES FOR INSTALLATION

In some cases your users may not want or need to install all of the files on the distribution disks. For example, some companies provide source code with their products, but many people aren't interested in programming languages and may prefer not to waste their disk space with such files. Or perhaps you distribute software that works with a variety of printers, and only one or two of several supplied drivers will be used by each customer.

To have a file selected for installation automatically, append an ASCII 251 check mark to the end of the comment string, but before the optional box character and destination path. Three examples cover the possibilities:

This is the main program(ASCII 251)(ASCII 254)C:\DIRNAME

or

This comment has no default path(ASCII 251)

or

(ASCII 251)(ASCII 254)C:\PATHNAME

Files whose comments have no trailing check mark will not be automatically installed when the program runs, although the user may, of course, select those files manually. Again, you can enter the check mark by pressing and holding the Alt key, and then typing the digits 2,5, and 1 when PKZIP prompts you to enter the .ZIP file comment.

The comment portion (before the box and optional check mark) can be up to 36 characters long, and the directory name portion of the comment (after the box) can hold as many as 25 characters. To make the comment field as long as possible, I compromised by allowing only 25 characters for the directory name.

You can tell PC-Setup to run a program automatically after PC-Setup finishes by storing its name in a file named PROGRAM.RUN placed on the first distribution disk. The name of the program must be no longer than 14 characters, since PC-Setup stuffs the program name (plus Enter) into the keyboard buffer. PC-Setup is smart enough to change to the directory where the first .ZIP file was installed, on the assumption that this directory will hold the main executable program.

If you need to execute a series of commands - for example, to load a TSR that must be present in order for the main program to operate - you can include a batch file within the .ZIP file and specify the name of the batch file in PROGRAM.RUN. Such a batch file should be in the same .ZIP file that holds the main program, so it will be installed where DOS can find it when PC-Setup ends. Note that the program or batch file specified in PROGRAM.RUN is executed only when the first .ZIP file on the disk is being installed. If PC-Setup is rerun to install a new printer driver, for example, it would be inappropriate to run the main program at that point.

INSTALLING TO NESTED DIRECTORIES

The only precaution you must take when your software is to be installed into nested directories is to specify that the higher directory levels be installed first. PC-Setup will create the directories needed if they are not already present, but it must work from the top down. For example, if you have main files that should go into \APPMAIN and ancillary files that are to go in \APPMAIN\SUBDIR, PC-Setup has to create \APPMAIN before it can create \APPMAIN\SUBDIR.

If you are careful to copy the .ZIP files on your distribution disk(s) in the correct order, this will not be a problem. Unfortunately, it is still possible for a user to create problems by changing the directory names during installation. There is little that can be done about this and if PC-Setup is unable to create a directory, it simply ends with an error message describing the problem. Note: If you include a DEFAULT.DIR file, it should specify a root-level directory only (with a leading backslash) unless you are certain that the upper levels already exist.


Ethan Winer is a contributing editor of PC Magazine.

Entire contents of this web site Copyright © 1997- by Ethan Winer. All rights reserved.