Jump to content

DosReallocHuge: Difference between revisions

From EDM2
Created page with "==Description== This call changes the size of memory originally allocated by DosAllocHuge. ==Syntax== <PRE> DosReallocHuge (NumSeg, Size, Selector) </PRE> ==Parameter..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
This call changes the size of memory originally allocated by [[DosAllocHuge]].
This call changes the size of memory originally allocated by DosAllocHuge.  


==Syntax==
==Syntax==
<PRE>
  DosReallocHuge (NumSeg, Size, Selector)
  DosReallocHuge
 
    (NumSeg, Size, Selector)
</PRE>


==Parameters==
==Parameters==
; NumSeg (USHORT) - input : Number of 65536 byte segments requested.  
;NumSeg (USHORT) - input : Number of 65536 byte segments requested.
 
;Size (USHORT) - input : Number of bytes requested in the last non-65536 byte segment. A value of 0 indicates none.
; Size (USHORT) - input : Number of bytes requested in the last non-65536 byte segment. A value of 0 indicates none.  
;Selector (SEL) - input : Selector returned on a previous DosAllocHuge.
 
; Selector (SEL) - input : Selector returned on a previous DosAllocHuge.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
* 8 ERROR_NOT_ENOUGH_MEMORY
 
*87 ERROR_INVALID_PARAMETER
* 0         NO_ERRORç
* 8         ERROR_NOT_ENOUGH_MEMORY
* 87       ERROR_INVALID_PARAMETER


==Remarks==
==Remarks==
Line 30: Line 20:
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.


DosReallocHuge 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 DosReallocHuge automatically locks the segment for access by the caller, the same as if a DosLockSeg had been issued.
DosReallocHuge 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 DosReallocHuge 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. However, only a privilege level 3 huge segment is valid.
;Note:This request may be issued from privilege level 2 or 3. However, only a privilege level 3 huge segment is valid.


===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 DosReallocHuge when coding for the DOS mode:
Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restriction applies to DosReallocHuge when coding for the DOS mode:
*The requested Size value is rounded up to the next paragraph (16-byte).


The requested Size value is rounded up to the next paragraph (16-byte).
==Bindings==
 
===C===
==Example Code==
=== C Binding===
<PRE>
<PRE>
#define INCL_DOSMEMMGR
#define INCL_DOSMEMMGR
Line 46: Line 35:
USHORT  rc = DosReallocHuge(NumSeg, Size, Selector);
USHORT  rc = DosReallocHuge(NumSeg, Size, Selector);


USHORT           NumSeg;        /* Number of 65536-byte segments
USHORT NumSeg;        /* Number of 65536-byte segments requested */
                                    requested */
USHORT Size;          /* Number of bytes in last segment */
USHORT           Size;          /* Number of bytes in last segment */
SEL     Selector;      /* Selector */
SEL             Selector;      /* Selector */


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosReallocHuge:FAR
EXTRN  DosReallocHuge:FAR
INCL_DOSMEMMGR      EQU 1
INCL_DOSMEMMGR      EQU 1


PUSH  WORD    NumSeg       ;Number of 65536-byte segments requested
PUSH  WORD    NumSeg     ;Number of 65536-byte segments requested
PUSH  WORD    Size         ;Number of bytes in last segment
PUSH  WORD    Size       ;Number of bytes in last segment
PUSH  WORD    Selector     ;Selector
PUSH  WORD    Selector   ;Selector
CALL  DosReallocHuge
CALL  DosReallocHuge


Line 67: Line 55:
</PRE>
</PRE>


==Related Functions==
[[Category:Dos16]]
*
 
[[Category:The OS/2 API Project]]

Latest revision as of 01:49, 26 January 2020

This call changes the size of memory originally allocated by DosAllocHuge.

Syntax

DosReallocHuge (NumSeg, Size, Selector)

Parameters

NumSeg (USHORT) - input
Number of 65536 byte segments requested.
Size (USHORT) - input
Number of bytes requested in the last non-65536 byte segment. A value of 0 indicates none.
Selector (SEL) - input
Selector returned on a previous DosAllocHuge.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 8 ERROR_NOT_ENOUGH_MEMORY
  • 87 ERROR_INVALID_PARAMETER

Remarks

DosReallocHuge is called to change the size of unshared or shared huge memory allocated by DosAllocHuge. The selector used for this call must be the one returned by the DosAllocHuge 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.

DosReallocHuge 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 DosReallocHuge 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. However, only a privilege level 3 huge segment is valid.

Family API Considerations

Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restriction applies to DosReallocHuge 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 = DosReallocHuge(NumSeg, Size, Selector);

USHORT  NumSeg;        /* Number of 65536-byte segments requested */
USHORT  Size;          /* Number of bytes in last segment */
SEL     Selector;      /* Selector */

USHORT  rc;            /* return code */

MASM

EXTRN  DosReallocHuge:FAR
INCL_DOSMEMMGR      EQU 1

PUSH   WORD    NumSeg     ;Number of 65536-byte segments requested
PUSH   WORD    Size       ;Number of bytes in last segment
PUSH   WORD    Selector   ;Selector
CALL   DosReallocHuge

Returns WORD