home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name mmsetblk -- Grow or shrink an allocated memory block
- * (Formerly called PCSETBLK.)
- *
- * Synopsis ercode = mmsetblk(seg,size,pnewsize);
- *
- * int ercode Returned DOS function error code
- * unsigned seg Segment address of memory block
- * unsigned size Requested size of the memory block
- * unsigned *pnewsize Returned size of adjusted memory block.
- * This may be less than requested size.
- *
- * Description MMSETBLK adjusts the size of the memory block whose
- * segment address is specified in seg. The block must
- * have been previously allocated either by DOS or by the
- * MMALLOC function. The size (in paragraphs) of the block
- * is adjusted to the value specified in size. If a "grow"
- * request is made which cannot be satisfied, the block is
- * grown as large as possible and the resulting size is
- * returned.
- *
- * Returns ercode DOS function error code
- * *pnewsize Adjusted size of the block, or (if
- * requested size was too large) the
- * largest possible size
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
- *
- **/
-
- #include <bmemory.h>
- #include <butility.h>
-
- int mmsetblk(seg,size,pnewsize)
- unsigned seg,size,*pnewsize;
- {
- DOSREG dos_reg;
- int ercode;
-
- dos_reg.ax = 0x4a00; /* DOS function 0x4a */
- dos_reg.bx = size;
- dos_reg.es = seg;
- ercode = dos(&dos_reg);
- if (ercode == 8)
- *pnewsize = dos_reg.bx;
- else if (ercode == 0)
- *pnewsize = size;
- else
- *pnewsize = 0;
-
- return(ercode);
- }