UBACKUP 2.90

 

 

NATIVE DELPHI COMPONENT ADDS COMPLETE BACKUP CAPABILITIES TO ANY DELPHI APPLICATION WITH ONLY FEW LINES OF CODE

 

© 1995-1997 UDEEDV GmbH Hamburg

 

RELEASED : 31. March 1997

 

 

 

 

 

Introduction *

Features *

Credits *

How to use UBACKUP *

Installation 16bit Version *

Installation 32bit Version *

Differences between 16- and 32-bit version *

Quick Start of using UBACKUP *

Short Technical Documentation of UBACKUP *

Properties *

Methods *

Events *

Troubleshooting *

WHATSNEW – version history *

Things to come for the next version of UBACKUP *

Registration *

 

 

 

Introduction

 

A native Delphi component that will take the pain out of backing up your application and data. Just drop this component on your form, set some of its properties, and with one line of code you have a complete backup to any drive you like.

 

Version History - for new features see WHATSNEW – Section on Page *

Features

 

Shareware version is fully functional but runs only under Borland IDE. Registered users will get a full version, source code, and one year free updates. Registration fee $50 (US) or DM 69. Register via SWREG #8741 Uploaded by the author. To contact: CIS 100112,2777. Arnold Ude

Credits

This Software wouldn't be possible without the patience of my wife Claudia.

My thanks go to Matthew McDermott who revised this document and created the online help file. Additional thanks go to Johan Quarre for adding Dutch support.

How to use UBACKUP

Installation 16bit Version

First copy the files UBACKUP.DCU, UDEBIB.DCU, LZSS32.DCU, BDISK.DCU from the directory DELPHI16 in the archive to your component directory. To install UBACKUP to your development system, select "Options|Install Components" from the Borland IDE. Add the file UBACKUP.DCU and rebuild the component library. The new component can be found under the section UWARE on the palette. Right click the palette and select "Configure" to move the UBACKUP Icon to the section you prefer. A demonstration program is provided in DELPHI16\backtest.dpr.

Installation 32bit Version

First copy the files UBACKUP.DCU, UDEBIB32.DCU, LZSS32.DCU from the directory DELPHI32 in the archive to your component directory. To install UBACKUP to your development system, select "Options|Install Components" from the Borland IDE. Add the file UBACKUP.DCU and rebuild the component library. The new component can be found under the section UWARE on the palette. Right click the palette and select "Configure" to move the UBACKUP-Icon to the section you prefer. A demonstration program is provided in DELPHI32\back32.dpr.

Differences between 16- and 32-bit version

Currently it has not been possible to get the format disk routines under Win32 running for Win95 and Windows-NT. Therefore they have been disabled completely under 32-bit. In the near future I will re-add this features in both versions.

Quick Start of using UBACKUP

UBACKUP provides an easy way to backup the files of your application to any drive or disk. To use UBACKUP follow the steps:

 

  1. Drop the UBACKUP component on your form.
  2. Set Compression to true if you want compression during backup.
  3. Use the FilesToBackup property to specify what to backup. Use one line per specification. Each line can contain a fully qualified filename with or without wild cards (*,?). If you want UBACKUP to backup all matching files in subdirectories too, just add /S to the line. For example: c:\test\*.pas will backup only the *.pas files; c:\test\*.pas /S will backup all *.pas files in the c:\test directory and all subdirectories of c:\test; OR set FileList to the path and name of your file name list file. Set BackupOn to the Drive and optional path of the destination of your backup.
  4. Set Overwrite to true if you want existing files to be overwritten without confirmation.
  5. Set Description to any text description of the backup set, or leave it blank.
  6. Set Language to English or German, for message dialog boxes.
  7. Insert the following line in your code (usually in response to a button or menu click) Ubackup1.Backup; Compile and run

 

To have the files restored to the original destination use the line Ubackup1.Restore;

Short Technical Documentation of UBACKUP

Properties

Compression : Boolean;

This property allows the user to decide if UBACKUP should compress the data during the backup and decompress it during restore. If this property is set to true, UBACKUP tries to compress the data block by block. Each block will be written in compressed format only if the compression actually saved space. This is done to avoid overhead for already compressed files (eg. ZIP archives). During the restore process, UBACKUP decompresses every compressed block automatically. This property is relevant only during backup.

BackupOn : String;

This property specifies the destination of the backup and the source for the restore of files. You can specify a drive letter and an optional path where the backup files should go. To have your files backed up to the first disk drive set this property to A:\

 

BackupMode : (BM_Copy, BM_FullBackup, BM_Incremental, BM_Differential)

