clinic2

advertisement
*********************************
*
C L I N I C
v2
*
*
by Claude Grenier
*
*********************************
FILE RETRIEVER AND VIRUS CHECKER
(monochrome and color monitors)
************ PUBLIC DOMAIN ************
Note: If you wish to use CLINIC only as a boot sector virus
checker, please skip to the last section of this document.
INTRODUCTION
Unlike many programs, CLINIC is a tool that, hopefully, you won't
have to use frequently. CLINIC is for those who, for whatever
reason, had the bad luck of losing vital location information on
a diskette, be it in the directory, the FAT (File Allocation
Table) or the boot sector. Maybe some of you already saw
something like billions of bytes in billions of items, and weird
characters as filenames, when opening a drive window. Well!
That's the kind of thing that may happen! Sometimes, the
directory looks OK, but files don't have the contents they should
have. In those cases, the FAT is probably in bad shape!
The best that can happen to you when you're in such trouble is
to rely on a user-friendly program that will allow you to
retrieve, sector by sector, your file data, which are intact on
the disk. CLINIC was done just for that!
What kind of files are recoverable in this way? Files that can
be tracked visually. Of course text files, database files,
perhaps some spreadsheet files, but also files like the ones
created with MIDI software, which often have typical sequences of
bytes that are repeated several times. On the other hand, any
executable file (a program) will be extremely difficult to
recover.
Also, CLINIC allows you to see the contents of diskettes that
don't have a standard boot sector and, as such, are not
recognized by other disk editors. With CLINIC, for example,
you'll be able to browse through SPECTRE diskettes. I even used
it to examine the contents of a WANG OIS disk, after having made
an exact copy of it from 5 1/4 format to 3 1/2 format with a disk
copier.
Of course, any disks that have a standard boot sector, be they of
ST, MS-DOS or ALADIN format, will be easily readable with CLINIC.
In the following instructions, we will assume, for simplicity,
that you want to recover a text document.
Let's recall first the basic structure of a formatted diskette.
It has sides (1 or 2), each side has tracks (normally 80), and
each track has sectors (normally 9). The first sector of the
first track of the first side is called the "boot sector". This
sector is where the operating system reads the information it
needs about the disk, either at boot-up time or when a new
diskette is inserted. Another remark: A file on a disk always
begins at the start of a sector.
FILE RETRIEVAL PROCESS
Some of you might think that as soon as the first sector of a
file is found, the rest of it will be located in the following
sectors, so that the recovery task should be easy. Well, it may
be so sometimes, but it is not in general. Actually, the
operating system stores files on disk according to the free areas
on it, and jumps from an area to another for a same file. The
information on these jumps is stored in the FAT.
So, let's say you find the start of your file and recover a
few consecutive sectors that are part of it. But suddenly, your
file is broken up by something completely different. Don't
panic, the rest is located on further sectors of the disk. With
the CLINIC search feature, you'll be able to easily jump to where
your files continues. Note, by the way, that the operating
system stores files in sectors by blocks of two contiguous
sectors, so that when you find a sector that belongs to your
file, the next one (or the preceding one) will also belong to
it (unless, of course, you have reached the end of your file).
A final note before going through the program features: if the
file you're trying to recover has been saved several times from
your word processor, and even more so if there was a .BAK file
saved each time, you'll see that your disk seems to contain
serveral times the same text. I think the best is not to worry
about that and to focus on recovering a correct sequence of
sectors. Of course, you'll have to thoroughly proof read the
recovered file later, since some parts of it won't be your last
version. But that's better than losing everything!!
(A word about SPECTRE double-sided disks: the sector sequence is
not the same as on a standard disk. All sectors of side 1 are
used before sectors of side 2. Consequently, to follow the
sector sequence in the order they were used by the operating
system, first go through sectors 0 to 9, then 20 to 29, and so on
up to 1420 to 1429, and them come back and inspect sectors 10 to
19, 30 to 39, and so on up to 1430 to 1439.)
CLINIC FEATURES
No matter what drive CLINIC is loaded from, the program will ask
you, if you have two floppy drives, in what drive your damaged
disk is located, or if you have only one, to insert the damaged
disk in drive A.
First Alert Box
--------------CLINIC will then read the BIOS Parameter Block (a sequence of
bytes located on the boot sector) and display the main
parameters: number of sides, number of tracks per side and
number of sectors per track. You are asked to confirm these
parameters. Your answer, in general, will be Yes, but remember
that since your disk is damaged, your boot sector might also be
damaged. If you KNOW that these parameters are not correct,
answer No and CLINIC will then ask you to enter the correct
parameters. From then on, CLINIC will consider that the disk has
the parameters you just specified.
When the parameter block is non-standard or non-existent on the
disk, CLINIC will display the message "Non-Standard diskette!"
and you'll be asked to enter the parameters yourself. For
example, in the case of a double-sided SPECTRE disk, enter 2 for
the number of sides, 80 for the number of tracks per side and 10
for the number of sectors per track. For a Wang OIS disk, enter
2 for the number of sides, 40 for the number of tracks per side
and 9 for the number of sectors per track. If you don't know the
parameters, enter the normal values (1 or 2, 80, 9). If, then,
you see that CLINIC seems to jump a sector every 9 sectors, the
NEW DISKETTE feature will allow you to start again by specifying
10 sectors per track instead of 9. Conversely, if you entered 10
sectors per track and see that CLINIC cannot read every 10
sectors, you'll be able to start again with a value of 9.
Of course, your disk may contain 81, 82 or even 83 tracks per
side, but (as far as user-specified parameters are concerned)
these cases were not taken into account, nor was the
rare case of 11 sectors per track. The only consequence is that
a few sectors won't be accessible with these kinds of disks.
Main Screen
----------The main screen is an area where bytes contained in sectors are
displayed. There is also a panel with push buttons where you may
click to access CLINIC's various features. Let's explain what
these features are.
Search...
--------When you click on SEARCH, two options are possible: an ASCII
search and an Hexadecimal search. In the former case, you enter
a string of characters and CLINIC searches a byte sequence
matching the ASCII codes of your string. In the latter case, you
enter an hexadecimal string and CLINIC searches for that sequence
as such. (For an HEX search, you must enter an even number of
characters; use a leading zero for values from 0 to F, e.g. 01
for 1, 0A for A).
When your search is successful, the sector containing your string
is displayed, with the string in reverse video. If you
immediately start another search into the same sector, CLINIC
will start that new search from the first byte that follows the
string that was found previously. This is a useful feature when
the string found is not the occurrence you were looking for.
Once your string is entered, press Return to start the search.
CLINIC will search through sectors, one by one. You may press
any key to stop a search. When the last sector has been reached
and the search is still unsuccessful, the message "Not found"
will be displayed.
If you don't want to start a search any more and the dialog box
is still open, just press Return with an empty string.
NOTE 1: CLINIC will not find a string that overlaps two sectors.
If you are looking for the continuation of a text, ask for the
first complete word contained entirely in the next sector.
NOTE 2: The search feature is limited to basic ASCII characters
and does not allow the use of extended ASCII characters, like
accented French letters. In order to find "r‚cup‚r‚", for
example, just ask for "cup". (Note that with a program like
WordPerfect, for example, since accented characters are put
between special characters, a search for "r‚cup‚r‚" would give
nothing anyway.) Note also that the search feature is case
sensitive.
Options...
---------Three options are offered for the byte display. In the case of
option "ASCII 32-126 as characters", the non-ASCII bytes are
displayed in a grey shade (on monochrome monitors only).
New diskette...
--------------Use this feature to examine a new disk or start again the
recovery on the same disk (after, for example, having changed a
parameter). This feature implies a complete rerunning of the
program main loop and will consequently cause the loss of any
sector previously put aside and not yet saved. An alert box
allows you to cancel.
Browsing buttons
---------------With the browsing buttons, you can browse through the disk by
steps of 1 or 10 sectors, in both directions. (Note, by the way,
that pressing any key displays the next sector.)
Put sector aside
---------------When a sector from the file you want to recover is displayed,
click on this button. Sectors put aside in this way are kept in
a buffer in RAM, one after the other. When you wish, you'll
later be able to save these sectors as a file. If a sector has
already been put aside, an alert box warns you of that fact. The
program assumes that you don't want to recover the same sector
twice.
Auto viewing
-----------This feature might be helpful for a first, fast inspection of
your disk. Click on this button and select a step of 10 sectors.
You'll be able, in this way, to locate your text on the disk.
You might then use the step of 1. Pressing any key stops auto
viewing.
Sector...
--------Two options are offered: go to the last sector put aside, or go
to any other sector. In the latter case, just enter the sector
number in the dialog. You'll soon acknowledge the usefulness of
the first option: go to last sector put aside; when a file is
suddenly broken up, you will frequently browse through the
following sectors, and then forget what was the last sector you
put aside. By using this option, you're sure not to get lost.
Finish...
--------Pressing on this button opens a dialog box where four options are
offered.
1) Save sectors put aside: CLINIC, first of all, will display
the last sector put aside and ask you to click on the last byte
you wish to save, in case you don't want to save the complete
sector because your file ends somewhere in the middle of it.
Then CLINIC, after asking you to use a save disk (different from
the damaged diskette), will save all sectors that you put in the
ram buffer as a unique file bearing the name of your choice. The
ram buffer will then be cleared.
2) Start from scratch: This option allows to clear the ram
buffer (if it contains anything) and to start the recovery all
over again.
3) Continue sector search: This option is equivalent to
cancelling this dialog box and to go on with your recovery where
you left it.
4)
Quit:
Quitting the program and returning to the GEM desktop.
Virus checker...
---------------This button gives access to the CLINIC'S boot sector virus
detection feature. (For those of you who used CLINIC v1, the
routines are the same.) If you fear to loose a valid boot
sector, this feature has a safety net. You can save the boot
sector as a file before cleaning it. In this case, if it was
required to boot up your disk, you just have to put it back with
CLINIC. Just follow the prompts given in the alert boxes.
To check more disks, just insert another one, click on NEW
DISKETTE, confirm the parameters and click on VIRUS CHECKER.
Once the check is completed, insert a new disk and do the same as
above.
A FINAL NOTE
That's all about it! As I said earlier, hopefully you won't have
to use CLINIC often (except perhaps for the virus dectection
feature). But, in any case, if you think that having such a tool
in your software library gives you a feeling of security,
something like an insurance policy, would you please be kind
enough to send me...Well, forget it... I don't like the idea of
asking money for something I had so much fun to do. Perhaps for
a next version... As you might have noted, there is room for
improvement in this program (sector editing, checking and working
on FAT, etc.) Well, really, I could have a few more hours of
great programming...
Claude Grenier
7355 Pelletier
Brossard (Qu‚bec)
Canada
J4W 3A9
Download