Path: utzoo!attcan!uunet!husc6!psuvax1!rutgers!columbia!garfield!aronoff From: aronoff@garfield (Avram Aronoff) Newsgroups: comp.sys.ibm.pc Subject: Re: help needed with memory organizatio Message-ID: <5710@columbia.edu> Date: 17 Jun 88 09:32:36 GMT References: <39500012@pyr1.cs.ucl.ac.uk> Sender: news@columbia.edu Reply-To: aronoff@garfield.UUCP (Avram Aronoff) Organization: Columbia University CS Department Lines: 25 In article <39500012@pyr1.cs.ucl.ac.uk> awylie@pyr1.cs.ucl.ac.uk writes: > Can anyone tell me the format of a DOS memory control block? > Also, how can I locate the first such block in memory? The following information comes from the Waite Group's book _MS-DOS Papers_. A memory block begins with a paragraph which begins with the following *packed* structure (no pad bytes!) union block_header { struct { char signature; short owner; short size; } info; char paragraph[16]; }; Signature is 'M' for all blocks except the last, for which it is 'Z'. Owner is (usually) the segment of the PSP of the process which allocated the block. PSPs are those blocks which own themselves. Size is in paragraphs. The first block is found using the undocumented 'list-of-lists' system call. Do 'mov ah,52h; int 21h'. This gives a pointer to the list of lists in es:bx. Then es:[bx-2] contains the segment of the first memory block. Hymie