Note that DPMI 0.9 hosts are not required to return a valid error code in AX. You may only rely on the carry flag being set if an error occurred.
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.
|0007H||Memory configuration blocks damaged||The operating system has detected corruption in the real-mode memory arena.|
|0008H||Insufficient memory||There is not enough real-mode memory to satisfy the request.|
|0009H||Incorrect memory segment specified||The segment value specified was not one provided by the operating system|
|8001H||Unsupported function||Returned in response to any function call which is not implemented by this host, because the requested function is either undefined or optional.|
|8002H||Invalid state||Some object is in the wrong state for the requested operation.|
|8003H||System integrity||The requested operation would endanger system integrity, e.g., a request to map linear addresses onto system code or data.|
|8004H||Deadlock||Host detected a deadlock situation.|
|8005H||Request cancelled||A pending serialization request was cancelled.|
|8010H||Resource Unavailable||The DPMI host cannot allocate internal resources to complete an operation.|
|8011H||Descriptor unavailable||Host is unable to allocate a descriptor.|
|8012H||Linear memory unavailable||Host is unable to allocate the required linear memory.|
|8013H||Physical memory unavailable||Host is unable to allocate the required physical memory.|
|8014H||Backing store unavailable||Host is unable to allocate the required backing store.|
|8015H||Callback unavailable||Host is unable to allocate the required callback address.|
|8016H||Handle unavailable||Host is unable to allocate the required handle.|
|8017H||Lock count exceeded||A locking operation exceeds the maximum count maintained by the host.|
|8018H||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.|
|8019H||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.|
|8021H||Invalid value||A numeric or flag parameter has an invalid value.|
|8022H||Invalid selector||A selector does not correspond to a valid descriptor.|
|8023H||Invalid handle||A handle parameter is invalid.|
|8024H||Invalid callback||A callback parameter is invalid.|
|8025H||Invalid linear address||A linear address range (either supplied as a parameter or implied by the call) is invalid.|
|8026H||Invalid request||The request is not supported by the underlying hardware.|