home *** CD-ROM | disk | FTP | other *** search
- Figure 4. Sample Relationship Between Program and Environment Memory Control Blocks
-
- Segment
- Address
-
- +----------------+
- | offset |
- | 0 | 2 4 6 8 A C D
- | 163F +----+--|+----+---+----+---+--------+--------+--------+--------+--------+
- | | Tag| Owner | Size | | <- Memory Control
- | | 4D | 164A | 0004 | | Block
- | 1640 +====+========+========+================================================+
- |+------>| e n v i r o n m e n t v a r i a b l e o n e | 00 | e n v i r | \
- ||1641 +--------+--------+--------+--------+---+----+--------+----+---+--------+ |
- || | o n m e n t v a r i a b l e t w o| 00 | e n v i r o n m e | | Environment
- || +--------+--------+--------+--------+---+----+--------+--------+--------+ | Memory
- || | n t v a r i a b l e t h r e e|00 | 00 | 0001 | d r i v e : \ | | Block
- || +--------+--------+--------+--------+--------+--------+--------+--------+ |
- || | p a t h \ p r o g r a m . e x t |00 | | /
- || +--------+--------+--------+--------+--------+--------+--------+--------+
- ||
- |+----------------------------------------------------------------------------------------------------+
- | |
- |+---------------+ |
- || 0 | 2 4 6 8 A C D |
- ||1649 +----+--|+----+---+----+---+--------+--------+--------+--------+--------+ |
- || | Tag| Owner | Size | | DOS 4.0: Program Name | <- Memory Control |
- || | 4D | 164A | 0100 | | | Block |
- ||164A +=============+========+============+===================================+ |
- |+------>| 20CD | | \ |
- +------->|or 27CD | other program segment prefix fields | | |
- 164B +--------+--------+--------+--------+--------+--------+--------+--------+ | |
- | | | Program |
- +--------+--------+--------+--------+--------+--------+--------+--------+ | Memory |
- | |Environ-| | | Block |
- . | | ment | | | |
- . | | 1640 -------------------------------+
- . +--------+--------+--------+--------+--------+--------+--------+--------+ |
- | | |
- +--------+--------+--------+--------+--------+--------+--------+--------+ .
- | . | .
- . .
- . /
-
-
- Notes: 1. Numeric values are all in hexadecimal.
-
- 2. All addresses and pointers are paragraph (segment) references.
- E.g., the address of the 163F paragraph is 163F:0.
-
- 3. Size values are in paragraphs (16-bytes).
-
- 4. Hex word values are stored in memory with bytes swapped,
- but are not shown that way above.
-
- 5. When the MCB owner is 0000, the block following is
- unallocated.
-
- 6. An MCB represents a 'Program' when the next paragraph starts
- with 20CD or 27CD. If the Owner is not the paragraph
- following the MCB, the Owner must be the DOS kernel.
- When the Owner immediately follows the MCB, its name (without
- the path) can be found in the MCB, but only in DOS 4.0. In
- DOS 3.X, the name can be found by looking at the environment
- pointer and scanning past the environment variables (see 8
- below).
-
- 7. An MCB represents an 'Environment' when the Owner's
- Environment pointer points to the paragraph following
- the MCB. In the example above, the MCB at 163F points
- to its owner at 164A. The Environment pointer, which is
- at an offset 2C in the owner block, points to the block
- at 1640, which is the paragraph following the MCB at 163F.
-
- 8. The environment variables are in ASCIIZ form following the
- environment MCB, that is, each text variable is terminated
- with hex 00. The last variable is followed by a second 00.
- In DOS 3.0 and later, the next word is 0001 and it is
- followed by the fully qualified program name.
-
- 9. Any block can be displayed using DEBUG. To display the
- environment MCB and memory block above, enter:
-
- >debug
- -d 163f:0 4f
- -q