A Hidden Bug in DOS 3.3 SYS.COM: The NetDrive Disk Image Corruption Mystery
This article details the author's investigation into a bug in the DOS 3.3 system command `SYS.COM`. This command copies boot loader code to a disk, but when used with NetDrive virtual disk images, it corrupts the image. Through careful analysis, the author discovered that `SYS.COM` fails to check the return code of a Generic IOCTL call used to obtain disk parameters. When this call fails (e.g., the NetDrive driver doesn't support the function), `SYS.COM` erroneously writes garbage data to the disk's boot sector, corrupting the image. This bug only manifests on certain disk image types (e.g., hard disk images) because DOS attempts to retrieve disk geometry information, whereas floppy disk images do not. The author ultimately pinpoints the bug's root cause and explains the conditions under which it occurs.