http://qs1969.pair.com?node_id=55228


in reply to How do I find out the RAM memory address of a var in a program running on WIN ?

Your question is quite a bit unclear to me. I'll try several interpretations and answers :

  1. I want to pass the address of a variable to another program. How ?
    This question is answered by the Zen of interpreted languages : Even if you had the address, what would you do with it ? You don't know in what binary format variables are stored and cross-process memory access does not work, not even under Windows 9x (at least, reliably).
  2. I want to change a variable from another program. How ?
    Interprocess communication is best done by reading perlman:perlipc. I suggest Win32::Semaphore if working under Win32, but you might also find success in using read/write pipes.
  3. I want to patch another program currently running in memory. How ?
    While this is thinkable in Perl, it's quite a non-trivial task. To patch other running programs under Windows, you must attach the current process as a debugger to the running process, something which needs deep tinkering with the Windows API and callbacks/threading, two things with levels that range from "advanced" to "black magic". Forget about using Perl in that case, unless you want to prove a point.