Programs that use DPMI services are called DPMI clients. Generally, DPMI clients fall into one of two categories:

In the near term, most client programs will need to be able to run in several different environments, each providing a different interface and range of services. It is recommended that clients test for the existence of such environments in the following order:

Figure 2 on page 21 illustrates a typical DPMI client configuration, consisting of a DOS Extender and a protected-mode application. The application code relies on the DOS Extender functions and APIs. The DOS Extender contains separate modules for each possible environment, and code to implement those services that are lacking in a particular environment.

Existing DOS extenders support APIs that differ from the Int 31h interface. Usually, DOS extenders use an Int 21h multiplex for their extended APIs. Extenders that support DPMI will need to initialize differently when they are run under DPMI environments. They will need to enter protected mode using the DPMI real to protected mode entry point, install their own API handlers, and then load the DOS extended application program.

Figure 2. An example of a DPMI client consisting of a DOS Extender and a protected-mode application. The client should be able to run in the presence of DPMI, VCPI, or XMS environments or in the absence of all three.

            +----------------------------------------------------------+
            |                                                          |
            |  +----------------------------------------------------+  |
            |  |                                                    |  |
            |  |                  Application Code                  |  |
            |  |                                                    |  |
            |  +----------------------------------------------------+  |
            |                                                          |
            |  +----------------------------------------------------+  |
            |  |           Extender Base (including APIs)           |  |
            |  | -------------------------------------------------- |  |
            |  |    DPMI                                            |  |
            |  |   client                                           |  |
            |  +------------+                                       |  |
            |               |    VCPI                               |  |
            |               |   client                              |  |
            |               +------------+                          |  |
            |                            |    XMS                   |  |
            |                            |   client                 |  |
            |                            +------------+             |  |
            |                                         |  Top-down   |  |
            |                                         |   client    |  |
            |                                         +-------------+  |
            |                                                          |
            +----------------------------------------------------------+

               +------------+
               |            |
               |            |
               |            |------------+
               |            |            |
               |    DPMI    |            |
               |    host    |    VCPI    |------------+
               |            |            |            |
               |            |            |            |
               |            |------------|    XMS     |-------------+
               |            |    EMS     |            |  Top-down   |
               |            |            |            |  (Int 15h)  |
               +----------------------------------------------------+

               +----------------------------------------------------+
               |                                                    |
               |             Operating System (e.g. DOS)            |
               |                                                    |
               +----------------------------------------------------+

Client Initialization
Client Termination
Stacks and Mode Switching
Handling Interrupts
Handling CPU Exceptions
Using Real-Mode Callbacks
Using Shared Memory
Writing Resident Service Providers