
"DSKCLN.EXE"

December 12, 1999

This program cleans your disk.

The source code has been written entirely by me and I give anyone the full
right to use it in any way they want.

It only works on DOS based systems.  It checks to see if the dos version is
MSDOSx and if the fat type is FAT16. It also checks to see that the two fat
tables are equal.

!!!! DO NOT USE THIS PROGRAM ON A COMPRESSED DISK !!!!

You should run SCANDISK or CHKDSK before running these routines. Defrag is
also recommended.

The program does not erase any files but it will erase all traces of any files
that have been deleted.

You get to chose which clean routines will be executed.  There are three.

1) Clean directories
	Deleting a file or directory entry only sets the first byte of the entry
	to 0xe5.  All the other bytes of the file name and extent are still there.
	Along with the starting cluster, file size, and date/time stamps.  The
	first byte of the last entry of a directory is set to 0x00 to signal the
	BIOS that there are no more entries in the directory.
	This routine goes through all directories in the partition and zeros out
	any deleted entries.
	It looks to see if the directory entry begins with 0x00 or 0xe5 and writes
	0x00 to the next 31 bytes leaving the begining byte as it is.
	It descends through all sub directories and cleans them as well as the root
	directory.
	The program handles sub directories which span more than one cluster.

2) Clean all free space
	This routine goes through the fat table and cleans any clusters that
	have the value of 0x0000.  The value 0x0000 indicates that the cluster is
	unused.  It cleans the cluster by first writing 0x00, then 0x55,
	then 0xaa, and then 0x00 again to the entire cluster.

3) Clean all file/cluster ullage
	Ullage is a word that means the unused portion.  When a file is written
	to the disk it seldom takes up an exact number of clusters.  That little
	bit between the end of the file and the end of the cluster can contain
	previous information that may have been in the cluster.  This area is
	cleaned by writing 0x00, then 0x55, then 0xaa, then 0x00 again to the
	unused portion of the cluster.  If you lose power during this process you
	could lose the last cluster of a file.

I use this on a DOS based disk (MS-DOS Version 6.22) that also has WIN 3.11.
WIN 3.11 may be set to create a permanent swap file and this should be erased
if you want to get rid of all traces of a file or program before running the
program.  WIN 3.11 will recreate the swap file when it is started again.

You should run this program from DOS and not from WIN 3.11.

I have run this program on two different systems with no problems.  One was
a 1 GB disk using 64 sectors per cluster (MS-DOS Version 6.22) and the the
other was a 20 MB disk using 4 sectors per cluster (MS-DOS Version 4.01).

Remember that if you run another program that keeps a log file of any sort,
this will not get rid of it.  You have to delete that yourself.

The program was compiled under Borland 4.52.  All of the files have a *.cpp
extent but it is written entirely in standard 'C'. The cpp compiler is used to
compile the program.  You should turn off the 'pre-compiled headers' option
because I used #include directives to combine the source in cmain.cpp.  Use
the 16 bit compiler for 'DOS(standard) - Platform' and 'Target Model - Large'.
Put all the files into the same directory and open the 'project' file
dskcln.ide in Borland 4.52.  Then open cmain.cpp and compile and make.

I have not distributed the *.exe file because this program can be dangerous and
you should know what you are doing.  Since the program has not been tested
on all versions of DOS machines it could do harm on some.

If you really need help or you want the dskcln.exe file you can reach me at
wsjohns@ibm.net.

Have fun.


Bill Johnson


