>I've set up a TSR (PASCAL) which uses an ISR to trap int 21h.
>I then find out which sub-function is being accesses.
>If it is to do with the movement through directories I check to see if someone
>is trying to move into a directory they shouldn't. This is where the problem
>The name of the directory is held in DS:DX. But how do I read this into a
>string. I guess I use the MEM command, but how?
>I need help!
>Someone please help.
A few words of warning first:
If you are using a TSR - then you really shouldn't be doing any
printing to the screen using any of TurboPascal's native routines;
you should instead use "safe" BIOS-level functions. (at least
be CERTAIN to not use any DOS functions!)
Having said that; what you probably want is something like the following
someString : ^String;
realString : String;
i : Integer;
seg(someString) := DS;
ofs(someString) := BX;
(* now note that the 'STRING' probably doesn't conform to Pascal's
format of [length/data]
i := 0;
while (someString^[i] <> #0) do
realString[i] := someString^[i]; (* manually stuff into string *)
realString := chr(i); (* store the string length *)
Or something like that... The important thing to remember is that when
you're talking about looking at a chunk of memory with Pascal; you're
going to have to use a pointer - and you're going to have to change the
segment/offset of that pointer yourself to match the section of memory
you want to look at..
Oh! Another method you could use would be:
RealString : String;
WorkBX : Word; (* increment BX *)
WorkBX := BX;
RealString := '';
while (mem[DS:WorkBX]<>0) do
RealString := RealString + chr(mem[DS:WorkBX]);
(In which case you're using the function 'mem' to traverse the string
in memory and stuff it into your local storage...)
Hope this helps... (My knowlege of TP is a little old - there might be
more modern ways of doing this!)
Bill Mitchell | Email for PGP-key