QB.EXE May Overwrite File Allocation Table If Floppy Switched (40549)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b

This article was previously published under Q40549

SYMPTOMS

QB.EXE can damage a floppy disk's File Allocation Table (FAT) if the following steps occur:

  1. A program OPENs a disk file.
  2. The disk file is aborted with CTRL+BREAK before the file is ever closed.
  3. The floppy running QB.EXE is replaced with a different floppy disk.
  4. You exit QB.EXE.

STATUS

Microsoft has confirmed this to be a bug in QuickBasic Versions 4.00, 4.00b, and 4.50 and in the QB.EXE program that is shipped with the Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The program example shown below will cause QB.EXE to overwrite the File Allocation Table after the following steps are executed:

  1. QB.EXE is executed from a floppy disk.
  2. The program is started and then interrupted with a CTRL+BREAK.
  3. A different disk is put into the drive from which QB.EXE was executed.
  4. The QuickBasic QB.EXE editor is exited (such as with ALT+F+X).
The overwrite may occur whether the file is opened with RANDOM access or SEQUENTIAL access.

To work around the problem, do one of the following after breaking out of the program:

  1. Go to the immediate window and issue the command CLOSE.
  2. Exit QuickBasic before switching disks.
This program does not cause any problem with versions of Microsoft QuickBasic earlier than Version 4.00.

The following is a code example:
OPEN "test.dat" FOR OUTPUT AS #1
FOR i = 1 TO 10000
    PRINT #1, i
NEXT
				

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB40549