delorie.com/djgpp/doc/dpmi/ch4.2.html   search  
Client Termination

A protected mode client terminates by executing an Int 21H in protected mode, passing the value 4CH in register AH and a return code in register AL. (This mimics the Int 21H Function 4CH termination used by DOS applications in real mode.> The client has the following responsibilities before termination: When the DPMI host detects an Int 21H Function 4CH termination request, it takes the following actions (the detailed comparison of DPMI version 0.9 and version 1.0 host termination handling is in Appendix C, page 158>: After the DPMI host performs the cleanup activities listed above, it will switch to real mode and re-issue the Int 21H Function 4CH interrupt, passing the return code from the DPMI client down to DOS. DOS will then terminate the client as a real mode process by releasing its DOS memory blocks (whether allocated by real mode Int 21H Function 48H or by DPMI Function 0100H), flushing file buffers, closing file and device handles, and so on.

Clients should only terminate from their main thread of execution, and should not issue the protected mode Int 21H Function 4CH from within a hardware interrupt handler, exception handler, or real mode callback. Client may, however, terminate from within a protected mode routine that has been entered via the DPMI raw mode switch service. Clients which wish to terminate-and-stay-resident to provide services to protected mode clients should use DPMI Function 0C01H rather than Int 21H Function 31H.

Note: Although the DPMI host monitors for Int 21H Function 4Ch in protected mode, it ignores all other Int 21H Functions. DOS Extenders typically install an interrupt 21H handler of their own in order to trap and service DOS function requests by a protected mode application; thus, the DOS Extender's Int 21H handler will always see the Function 4CH termination request first. The DOS Extender should perform any cleanup activities of its own and then pass the termination request to the DPMI host by chaining the original owner of the protected mode Int 21H vector.


  webmaster     delorie software   privacy  
  Copyright © 1999     Updated Feb 1999