home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------ */
- /* KEEP.C */
- /* Determining the Size of a Program at Runtime */
- /* (c) 1991 Borland International */
- /* All rights reserved. */
- /* ------------------------------------------------------ */
- /* veröffentlicht in DOS toolbox 3'92 */
- /* ------------------------------------------------------ */
-
- #include <dos.h> // for MK_FP, _psp and keep()
-
- // Only 5 pertinent bytes are detailed
- typedef struct {
- unsigned char mcb_type;
- // 5Ah if last block in chain, else 4Dh
- unsigned owner; // 0000 if free, 0008 if DOS
- unsigned size; // size of MCB in paragraphs
- } MCB;
-
- /* ------------------------------------------------------ */
-
- int main (void)
- {
- MCB far *program_psp;
-
- // Install TSR
- // Make a pointer to the controlling MCB and extract
- // the size of the block from it.
-
- // Make pointer to MCB header
- // then terminate & stay resident
- program_psp = (MCB far*) MK_FP(_psp-1, 0);
- keep (0, program_psp->size);
-
- return 0;
- }
- /* ------------------------------------------------------ */
- /* Ende von KEEP.C */
-
-