This property specifies the mode of backup operation. When Backupmode is BM_Copy then every selected file will be backed up and the archive flags will be left untouched. If Backupmode is BM_Fullbackup every selected file will be backed up and the archive flags of the backed up files will be reset afterwards. When BackupMode is BM_Incremental only those files will be copied whose archive flag is set before backing up. After the backup process finishes all archive flags are reset. If Backupmode is BM_Differential then only those files will be processed whose archive flag is set and the flags will be left untouched.

FileList :String;

Since Version 1.01 there are two ways of setting which files are to be backed up. If you set the ExternFileList property to true, you can use this property to specify an external file that contains the backup file specifications. Each file specification goes on one line of the list file. You should include the drive and complete path with each file line. This property and the way UBACKUP handles the files to backup will be improved with the next version. This property is relevant only during backup operations. During restore all files are currently restored to their original directories.

Overwrite : Boolean;

During backup and restore operations this property determines if existing files are overwritten without confirmation. If you set this property to true, existing files on your backup destination will be deleted without confirmation! To avoid any "accidents" the backup destination "C:\" will not be accepted if the Overwrite property is set to true. During restore this property determines if existing version of the files to be restored will be replaced. If you set this option to false and matching files are found the user will be prompted to confirm overwriting the files.

DeleteTargetDir: Boolean;

During backups will this property set to TRUE (which is actually the default) delete anything what it finds in the target directory. Setting this property to FALSE will keep the existing contents.

Description : String;

This property lets you name your backup set. During backup the value of this property is written as descriptive header to your backup file. During restore this property is undefined.

FileAtWork : String;

This property is valid only during the backup/restore process. The property contains the name of the file actually being processed. If you handle the OnNextFile event you can inform the user of the current file name.

Language : TLanguages;

This property controls the language used in the message boxes presented to the user by the component’s default error handlers. Currently your choices are German, English, French, Dutch, Danish, Spanish. More languages to come by request. You can handle events and present your users with your own dialog boxes and messages.

Percent : Integer;

This value is only defined during backup / restore processes and shows the percentage of work done.

Answer : (Yes,No,All)

This value indicates the preferred action of the user for overwriting an existing file. This property is meaningful only during the progress of the restore process and should be set only as a reaction to the OnOverwriteFile event.

ExternFileList: Boolean;

Set this property to TRUE if you have a text file ready containing all the files to backup. Set this property to false if you want to use the Stringlist property FilesToBackup rather than the text file.

FilesToBackup: TStrings;

This Stringlist contains file specifications of the files to be backed up. Each line is one specification. Every filename can optionally contain wild cards (*,?) in the old DOS style. Every line appended by /S will recurse into the subdirectories of the specified directory. To backup the whole hard disk for example, the file specification would be: C:\*.* /S. For just backing up all text files in a directory and its subdirectories use: C:\MYTEXT\*.DOC /S

FilesInArchive: Tstrings;

This stringlist can be filled with the GetInfo method. After calling the GetInfo method this property contains a list all files contained in the current backup set. You can use this property to perform a selective restore. If you set the SelectiveRestore property to TRUE UBACKUP will only restore those files contained in this stringlist property.

ArchiveBaseName: String;

The contents of this string property will be used as the base name for the archive files. If no value is given 'UBACK' will be used by default. The resulting names of the archive files will be the base name appended with a file extension indicating the number of the disk in the backup set.

SelectiveRestore: Boolean;

This boolean property determines if the restore method processes all files in the backup set (FALSE) or just the files contained in the Stringlist property "FilesInArchive" (TRUE).

RedirectRestore: Boolean;

If this property is set to TRUE the resulting restored files will be written to the directory contained in the RestoreTo property.

RestoreTo: String;

This property gives the base directory where the files to be restored are copied if the RedirectRestore property is set to TRUE. The resulting location of a restored file is constructed from this string property together with the original path in the following way: The original file path will be cut by as many directory levels as this property contains. If for example the original filename was c:\tmp\test\a.dat and this property is set to c:\tmp2 the first level is cut off from the original and will be prefixed by c:\tmp2 so the resulting filename will be c:\tmp2\test\a.dat

RemainingTime: TDateTime;

This property is of type TDateTime (declared in Sysutils) and contains the fraction of a day the running process backup/restore needs to be completed. You can simply use the FormatDateTime procedures to output this time to a meaningful display of estimated time remaining.

StopAtMissingFile: (CONTINUE,STOP,ASK);

This property determines how to handle missing files during the backup process. CONTINUE: The missing files will simply be skipped without confirmation and NOT backed up. STOP: UBACKUP will stop backing up files and result with an error if one of the files to back up doesn't exist. ASK: UBACKUP will ask the user what to do with each missing file (skip, abort or skip all).

FormatDisk: Boolean;

This property set will format your floppy disks during backup (only in Delphi 1.0 Version). You must specify the DiskCapacity property if setting this property to true. Due to changes in the WinApi to Win32Api a reliable way to format disks hasn’t been found yet for Delphi 2.0. This features is therefore disabled when compiling for Delphi 2.0. It will be available in the future.

