home *** CD-ROM | disk | FTP | other *** search
- /***
- * size.c - Return size of VM block
- *
- * Copyright (c) 1990-1992, Microsoft Corporation. All rights reserved.
- *
- *Purpose:
- * Return size of VM block
- *
- *******************************************************************************/
-
- #include <vmm.h>
- #include <vmbm.h>
-
- /***
- * cbSizeHbk - Return the size of a VM block
- *
- *Purpose:
- * Returns the size in bytes of the supplied VM block.
- *
- *Entry:
- * hbk = handle of block
- *
- *Exit:
- * Size of block in bytes
- *
- *Exceptions:
- *
- *******************************************************************************/
-
- unsigned long VMFUNC __cbSizeHbk( HBK hbk )
- {
- PHDB phdb;
-
- if (!_fVmInit || (unsigned long)hbk < (unsigned long)_hbkMin || (unsigned long)hbk >= (unsigned long)_hbkMax)
- return 0L;
-
- /* load the page with the hbk*/
- phdb = __PVmLoadVp((VPVOID) hbk, FALSE);
-
- if (!phdb || phdb->fFree)
- return 0L;
-
- if(phdb->fByPage)
- return ((((unsigned long)phdb->cPage) * cbVmPage) - (unsigned long)sizeof(HDB));
- else
- return (((unsigned long)CbGetSize(phdb->cbSize)) - (unsigned long)sizeof(HDB));
- }
-