Note: This API calls are shared between DOS and Win16 personality.
DPMI is a shared interface for DOS applications to access Intel 80286+ CPUs services. DOS DMPI host provides core services for protected mode applications. Multitasking OS with DOS support also provides DMPI in most cases. Windows standard and extended mode kernel is a DPMI client app. Standard and extended mode kernel differs minimally and shares common codebase. Standard Windows kernel works under DOSX extender. DOSX is a specialized version of 16-bit DPMI Extender (but it is standard DPMI host). Standard mode is just DPMI client, exnhanced mode is DPMI client running under Virtual Machime Manager (really, multitasker which allow to run many DOS sessions). Both modes shares DPMI interface for kernel communication. The OS/2 virtual DOS Protected Mode Interface (VDPMI) device driver provides Version 0.9 DPMI support for virtual DOS machines. Win16 (up to Windows ME) provides Version 0.9 DPMI support.
DPMI host often merged with DPMI extender. Usually DPMI extender provide DPMI host standard services and DOS translation or True DPMI services.
Int 31H, AH=0CH, AL=01H
Terminate and Stay Resident
AX = 0C01H BL = return code DX = number of paragraphs (16-byte blocks) of DOS memory to reserve
Nothing (this call never returns)
A resident service provider uses this function after its initialization to terminate execution while leaving its protected mode memory (and optionally some real mode memory) allocated.
This function should only be used by DPMI clients which only provide resident services to other DPMI protected mode clients. If the objective is only to provide resident services to real mode programs, the client should use the DPMI translation service Int 31H Function 0300H to invoke DOS's Int 21H Function 31H directly.The value in DX only specifies the size of DOS allocated memory to reserve. Any protected mode memory owned by the program remains allocated unless it is explicitly released before executing this function. Note that the value in DX must either be 0 or a minimum of 6. If DX is 0, the DPMI host executes a DOS real mode terminate function (Int 21H Function 4CH), and no real mode memory is reserved. If DX is nonzero, the DPMI host requests the DOS real mode terminate-and-stay-resident function (Int 21H Function 31H).
If the client has not made a prior call to Int 31H Function 0C00H, the client will simply be terminated.
For further details on programming of resident service providers, see that page.
Text based on http://www.delorie.com/djgpp/doc/dpmi/