DiskCapacity: (C360K, C720K C1200K, C1440K);

Specifies the capacity of the disks being formatted if FormatDisk set to true. It can have the following values: C360K, C720K C1200K, C1440K - obsolete with Delphi 2.0 at the moment

 

UseLogFile : (NO_LOG, OVERWRITE_LOG, APPEND_LOG);

Specifies if UBACKUP should maintain a log file of ist restore / backup activities. If this property is set to something different than NO_LOG a log file is maintained and the property LogFileName must contain a valid file name for the log file. If this property is OVERWRITE_LOG every call to the Restore or Backup method will restart a log file of the given name thus after performing the required task the specified log file will just contain a log of recent files read / written. If UseLogFile is set to APPEND_LOG all backup / restore activities will be appended to the specified log file.

LogFileName : String;

This property must contain a valid filename for the log file to use, if the property UseLogFile is not NO_LOG. In an 32bit environment the property can contain long filenames as well.

Encryption : Boolean;

This property can set to TRUE to encrypt the backup archive using the Blowfish algorithm; see on page * for further details about it. Encryption is valid for both backup and restore and a keyword phrase must be provided in EncryptionKey.

EncryptionKey : String;

If encryption is enabled this property must contain a keyword phrase (of arbitrary length and case sensitive). If data was encrypted during backup you must use exactly the same password to be able to retrieve the data during restore.

 

Note : There is no way to recover your data if the password is lost. The author of UBACKUP won´t be held responsible for any damage or data loss which could occur during encryption.

Methods

Function Backup : Integer;

After you set the minimal properties of the component you can call this Method. It backs up all the files as specified and returns an integer value after completion. This integer value contains the result of the backup process. (See Result Codes)

Function Restore: Integer;

After you set the properties of the component you can call this method. It restores all the files contained on the Backup destination you provided and returns control after completion. For the meaning of result codes see "result codes" later on.

Function GetInfo(var Description : String; var created : TDateTime) : Integer;

This method retrieves information about a specific backup set. It returns the description provided for the backup and the time and date when the backup was performed. This method also retrieves a complete list of all files inside an archive. The gathered information will be located inside the stringlist FilesInArchive. To do so it needs only the first disk of a multiple disk backup.

Procedure Abbruch;

If you handle the events UBACKUP provides, and you or your user decides to stop the backup or restore in process, you can call this method in an event handler and the process in progress will return with the result code BERR_CANCEL.

Events

OnPercent : TNotifyEvent;

This event will be called every time the value of percentage done is incremented. You can handle this event with the display of the property "percent".

OnReady : TNotifyEvent;

This event will be called after the BackUp or Restore process is completed.

OnNextFile : TNotifyEvent;

This event will be called every time a new input file is being processed during backup, or a new output file is being written during restore. You can handle this event and use the property FileAtWork to show the current filename to the user.

OnNextDisk : TNotifyEvent;

This event will be called every time a new disk is requested to backup to or restore from except for the first. If you don't handle this event a default message box in the language specified by the Language property will be presented to the user. If you do handle this event you must prompt the user yourself. You can call the method Abbruch during this event handler to stop the BackUp/Restore process.

OnOverwriteFile: TNotifyEvent:

This event will be called if the overwrite property has been set to false and UBACKUP is about to overwrite a file during the restore process. The property FileAtWork contains the name of the file about to be overwritten. Your application can react by issuing an Abbruch command to cancel the whole restore process or by setting the Answer property to one of the allowed values "Yes, No, All".

OnStartFileScan: TNotifyEvent:

Since the file selection process can cause the CPU to be very busy, the user should be kept busy too - at least he should have something to read and to let him know that everything is still working. This event will be called when starting the file selection process and can be used to prepare a dialog box for the users benefit.

OnEndFileScan: TNotifyEvent;

After all files have been selected this event will be called. This event can be used to close a dialog box opened at the beginning of the file scan process or for any other task the programmer wants to perform before the actual copy process starts.

OnNextDir: TNotifyEvent;

Every time another directory is processed during a recursive file selection process this event is called. The property FileAtWork contains the directory being processed. This event will be called once for every included directory for every line in the file selection specification.

OnFileFound: TNotifyEvent;

Every time the file selection process finds a file which matches the file specifiers this event is called. The property FileAtWork contains the name of the file found Result Codes

BERR_OK= 0;

The command issued completed without any problems.

BERR_CANCEL= 1;

The user canceled the process. This happens either by the application calling the Abbruch method or by the user canceling a next disk dialog with the cancel button.

BERR_WRONGTAG= 3;

The backup file provided is garbled and unusable. With the Delphi 2.0 version could this error indicate an inconsistency between the "align records" option between backup and restore program. You should have checked this option always on.

