DosReallocSeg: Difference between revisions
m Ak120 moved page OS2 API:CPI:LEGACY:DosReallocSeg to DosReallocSeg |
mNo edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This call reallocates a segment after discard or changes the size of a segment already allocated. | This call reallocates a segment after discard or changes the size of a segment already allocated. | ||
==Syntax== | ==Syntax== | ||
DosReallocSeg (Size, Selector) | |||
DosReallocSeg | |||
==Parameters== | ==Parameters== | ||
; | ;Size (USHORT) - input: New requested segment size (in bytes). A value of 0 indicates 65536 bytes. | ||
;Selector (SEL) - input: Segment to be resized. | |||
; Selector (SEL) - input : Segment to be resized. | |||
==Return Code== | ==Return Code== | ||
;rc (USHORT) - return:Return code descriptions are: | |||
*0 NO_ERROR | |||
Return code descriptions are: | *5 ERROR_ACCESS_DENIED | ||
*8 ERROR_NOT_ENOUGH_MEMORY | |||
* 0 | |||
* 5 | |||
* 8 | |||
==Remarks== | ==Remarks== | ||
DosReallocSeg is called to change the size of an unshared or shared segment allocated with a DosAllocSeg request. | DosReallocSeg is called to change the size of an unshared or shared segment allocated with a [[DosAllocSeg]] request. | ||
Normally, segments allocated as shared (AllocFlags bits 0 and 1 were set) cannot be decreased in size. However, if AllocFlags bit 3 was also set, the shared segment's size can be decreased. | Normally, segments allocated as shared (AllocFlags bits 0 and 1 were set) cannot be decreased in size. However, if AllocFlags bit 3 was also set, the shared segment's size can be decreased. | ||
Line 35: | Line 23: | ||
Note: This request may be issued from privilege level 2 or 3, and the segment being resized can be either a privilege level 2 or privilege level 3 segment. | Note: This request may be issued from privilege level 2 or 3, and the segment being resized can be either a privilege level 2 or privilege level 3 segment. | ||
To change the size of huge memory allocated by DosAllocHuge, see DosReallocHuge. | To change the size of huge memory allocated by DosAllocHuge, see [[DosReallocHuge]]. | ||
===Family API Considerations=== | ===Family API Considerations=== | ||
Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restriction applies to DosReallocSeg when coding for the DOS mode. The requested Size value is rounded up to the next paragraph (16-byte). | |||
==Bindings== | |||
== | ===C=== | ||
=== C | |||
<PRE> | <PRE> | ||
#define INCL_DOSMEMMGR | #define INCL_DOSMEMMGR | ||
Line 48: | Line 35: | ||
USHORT rc = DosReallocSeg(Size, Selector); | USHORT rc = DosReallocSeg(Size, Selector); | ||
USHORT | USHORT Size; /* New size requested in bytes */ | ||
SEL | SEL Selector; /* Selector */ | ||
USHORT | USHORT rc; /* return code */ | ||
</PRE> | </PRE> | ||
===MASM | |||
===MASM=== | |||
<PRE> | <PRE> | ||
EXTRN DosReallocSeg:FAR | EXTRN DosReallocSeg:FAR | ||
Line 64: | Line 52: | ||
Returns WORD | Returns WORD | ||
</PRE> | </PRE> | ||
[[Category: | [[Category:Dos16]] |
Latest revision as of 06:33, 26 January 2020
This call reallocates a segment after discard or changes the size of a segment already allocated.
Syntax
DosReallocSeg (Size, Selector)
Parameters
- Size (USHORT) - input
- New requested segment size (in bytes). A value of 0 indicates 65536 bytes.
- Selector (SEL) - input
- Segment to be resized.
Return Code
- rc (USHORT) - return
- Return code descriptions are:
- 0 NO_ERROR
- 5 ERROR_ACCESS_DENIED
- 8 ERROR_NOT_ENOUGH_MEMORY
Remarks
DosReallocSeg is called to change the size of an unshared or shared segment allocated with a DosAllocSeg request.
Normally, segments allocated as shared (AllocFlags bits 0 and 1 were set) cannot be decreased in size. However, if AllocFlags bit 3 was also set, the shared segment's size can be decreased.
DosReallocSeg is also called to reallocate a segment allocated as discardable (AllocFlags bit 2 set) after the segment is discarded by the system. The call to DosReallocSeg automatically locks the segment for access by the caller, the same as if a DosLockSeg had been issued.
Note: This request may be issued from privilege level 2 or 3, and the segment being resized can be either a privilege level 2 or privilege level 3 segment.
To change the size of huge memory allocated by DosAllocHuge, see DosReallocHuge.
Family API Considerations
Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restriction applies to DosReallocSeg when coding for the DOS mode. The requested Size value is rounded up to the next paragraph (16-byte).
Bindings
C
#define INCL_DOSMEMMGR USHORT rc = DosReallocSeg(Size, Selector); USHORT Size; /* New size requested in bytes */ SEL Selector; /* Selector */ USHORT rc; /* return code */
MASM
EXTRN DosReallocSeg:FAR INCL_DOSMEMMGR EQU 1 PUSH WORD Size ;New size requested in bytes PUSH WORD Selector ;Selector CALL DosReallocSeg Returns WORD