DTA Address Should Be Saved and Restored If Using EXEC

ID Number: Q60714

1.x 2.x 3.x 4.00 4.01

MS-DOS

Summary:

Before using the MS-DOS EXEC function (interrupt 21H, service 4BH),

you should save some of the system-related information before and

after the call is made. If you are using this information, you should

also restore it.

There are many things a child program can do that will modify the

environment of the parent program. Such things should be saved and

restored by the parent program. Common examples of things that should

be saved are the current drives, the current directories on each of

these drives, the contents of the video buffer, etc.

However, one of the most commonly ignored items that is not saved and

restored by a parent application is the Disk Transfer Area (DTA).

After using the EXEC function, MS-DOS does not restore the DTA address,

and instead keeps the previous one, which is the DTA address of the

child program. This can cause problems with the parent program if the

parent program assumes that the DTA address has not been changed.