BERR_READ = 5;

This indicates a read problem on the device where the backup is located.

BERR_CRC = 6;

The CRC checksum shows that the data which is going to be restored is not the same as when it was backed up.

 

BERR_FILENOTFOUND = 7;

This error occurs when UBACKUP cannot open the file specified. This happens if the file could not be found at all or another process or user has locked the file for read access.

Troubleshooting

Problem: Backup up database files and getting a system warning "file already in use by another process" ?

 

Solution: You must put a Database component on the mainform and link ALL database tables and queries to it. It is then just a matter of closing the connection to your database before you backup and opening the connection afterwards. In the case of an MDI application (as mine is) it is a good idea to close all child forms first before setting the connected value of the database to false

 

Problem: Invalid Pointer when terminating an application using UBACKUP component ?

 

Solution: UBACKUP can be used only once in an application due to some global memory restrictions within the compression scheme. Use only one component in your application.

Blowfish encryption scheme

The blowfish encryption scheme was added to provide a secure means of encrypting the backup archives. Blowfish was developed by Bruce Schneier who gave this algorithm into the public domain. The company Cryptocard incorporated this algorithm in their cryptocard pascal library which is used in UBACKUP. This cryptocard library is © by Cryptocard Inc. Carleton Canada. UBACKUP uses this library and the Blowfish scheme with written permission of cryptocard and Bruce Schneier. For further details contact gregc@cryptocard.com.

WHATSNEW – version history

2.90: - Blowfish encryption scheme

2.85: - Swedish support added

2.83: - RestoreNewer - restores only newer / missing files

2.82: - DeleteTargetDir FALSE/TRUE deletes target first before backing up

2.81: - Significant speed enhancement of compression

2.80: - Full-, incremental- and differential backup modes

2.70: - Spanish supported

2.63: - Danish language supported

2.62: - Dutch language supported

2.61: - French supported properly

- Optional logfile

2.60: - New pricing and version scheme

2.50: - Source code revised

- GetInfo searches drives for archives

- Directory tree will be created on restore

2.12a: - Pricing policy changed

2.12: - records now declared as packed

2.11: - Minor bugfix

2.01: - 16/32bit sources had been garbled completly during combination

of both versions. Fixed !

New directory structure - new file names, different directories

for both versions

2.00: - Combined version for Delphi 1.0 / 2.0

1.05: - During restore no msg about disks being formatted (what isnt true!)

1.04a: - Online documentation completed with help of Matthew McDermott

1.04: - Optional formatting of floppy disks during backup

- Revised documentation \

- Online help file added / with help of Matthew McDermott

- Archive compressor changed to ARJ & SFX

1.03: - Disknumbering fixed, disk full error fixed

1.02a: - Some files with certain attributes havent been backed up. Fixed

- Non existing backup destinations now created

1.02: - Basename of Archives is now a (String-) property

- If the backupdestination directory isnt existing it will created

automatically

- If C:\ is specified as backup destination it wont be cleared before

backup even if fOverwrite is set.

- new property filesInArchive shows after backup which files were actually

backed up

- method GetInfo builds a list of all files contained in all backup

disks of a set. the resulting list is accessable via the FilesInArchive property

- RemainingTime give an estimation of time to complete the current task

- restore to different destination is possible

1.01: - Compiling with the -DSHAREWARE set compiles to a version only running

under IDE

- Original file attributes and timestaps will be restored.

- Files to back up can now be defined in a TStringlist rather than

in the old external textfile

- Filenames can now contain wildcards to match more than one file

- Subdir recursion

- Lots of additional events to make the file selection process visable

to the application / user

- Critical error message handled by Ubackup if theres no disk in a

removeable drive to backup to

 

Things to come for the next version of UBACKUP

The following things are on my to do list. If I missed anything just give me a hint:

 

  • UBACKUP mode for not generating archives but rather just copying in a directory structure like XCOPY for DOS does.
  • Generating self extracting archives spanning multiple volumes
  • Tape Support

 

Is anything missing here - please let me know !

Registration

This software is copyrighted by Arnold Ude, UDEEDV GmbH Hamburg and is provided as "Shareware" which means you can evaluate this software for free.

 

This software is not limited in function compared to the full version except that it only runs under the Borland IDE.

UBACKUP is available in three different versions:

 

UBACKUP 2.9 / 16 bit is for Delphi 1.0 only, it costs USD 62, you can register via SWREG-ID # 13478

UBACKUP 2.9 / 32 bit is for Delphi 2.0 only, it costs USD 62, you can register via SWREG-ID # 13479

UBACKUP 2.9 16+32 contains both licenses and versions for USD 95, you can register via SWREG-ID #8741

 

UDEEDV GmbH

Arnold Ude

Fernblick 3b

21077 Hamburg

Germany

CIS 100112,2777.