Thread: Getting all the computer memory

  1. #1
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195

    Getting all the computer memory

    How would one go about printing out the contents of the memory to the screen (the raw data)? Would the OS stop your program if you were attempting to read the memory from other programs running on the system?

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    You could set up a loop to start at address 0, attempt to print the character to the screen, and then advance your pointer one byte, and repeat that sequence until the end of memory.

    However, you would have to set your program up to be able to handle signals, (via signal handlers), because you would certainly get seg faults and access errors and who knows what other errors. All these signals would have to be handled, and you would have to be able to recover from them and continue in your loop.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    deletedforumuser
    Guest
    Your looking to read other programs memory?

    Well, you could alway make a .dll and inject it into the program. Then finally, read the memory of this single program.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    On what OS?
    You can probably do it with DOS pretty easily, but Windows & UNIX both use virtual memory, so I'm sure it would be a lot harder.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Swarvy, it's platform dependant as to how and if it is even possible.
    You can't even address memory directly in a user mode program in Windows. Every app is given its own seperate address space. The same address in difference programs points to different data!
    I'm not going to tell you about APIs that allow you to read memory from other programs because if you don't know how it should probably stay that way, in my opinion. There are very few valid reasons to ever do it.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-06-2009, 12:27 PM
  2. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 01:33 PM
  3. Accessing Video Memory Information...need help
    By KneeLess in forum C++ Programming
    Replies: 8
    Last Post: 08-24-2003, 03:53 PM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  5. Memory handler
    By Dr. Bebop in forum C Programming
    Replies: 7
    Last Post: 09-15-2002, 04:14 PM