Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!usc!wuarchive!uunet!cpqhou!pipkinsj From: pipkinsj@cpqhou.uucp (Jeff Pipkins @Adv Dev@SE hou ) Newsgroups: comp.os.msdos.programmer Subject: Re: Answer to how to make TSR name show on MAPMEM display. Message-ID: <1991Jan02.160147.2030@cpqhou.uucp> Date: 2 Jan 91 16:01:47 GMT References: <5001@trantor.harris-atd.com> Reply-To: pipkinsj@cpqhou.UUCP (Jeff Pipkins @Adv Dev@SE hou ) Organization: Compaq Computer Corporation Lines: 44 In article <5001@trantor.harris-atd.com> sonny@trantor.harris-atd.com (Bob Davis) writes: >I seem to have stumbled upon the answer to my own question of a while >back in this newsgroup: > > Q: How do you make your TSR's name show under the "owner" > column in Kim Kokkonen's TSR Mark/Release package "mapmem" > display? > > A: Don't deallocate the TSR's environment when you install the > TSR. > >The mapmem command must look at the environment to determine the >command name to place under the "owner" column. Might be nice to >figure out a way to deallocate the DOS environment and then re-install >a tiny "pseudo-environment" containing nothing but the command name so >mapmem could see it. Any idea how I might do that? MS-DOS 4.x has a "mem" command that lists programs and TSRs in a similar way. TSRs that come with DOS 4.x put an 8-byte name in the last 8 bytes of the memory control block that their PSP is in. In other words, the 8 bytes immediately preceeding the PSP. These bytes are unused in previous versions of DOS, so it's probably a good idea to do this if you're a TSR. In fact, this would also provide a good way for a TSR to check to see if a copy of it is already resident. Traverse the MCB chain looking for a resident program with the same name. You can find the start of the chain by using a well-known undocumented function (Int 21h, AH=52h; on return subtract 2 from BX, and ES:BX will point to the first MCB). The first byte of the MCB is 'Z' if it is at the end of the chain. The word in bytes 3 & 4 give the block size in paragraphs. Each MCB is located on a paragraph boundary, so if you have the segment address of an MCB, you can find the next one by adding the block size plus 1. That should be everything you need to know to find your TSR. If your TSR has an uninstall feature, be sure to erase your name from the MCB when you uninstall! -- Jeff D. Pipkins (uunet!cpqhou!pipkinsj) My disclaimer: My opinions do not necessarily reflect those of my employer. Papaw's disclaimer: I've already told you more than I know.