DosSubSet: Difference between revisions
Created page with "==Description== This call is used to initialize a segment or to reset a reallocated segment for suballocation. ==Syntax== <PRE> DosSubSet (SegSelector, Flags, Size) </PR..." |
mNo edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This call is used to initialize a segment or to reset a reallocated segment for suballocation. | This call is used to initialize a segment or to reset a reallocated segment for suballocation. | ||
==Syntax== | ==Syntax== | ||
DosSubSet (SegSelector, Flags, Size) | |||
DosSubSet | |||
==Parameters== | ==Parameters== | ||
; | ;SegSelector (SEL) - input : Target data segment selector. | ||
;Flags (USHORT) - input:0 = Increasing the size of a segment already initialized. | |||
; Flags (USHORT) - input : | :1 = Initializing a segment. | ||
;Size (USHORT) - input : Segment size in bytes. | |||
; Size (USHORT) - input : Segment size in bytes. | |||
==Return Code== | ==Return Code== | ||
;rc (USHORT) - return:Return code descriptions are: | |||
*0 NO_ERROR | |||
Return code descriptions are: | *310 ERROR_DOSSUB_SHRINK | ||
*313 ERROR_DOSSUB_BADSIZE | |||
* 0 | *314 ERROR_DOSSUB_BADFLAG | ||
* 310 | |||
* 313 | |||
* 314 | |||
==Remarks== | ==Remarks== | ||
Line 34: | Line 24: | ||
The size parameter should be a multiple of four bytes, or it is rounded up to a multiple of four. Note in DosSubSet, a size parameter of 0 indicates the segment is 64KB, while in DosSubAlloc and DosSubFree, a size parameter of 0 is an error. Other than this special case of 0 meaning 64KB, the minimum size that can be set is 12 bytes. | The size parameter should be a multiple of four bytes, or it is rounded up to a multiple of four. Note in DosSubSet, a size parameter of 0 indicates the segment is 64KB, while in DosSubAlloc and DosSubFree, a size parameter of 0 is an error. Other than this special case of 0 meaning 64KB, the minimum size that can be set is 12 bytes. | ||
== | ==Bindings== | ||
=== C | ===C=== | ||
<PRE> | <PRE> | ||
#define INCL_DOSMEMMGR | #define INCL_DOSMEMMGR | ||
Line 41: | Line 31: | ||
USHORT rc = DosSubSet(SegSelector, Flags, Size); | USHORT rc = DosSubSet(SegSelector, Flags, Size); | ||
SEL | SEL SegSelector; /* Segment selector */ | ||
USHORT | USHORT Flags; /* Parameter flags */ | ||
USHORT | USHORT Size; /* Size of a block */ | ||
USHORT | USHORT rc; /* return code */ | ||
</PRE> | </PRE> | ||
===MASM | ===MASM=== | ||
<PRE> | <PRE> | ||
EXTRN DosSubSet:FAR | EXTRN DosSubSet:FAR | ||
Line 61: | Line 51: | ||
</PRE> | </PRE> | ||
[[Category:Dos16]] | |||
[[Category: |
Latest revision as of 08:12, 26 January 2020
This call is used to initialize a segment or to reset a reallocated segment for suballocation.
Syntax
DosSubSet (SegSelector, Flags, Size)
Parameters
- SegSelector (SEL) - input
- Target data segment selector.
- Flags (USHORT) - input
- 0 = Increasing the size of a segment already initialized.
- 1 = Initializing a segment.
- Size (USHORT) - input
- Segment size in bytes.
Return Code
- rc (USHORT) - return
- Return code descriptions are:
- 0 NO_ERROR
- 310 ERROR_DOSSUB_SHRINK
- 313 ERROR_DOSSUB_BADSIZE
- 314 ERROR_DOSSUB_BADFLAG
Remarks
To initialize a segment for suballocation, issue DosSubSet before issuing DosSubAlloc and set Flags = 1. The segment must have been allocated with DosAllocSeg or DosAllocShrSeg.
If a segment allocated by a DosAllocSeg call has already been set for suballocation, and a call to DosSubAlloc returns Error_DOSSUB_NOMEM, the segment's size can be increased by a call to DosReallocSeg. After reallocation, the segment must be reset by a DosSubSet. Failure to reset the segment after changing its size can yield unpredictable results.
The size parameter should be a multiple of four bytes, or it is rounded up to a multiple of four. Note in DosSubSet, a size parameter of 0 indicates the segment is 64KB, while in DosSubAlloc and DosSubFree, a size parameter of 0 is an error. Other than this special case of 0 meaning 64KB, the minimum size that can be set is 12 bytes.
Bindings
C
#define INCL_DOSMEMMGR USHORT rc = DosSubSet(SegSelector, Flags, Size); SEL SegSelector; /* Segment selector */ USHORT Flags; /* Parameter flags */ USHORT Size; /* Size of a block */ USHORT rc; /* return code */
MASM
EXTRN DosSubSet:FAR INCL_DOSMEMMGR EQU 1 PUSH WORD SegSelector ;Segment selector PUSH WORD Flags ;Parameter flags PUSH WORD Size ;Size of a segment CALL DosSubSet Returns WORD