CASE HISTORY #7 - Conclusion by the Disk Doctor -------------------------------------------- Copyright (C) 1987, the Disk Doctor. First published in the Rochester (PC)^3 News: Picture City PC Programming Club PO BOX 20342 Rochester, NY 14602 The Disk Doctor may be contacted at this address, or via CIS [73147,414]. This material may be reproduced for internal use by other not-for-profit groups, provided this copyright notice is included. ---------------------------------------------- [When we last left our hero, he was in a sticky situation. He had no idea what was wrong with the 3 disks. What has happened to the program that it no longer works?] 2:32pm A montage of thoughts flashed through my mind as I struggled to find the answer. I opened my eyes and stared at my screen for some clue.... ** Four files of 65,536 bytes.... ** A filesize of 65,536. That number jogged something in my memory.... ** 64K is exactly 65,536 bytes. It must be more than a coincidence that there were four files of exactly 64K.... ** What was the significance of 64K? Something to do with copying to the hard disk.... ** COPYing! I've got it! I asked one more question to confirm my hypothesis. "S., what happened to the copy you made on your computer? Did you try to run the program on your hard disk?" "Yeah. But there was an error. Something about 'Bad command or file missing'." "Of course!" I proclaimed loudly as I spun in the chair to face her. "The files were missing because they were never copied on to your hard disk!" S. was startled by my sudden burst of insight. "Huh?" "What exactly did your brother tell you to do, to install the software on your computer?" I asked S. "Let's see. He made me memorize the list because he didn't trust me. 1) turn on the computer 2) insert the disk in drive A: 3) close the drive door 4) type A:INSTALL and press ." "And is that what you did?" "Yeah, of course." She looked at me, then reconsidered, "Oh, wait a minute, I think I might have gone over to drive A: to do a DIRectory first, to make sure I had disk #1, ya' know." "That clinches it. These files were copied on top of themselves!" I was difficult to control my excitement. "When your brother wrote INSTALL.BAT, he was expecting it would be run from drive C:. If you switched to drive A:, you've got big trouble." "And what harm does that do?" S. asked as she folded a stick of gum into her mouth. "With the DOS COPY command, files are copied in 64K blocks. DOS opens the source file, and reads the first 64K block. Next, it finds a file by the same name on the target disk, erases it, and copies the first block on top of it. Now, for any files bigger than 64K, DOS will go back to the source file to read the second block. It finds the file is now only one block long, so it quits. There probably wasn't even an error message. That explains the 64K file size and all the free space on your diskettes." "Let's look at that batch file again." I did a Shift-PrtScreen, and tore off the page: MKDIR C:\RX CHDIR C:\RX COPY A:\*.* PAUSE INSERT DISK #2 COPY A:\*.* PAUSE INSERT DISK #3 COPY A:\*.* 2:35pm "The problem is here with the line 'COPY A:\*.*. Internally, this gets expanded into this instruction..." I wrote on the right side of the printout, 'COPY A:\*.* A:' . "This copies everything from the root directory of A: into the default directory of the default drive. Unfortunately, in this case, it is the same directory." "Oh." She responded, showing mild concern, "I thought you weren't supposed to be able to do that." "The operating system is supposed to prevent such a blunder, but it is possible for DOS to get confused. DOS simply compares the source and destination file specification strings. In this case," I pointed to my handwritten instruction, "It is not an exact match, so DOS proceeds." "Well, can't you un-erase the file, or something? After all, you ARE the Disk Doctor." I shook my head. "Too late. When DOS did the damage, it also covered its tracks. That's why it took me so long to figure it out. On each disk, the largest file was first on the disk. All the subsequent files were copied over the tail end of the first erased file. There's no way to get them back!" S. obviously didn't share my satisfaction that the problem was solved. "I just paid $150 for this software. You mean I erased it?" "Unfortunately, yes. But let's find someone here using the same program. This software is not copy-protected, and you have the original disks to prove that you bought it, so we should be able to restore your disks without violating anyone's license agreement." [This story you have just heard is true. The names have been changed to protect the ignorant.]