- CrackUp Alerts You to Disk Fragmentation
- CrackUp: Download It Here
To gather the information it needs, CrackUp must be able to read disk sectors directly. It does so using the system's VWIN32 virtual device driver to call the necessary DOS (that's right, DOS!) functions. This device driver is not available under Windows NT, which is why CrackUp works only under Windows 95 and Windows 98.
Direct disk reads are performed by one of two functions, either OldReadSectors or NewReadSectors, depending on your Windows version. For Windows 95 OSR2 and later, NewReadSectors uses INT 21H function 7305H, which supports the FAT32 file system. For previous versions, OldReadSectors uses INT 25H.
At start-up, CrackUp obtains a list of all local FAT16 and FAT32 hard disks. It then calls the CheckFrag function to scan each eligible disk. Using the disk's BIOS Parameter Block (BPB) to locate the FAT, it reads the FAT into memory and calls CountFreeSpaces to tally free-space statistics. Next it calls the DrvAnalyze function to analyze file fragmentation.
Starting with the root, DrvAnalyze loads a directory's clusters into memory and examines each directory entry. If an entry represents a file, DrvAnalyze passes the file's first cluster to AnalyzeChain, which records the file's fragmentation. For a subdirectory entry DrvAnalyze calls itself recursively, passing the number of the subdirectory's first cluster, and then analyzes the subdirectory just as it would any other file. Since DrvAnalyze reads each FAT and directory sector from disk only once, and clusters allocated to files are never read at all, disk access is minimized.