Nearly all Int 31H function calls can fail, either because of client errors, unavailable resources, or internal host problems. Most failures due to client errors and all failures due to unavailable resources are reported to the client via error codes. Some client errors, such as passing an invalid pointer in a function call, may cause the host to fault; the client can detect these events by installing an exception handler.
Internal host errors are handled in a host-specific manner and generally not reported to clients with an error code. The only exception to this is the case when a host cannot allocate internal resources. Any Int 31H function is capable of returning error code 8010H to indicate this condition.
A DPMI 1.0 host signals an error by returning from a function with the Carry flag set and an error code in AX. If the error code has bit 15 clear (0), the DPMI host is passing a DOS error code through to the client; for a list of these error codes, consult a DOS technical reference. If the error code has bit 15 set (1), it is generated within the DPMI host, and is interpreted according to the list below. All DPMI 1.0 hosts are required to check for the error conditions listed in this specification, and must return the error codes that are documented for each function.
If Int 31H is invoked with an function number that is not defined in this specification, the DPMI host will return the "Unsupported Function" error code 8001H. The table lists all defined error codes and their messages. Unused error codes are reserved for the later versions of the DPMI spcifications.
|Memory configuration blocks damaged
|The operating system has detected corruption in the real-mode memory arena.
|There is not enough real-mode memory to satisfy the request.
|Incorrect memory segment specified
|The segment value specified was not one provided by the operating system
|Returned in response to any function call which is not implemented by this host, because the requested function is either undefined or optional.
|Some object is in the wrong state for the requested operation.
|The requested operation would endanger system integrity, e.g., a request to map linear addresses onto system code or data.
|Host detected a deadlock situation.
|A pending serialization request was cancelled.
|The DPMI host cannot allocate internal resources to complete an operation.
|Host is unable to allocate a descriptor.
|Linear memory unavailable
|Host is unable to allocate the required linear memory.
|Physical memory unavailable
|Host is unable to allocate the required physical memory.
|Backing store unavailable
|Host is unable to allocate the required backing store.
|Host is unable to allocate the required callback address.
|Host is unable to allocate the required handle.
|Lock count exceeded
|A locking operation exceeds the maximum count maintained by the host.
|Resource owned exclusively
|A request for serialization of a shared memory block could not be satisfied because it is already serialized exclusively by another client.
|Resource owned shared
|A request for exclusive serialization of a shared memory block could not be satisfied because it is already serialized shared by another client.
|A numeric or flag parameter has an invalid value.
|A selector does not correspond to a valid descriptor.
|A handle parameter is invalid.
|A callback parameter is invalid.
|Invalid linear address
|A linear address range (either supplied as a parameter or implied by the call) is invalid.
|The request is not supported by the underlying hardware.