Thread: Poking other Process' Memory

  1. #1
    Unreg
    Guest

    Poking other Process' Memory

    Does anyone know how to poke the memory that another process is using? Like to change a number in a game?

  2. #2
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    what OS
    hello, internet!

  3. #3
    Unreg
    Guest
    I'm using Windows 2000 (and MSVC++ 6).

  4. #4
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    no can do. windows 2000 is a real operating system. it will block any attempt to access memory outside your process.
    hello, internet!

  5. #5
    Unreg
    Guest
    Are you sure? Because there are programs like ArtMoney that let you search through and edit other applications' memory.

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    there is an api func called WriteProcessMemory(). I havent used it. I believe its for debugging purposes but you might be able to do something with that and OpenProcess()
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  7. #7
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by vVv
    >it will block any attempt to access memory outside your process

    Nope, not neccessarily. There are ReadProcessMemory( ) and WriteProcessMemory( ) API calls that do just that, provided the process handle has PROCESS_VM_READ and PROCESS_VM_WRITE/PROCESS_VM_OPERATION access, respectively.
    but how do you get a handle with the PROCESS_VM_WRITE flag?
    hello, internet!

  8. #8
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    OpenProcess()
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  9. #9
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    You're going to need to use FindWindow() then OpenProcess() and finally ReadProcessMemory() or WriteProcessMemory()

  10. #10
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    but OpenProcess() will not let you get a handle for reading and writing to the memory without proper security clearance, and i'm willing to guess that most commercial apps wont let you do that.
    hello, internet!

  11. #11
    Unreg
    Guest
    Does anyone know how you would get the process handle from the window handle?

  12. #12
    Unreg
    Guest
    Never mind, its GetWindowThreadProcessId.

  13. #13
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    To alter memory with WriteProcessMemory() and ReadProcessMemory() works.

    My hexeditor HyperEdit uses these functions.

    The tricky part is to find out which addresses are valid to read from. My solution is to scan the addresses in 1024-byte intervals for valid adresses.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with insert/delete binary search tree
    By Nazgulled in forum C Programming
    Replies: 39
    Last Post: 03-25-2009, 04:24 PM
  2. Memory usage and memory leaks
    By vsanandan in forum C Programming
    Replies: 1
    Last Post: 05-03-2008, 05:45 AM
  3. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  4. Replies: 8
    Last Post: 03-18-2006, 10:05 PM
  5. patching memory in another process
    By 44ffcc in forum Windows Programming
    Replies: 2
    Last Post: 02-06-2006, 09:32 AM