Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DosSubAlloc (1.2)
◄Function Group► ◄Overview► ◄Changes► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_DOSMEMMGR
USHORT DosSubAlloc(sel, pusOffset, cbBlock)
SEL sel; /* segment selector */
PUSHORT pusOffset; /* pointer to variable for offset */
USHORT cbBlock; /* requested size of memory block */
The DosSubAlloc function allocates memory in a segment that was allocated
previously by using the DosAllocSeg or DosAllocShrSeg function and that was
initialized by using the DosSubSet function.
The DosSubAlloc function is a family API function.
Parameter Description
────────────────────────────────────────────────────────────────────────────
sel Specifies the selector of the data segment in which the memory
should be allocated.
pusOffset Points to the variable that receives the offset to the allocated
block.
cbBlock Specifies the size (in bytes) of the requested memory block. This
value should be a multiple of 4. If it is not, it will be rounded
up. No check is made to determine whether this rounding will
cause the allocation request to exceed the size of the segment.
The cbBlock parameter must not be greater than the maximum size
of the segment minus 8 bytes.
Return Value
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
ERROR_DOSSUB_BADSIZE
ERROR_DOSSUB_NOMEM
Comments
DosSubAlloc can be issued from ring 2 or ring 3; the suballocation segment
can be either a ring-2 or a ring-3 segment.
See Also
DosAllocSeg, DosAllocShrSeg, DosSubFree, DosSubSet
♦