INT 31H 0d00H: Allocate Shared Memory
Compatibility: DPMI 1.0+
Expects: AX 0d00H
ES:DI (or ES:EDI) address of 28-byte info structure (see below)
──────────────────────────────────────────────────────────────────
Returns: CF NC (clear) if successful; else AX = DPMI Error Code
ES:DI (or ES:EDI) structure updated
──────────────────────────────────────────────────────────────────
Info: This allocates a named block of memory that may be shared by DPMI
clients. This may be used for interprocess communication.
DS:(E)DI this selector:offset must point to a 28-byte local structure
defined as follows:
Offset Size Contents
▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
+0 4 lReqSize desired size of block, in bytes
+4 4 lActualSize actual size allocated (returned)
+8 4 lHandle handle for the allocation (returned)
+0cH 4 lLinAddr linear addr of allocation (returned)
+10H 6 p48szName 48-bit address of ASCIIZ▲ name for
the shared block. First 4 bytes are
the offset; the last 2 are selector.
+16H 2 wRes1 reserved
+18H 4 lRes2 reserved; must be 0
28 size of this structure
On entry, you must fill in lReqSize and set p48szName to a 48-bit
address of an ASCIIZ string that names the block. The host
fills-in lAllocSize, lHandle, and lLinAddr.
For 16-bit clients, the high word of p48szName must be 0000H.
Note: ■ The second and subsequent client to use this fn with the same
ASCIIZ name, will be returned info about the initial
allocation. For such subsequent "allocations", the lReqSize
field is ignored. Be sure to check the lActualSize field on
return.
■ The first client to allocate a named block will find that the
first 16-bytes are 0. It can gain exclusive ownership via
INT 31H 0d02H, and store some non-zero values so that
subsequent clients can tell that it has been initialized.
■ 0-length allocations are explicitly supported and can be used
as a way to implement semaphores (see INT 31H 0d02H, for
instance).
■ All of your shared memory allocations and serializations are
freed by the host automatically when you terminate.
See Also: DPMI API
INT 2fH: Multiplex Interrupt
DOS Functions
-♦-