Hello! I need to write a resident program in the language Assembler, which would look in the memory of other resident programs and display their name. I found that I can scan the chain of MCB records using function 52h, but I don’t understand how to find resident programs there.

  • In the general case, the problem is unsolvable. Residents who are not placed through the DOS function will not be detected. Yes, and placed through the DOS - if the program has released the environment block, then there will be no place to take the name. And - are you sure you need to write a resident program? - Akina
  • @Akina, and if the idea is to write a resident program that intercepts int 27h , 31h/21h ? - PinkTux
  • @PinkTux Something is extremely doubtful to me that the meaning of the task is exactly that ... no, theoretically I can imagine a resident monitor that pops up on the hotkey and shows a list of current residents - but the essence of the program, the essence of the reservations will not change. - Akina
  • The program must be resident. This is what my task sounds like: TSR-program should print out those TSR-programs that do not release Environment memory. But for now, I need to write at least a part with the search for resident programs. The only thing I have found so far is an MCB scan, but I don’t know how to intercept int 27h at all. . - honeyshi

1 answer 1

DOS (a and MCB and "resident programs") suggest it - single-task OS. That is, all programs except yours, which own the memory blocks, will be resident. And going along the chain of memory control block, you are looking for blocks that do not belong to the OS (the word with offset 1 in the chain, "owner" is not equal to 0). The "owner" specified there is the PID of the process. Write unique PIDs in a string or array - this will be the list of "resident" (currently running) programs. Do not write into it the PID of your program, if you know how to get it.

Here is an example on assembler, I can't check, I don't have DOS.