Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Dos Protected Mode Interface - <b>resize dos memory block</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
        Resize DOS Memory Block


                 This function  is used to grow or shrink a memory block
                 that was  allocated through  the  Allocate  DOS  Memory
                 Block function.

            To Call

                 AX = 0102h
                 BX = New block size in paragraphs
                 DX = Selector of block to modify

            Returns

                 If function was successful:
                 Carry flag is clear.

                 If function was not successful:
                 Carry flag is set.
                 AX = DOS error code:
                      07h  memory control blocks damaged
                      08h  insufficient memory  available to allocate as
                      requested
                      09h  incorrect memory segment specified
                 BX = Maximum block size possible in paragraphs

            Programmer's Notes

                 o    Growing a  memory block  is often  likely to  fail
                      since other  DOS block  allocations  will  prevent
                      increasing the  size of  the block.   Also, if the
                      size of a block grows past a 64K boundary then the
                      allocation will fail if the next descriptor in the
                      LDT is  not free.   Therefore,  this  function  is
                      usually only used to shrink a block.
                 o    Shrinking a  block may cause some descriptors that
                      were previously  allocated  to  the  block  to  be
                      freed.  For example shrinking a block from 140K to
                      120K would cause the third allocated descriptor to
                      be freed since it is no longer valid.  The initial
                      selector  will   remain  unchanged,  however,  the
                      limits  of  the  remaining  two  descriptors  will
                      change:  the first to 120K and the second to 56k.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson