Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Getting the TSR list

marinsoftmarinsoft Posts: 10Member
How can I get the list of TSR programs and drivers in memory like the "mem /c" command?

Comments

  • blipblip Posts: 756Member
    If you mean programming, then I think these approaches would do. The first is that you could traverse the MCB list and look at where the PSPs are supposed to be for the program's name. The problem with this is that programs as well as data could be allocated. The second would be to access the segment of each interrupt handler and access the word at offset 2Ch. This is the segment of the environment, i.e. you use this as the segment and begin reading at offset 0. What you'll find is the NULL terminated environment variables in the form [blue]VAR=Value1 Value2...[/blue]. When you reach a double NULL (two zero bytes), skip those and then an additional two bytes to reach the program's fully qualified, NULL terminated name. Here's a dump from DEBUG as an illustration:

    [code]
    C:WINDOWSDesktop>debug
    -d2cl2
    176F:0020 D2 10 ..
    -d10d2:0
    10D2:0000 54 4D 50 3D 43 3A 5C 57-49 4E 44 4F 57 53 5C 54 TMP=C:WINDOWST
    10D2:0010 45 4D 50 00 54 45 4D 50-3D 43 3A 5C 57 49 4E 44 EMP.TEMP=C:WIND
    10D2:0020 4F 57 53 5C 54 45 4D 50-00 50 52 4F 4D 50 54 3D OWSTEMP.PROMPT=
    10D2:0030 24 70 24 67 00 77 69 6E-62 6F 6F 74 64 69 72 3D $p$g.winbootdir=
    10D2:0040 43 3A 5C 57 49 4E 44 4F-57 53 00 50 41 54 48 3D C:WINDOWS.PATH=
    10D2:0050 43 3A 5C 57 49 4E 44 4F-57 53 3B 43 3A 5C 57 49 C:WINDOWS;C:WI
    10D2:0060 4E 44 4F 57 53 5C 43 4F-4D 4D 41 4E 44 00 43 4F NDOWSCOMMAND.CO
    10D2:0070 4D 53 50 45 43 3D 43 3A-5C 57 49 4E 44 4F 57 53 MSPEC=C:WINDOWS
    -d
    10D2:0080 5C 43 4F 4D 4D 41 4E 44-2E 43 4F 4D 00 43 54 53 COMMAND.COM.CTS
    10D2:0090 59 4E 3D 43 3A 5C 57 49-4E 44 4F 57 53 00 77 69 YN=C:WINDOWS.wi
    10D2:00A0 6E 64 69 72 3D 43 3A 5C-57 49 4E 44 4F 57 53 00 ndir=C:WINDOWS.
    10D2:00B0 42 4C 41 53 54 45 52 3D-41 32 32 30 20 49 31 30 BLASTER=A220 I10
    10D2:00C0 20 44 33 20 48 37 20 50-33 33 30 20 54 36 00 43 D3 H7 P330 T6.C
    10D2:00D0 4D 44 4C 49 4E 45 3D 64-65 62 75 67 00 00 01 00 MDLINE=debug....
    10D2:00E0 43 3A 5C 57 49 4E 44 4F-57 53 5C 43 4F 4D 4D 41 C:WINDOWSCOMMA
    10D2:00F0 4E 44 5C 44 45 42 55 47-2E 45 58 45 00 74 65 72 NDDEBUG.EXE.ter
    -d
    10D2:0100 5A E3 10 1D 8F 01 00 43-44 45 42 55 47 00 4F 57 Z......CDEBUG.OW
    10D2:0110 CD 20 00 A0 00 9A F0 FE-1D F0 C7 1E C5 FD 6D 01 . ............m.
    10D2:0120 12 0F 78 01 12 0F 12 0F-01 01 01 00 02 FF FF FF ..x.............
    10D2:0130 FF FF FF FF FF FF FF FF-FF FF FF FF D2 10 2E 3E ...............>
    10D2:0140 F4 10 14 00 18 00 E3 10-FF FF FF FF 00 00 00 00 ................
    10D2:0150 07 0A 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
    10D2:0160 CD 21 CB 00 00 00 00 00-00 00 00 00 00 20 20 20 .!...........
    10D2:0170 20 20 20 20 20 20 20 20-00 00 00 00 00 20 20 20 .....
    -
    [/code]

    Maybe there's an undocumented DOS call that would help you find the PSPs reliably, but I don't currently recall any.
  • marinsoftmarinsoft Posts: 10Member
    Thank you very much blip. I like 80x86 Assembly. I apreciate your help.
Sign In or Register to comment.