winfave@dutrun2.tudelft.nl (Alexander Verbraeck) (05/16/91)
I have a very strange problem using the EXEC-procedure under Turbo Pascal 5.0. The problem is that the computer locks sometimes when executing the Exec-call. At first, the problem occurred when using an Exec after a heap-compress, and I thought the problem was with the heap-compression procedure, and not with the Exec-call. I could, however, reproduce part of the error with a very small Turbo Pascal program that does not compress the heap. The program is as follows (and YES, I KNOW it should not run!) ------------------------------------------------------------------------ program testmswp; {$M $4000,0,655360} uses Crt, Dos; procedure ItemFileEdit; var DosErrorCode : word; begin SwapVectors; Exec(GetEnv('COMSPEC'),'/C MS-WP.EXE item.txt'); SwapVectors; { The above ^ program does not exist. No problem } if DosError<>0 then writeln('EXEC ERROR NUMBER ',DosError); end; begin ItemFileEdit; end. ------------------------------------------------------------------------ The program does not have enough memory to execute, and therefore a DosError=8 should occur. This happens in most cases. When I run this program from a directory with a pathname longer than 20 characters, the computer locks up, violates CMOS Setup memory, and does other strange things. So: C:\TEST> testmsw2 [Enter] works fine, but C:\TESTTEST.TST\TESTTEST.TST> testmswp [Enter] locks up the computer... I am not sure it behaves this way on ALL types of computers and versions of MSDOS. I tested it on three different types of AT and 386 computers, running MSDOS 4.01, 3.1 and 3.3. It behaved in the same strange way on ALL three computers. But: not always, not from the IDE, but always from a "clean" dos version. When running it under the Turbo Debugger, the problem does NOT occur. When running it under TD386, the debugger locks after performing the Exec. I also got an 'Exception 12, Error 0' once. When loading one or two extra versions of COMMAND.COM, the problem does not occur, so I think it only happens using the primary copy of MSDOS, which is the one that was loaded during the boot process. HELP! Does anyone know what is happening? The program should generate a DosError=8, independent from the directory it was called from! Any ideas or pointers to a solution are appreciated! Sincerely, ------------------------------------------------------------------------- Alexander Verbraeck e-mail: winfave@duticai.tudelft.nl Delft University of Technology winfave@hdetud1.bitnet Department of Information Systems winfave@duticai.uucp PO Box 356, 2600 AJ The Netherlands winfave@dutrun.tudelft.nl Tel: +31 15 783805 Fax: +31 15 786632/787022 winfave@dutrun.uucp -------------------------------------------------------------------------