(*******************************************************************
Program/Unit                 MYINSTAL.PAS
Written                      06 Dec 90
Revised                      .........
Author                       Johnathan J. Stein
                             PO Box 346
                             Perrysburg, OH  43551
                             CompuServe 76576,470
Purpose                      To illustrate how to implement EXE
                             file "stamping", in order to discourage
                             illegal copying WITHOUT using copy protection.
Contents
--------
Sample installation program, which uses "IsExePersonalized" to see if
it is neccessary to do a first-time setup and "stamp" the EXE application
program.

Both the installation and application program share data display routines.
*******************************************************************)
USES Crt,
     exechk ;

CONST
   MyInstallDrive            : string = 'A:\' ;
   MyProgramName             : string = 'MYPROG.EXE' ;

{$I mydata.inc }                       (* Data Entry & Display *)
{$I abort.inc }                        (* Global halt with message *)

procedure MyInstallExe ( S : string ) ;
begin
   if not IsDriveA ( ParamStr ( 0 ) ) then
      Abort ( 'INSTALL must be run from drive A:' ) ;
   MyDataInit ;
   if IsExePersonalized ( S ) then               (* Do not let user change data! *)
   begin
      ExeReadData ( S ,
                    Data ,
                    SizeOf ( Data ) ) ;          (* Get from EXE file *)
      MyDataOutput ;                             (* Display name, etc *)
      EXIT ;
   end ;
   MyDataInput ;                                 (* Get input from USER *)
   if not Ok then
      Abort ( 'Installation cancelled!' ) ;      (* End program *)
   ExeInstallData ( S ,
                    Data ,
                    SizeOf ( Data ) ) ;          (* Append to EXE file *)
end ;

procedure MyMainInstall ;
begin
   writeln ( 'My Main Installation Procedure!' ) ;
{
   Put your custom install procedures here.
   ----------------------------------------
   MyCreateDir ;
   MyCopyFiles ;
   MyWhatEver ;
}
end ;

begin
   writeln ( 'ABC Software Company' ) ;
   writeln ( 'Installation Program for ' , MyProgramName ) ;
   writeln ( '---------------------------------------------' ) ;
   MyInstallExe ( MyInstallDrive + MyProgramName ) ;
   FileMode                  := 2 ;              (* Reset to TP default *)
   MyMainInstall ;
end .
