dos12.hlp (Table of Contents; Topic list)
DosSubSet (1.2)
Function Group  Overview  Changes               Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSMEMMGR
 
USHORT DosSubSet(sel, fFlags, cbSeg)
SEL sel;          /* segment selector                    */
USHORT fFlags;    /* initialize/increase size of segment */
USHORT cbSeg;     /* new size of block                   */
 
The DosSubSet function initializes a segment for suballocation or changes
the size of a previously initialized segment.
 
The DosSubSet function is a family API function.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
sel        Specifies the selector of the data segment.
 
fFlags     Specifies whether to initialize the segment or increase its size.
           If this parameter is 0x0001, the function initializes the
           segment. If this parameter is 0x0000, the function changes the
           segment size.
 
cbSeg      Specifies the new size (in bytes) of the segment. This size
           should be a multiple of 4. If it is not, it will be rounded up. A
           value of zero may be used to specify 64K. The minimum size that
           can be set is 12.
 
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_BADFLAG
     ERROR_DOSSUB_BADSIZE
     ERROR_DOSSUB_SHRINK
 
Comments
 
If the fFlags parameter is 0x0001, the DosSubSet function initializes the
segment so that the DosSubAlloc function can be used to allocate memory
blocks in the segment. The segment must have been allocated previously by
using the DosAllocSeg or DosAllocShrSeg function.
 
If the fFlags parameter is 0x0000, the DosSubSet function changes the
segment size to the number of bytes specified by the cbSeg parameter. If the
specified size is greater than the current segment size, the DosReallocSeg
function must be called before DosSubSet. If DosSubSet is not called after
changing the size of a segment by using DosReallocSeg, the results can be
unpredictable.
 
In the DosSubSet function, setting the cbSeg parameter to zero indicates
that the segment size is 64K, but in the DosSubAlloc and DosSubFree
functions, an error occurs when the cbSeg parameter is set to zero.
 
DosSubSet 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, DosReallocSeg, DosSubAlloc, DosSubFree