[comp.sys.ibm.pc] Using DOS function 4Bh

andrews@hpcupt1.HP.COM (Edward E. Andrews) (04/06/88)

   I am trying to load a program (without executing it) using an
undocumented DOS function as follows:

        call	RelMem			; release memory to allow load
	lea	dx,byte ptr Filename	; get addr of file to load
	lea	bx,byte ptr ParmBlk	; get addr of parameter block
	mov	ah,4bh			; load program/overlay
	mov	al,1			; <--- do not execute program 
        int	21h			; DOS function interrupt

   On return, the ParmBlk has the entry point and initial stack pointer
values filled in.  In the PSP of the loaded program, the saved address
of INT 22h has the address of the instruction immediately following the
INT 21h above.  Fine.
   My question is what should be done to clean up the loaded program
when it terminates?  The Memory Control Block (MCB) list gets all messed
up if just try to release the memory of the loaded program's environment
block and program area.  Files may still be open. Etc.

   Thanks in advance.

+----------------------------DISCLAIMER-----------------------------------+
! The above doesn't even represent my opinions, so how can they represent !
! anybody else's?                                                         !
+-------------------------------------------------------------------------+