Thread: WriteProcessMemory help please

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    WriteProcessMemory help please

    This is the function: (Got it from msdn)

    Code:
    WriteProcessMemory(
      HANDLE hProcess,
      LPVOID lpBaseAddress,
      LPCVOID lpBuffer,
      SIZE_T nSize,
      SIZE_T* lpNumberOfBytesWritten
    );
    link to code:

    http://msdn.microsoft.com/library/de...cessmemory.asp



    But for the handle, how do I do this. Do I use a varible like HANDLE hand = somthing. And how do I get the process handle. I think I can get it but I need to know what it looks like and so on.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    If you dont know what you are doing I'd give that API a miss.

  4. #4
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    well I looked at that link and well. I hate to say it but I am not very good at c++ anymore at all.

    I went searching based upon some of that info though and found this function now:

    OpenProcess(
    DWORD fdwAccess,
    BOOL fInherit,
    DWORD IDProcess
    );

    I am thinking this could be used couldn't it?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > I hate to say it but I am not very good at c++ anymore at all.
    I suggest you either make a backup of all your work, because you're just a few mistakes away from hosing your entire machine.

    Or you come up with an explanation of why you want to use something as dangerous as WriteProcessMemory and perhaps we can offer alternative approaches.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    oh alright ok. I am trying to hack my game I made with game maker. And I don't think this is so dangerous. I was told using the registry was dangersous but it isn't if you know what you are doing. And writeprocessmemory shoudl only effect ram/vitual memory right?

    But basicly I want to make a trainer for a game.

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Whoa ho ho!

    Stop right there, buddy.

    http://cboard.cprogramming.com/annou...ouncementid=51

    Rule 6 prohibits cracking, hacking and other similar taboos. If you want to continue this discussion, please do so elsewhere

    If you want to discuss it, PM me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WriteProcessMemory failing with GetLastError 87
    By Anddos in forum Windows Programming
    Replies: 5
    Last Post: 04-19-2009, 02:34 PM
  2. WriteProcessMemory
    By Crypteasy in forum Windows Programming
    Replies: 1
    Last Post: 07-26-2008, 10:33 PM
  3. createremotethread and writeprocessmemory problems
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 01-19-2008, 09:33 AM
  4. createremotethread and writeprocessmemory problems
    By cloudy in forum C++ Programming
    Replies: 1
    Last Post: 07-03-2005, 05:06 PM
  5. WriteProcessMemory
    By cppdude in forum Windows Programming
    Replies: 3
    Last Post: 04-12-2002, 08:31 AM