Microsoft KB Archive/45891

= QuickBasic Can Corrupt COMSPEC under PC-DOS 3.30, Maybe Hang =

Article ID: 45891

Article Last Modified on 11/21/2006



This article was previously published under Q45891



SYMPTOMS
Under certain circumstances, it is possible for the MS-DOS COMSPEC variable to become corrupted, and consequently, the system may hang. The circumstances vary among different versions of DOS. For example, it has been reported and confirmed to be a problem with PC-DOS Version 3.30. That is, the problem does not occur (under these circumstances) in other versions of PC-DOS or even MS-DOS.



STATUS
Microsoft has confirmed this to be a bug in Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 and Microsoft Basic Compiler Versions 6.00 and 6.00b. We are researching this problem and will post new information as it becomes available.



MORE INFORMATION
The steps required to make the program below corrupt the COMSPEC variable are as follows:

 Compile and LINK the example into an .EXE using QuickBasic Version 4.50. Reboot with PC-DOS Version 3.30. Execute the .EXE version of program. Set an environment variable at the DOS prompt (e.g. SET MYVAR=A:NEWCOM). Enter the QuickBasic editor. Immediately exit the editor, and the following message will appear:

&quot;Insert disk with newcom in drive A

and strike any key when ready&quot;

</li></ol>

This error can also be achieved by POKEing a 7 into 9F86:0008, the address assigned in the offending statement.

Code Example
CALL TEST

' MakeSound is not called; only required to force stringarr ' in sub test to be allocated at the proper address (9f86:0000). SUB MakeSound SOUND 880, 10 END SUB

SUB Test ' IntArr is declared to ensure that StringArr IS     ' allocated at the proper address DIM IntArr(0 TO 794) AS INTEGER DIM StringArr(0 TO 4) AS STRING * 13 'Address 9F86:0000

' this is the offending statement -- can be any character MID$(StringArr(0), 9, 1) = CHR$(7)   'Address 9F86:0008

' StringArr ADDRESS IS PRINTED OUT FOR DIAGNOSTIC PURPOSES. PRINT &quot;StringArr ADDRESS = &quot; HEX$(VARSEG(StringArr(0))) &quot;:&quot; _ HEX$(VARPTR(StringArr(0))) END SUB

Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50

Keywords: KB45891

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.