Results 1 to 8 of 8
  1. #1
    Grooguz
    Grooguz is offline
    BanHammer Holder
    Grooguz's Avatar
    Join Date
    2010 May
    Posts
    678
    Thanks
    152
    Thanked 537 Times in 167 Posts
    Rep Power
    8

    Memory Hacking with C and CheatEngine, writing to Process Memory

    Learn to create a trainer (a program that writes to remote process memory) in C++ using a Calculator as an example. There are also references to cheat engine.


    Source Code
    #include <iostream>
    #include <windows.h>

    // FindWindow();
    // GetWindowThreadProcessId();
    // OpenProcess();

    // WriteProcessMemory();

    // CloseHandle();

    using namespace std;

    int main()
    {
    int newValue = 500;

    HWND hWnd = FindWindow(0, "Calculator");

    if (hWnd == 0) {
    cerr << "Cannot find window." << endl;
    } else {
    DWORD pId;
    GetWindowThreadProcessId(hWnd, &pId);
    HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);

    if (!hProc) {
    cerr << "Cannot open process." << endl;
    } else {
    int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x000AFCC4, &newValue, (DWORD)sizeof(newValue), NULL);

    if (isSuccessful > 0) {
    clog << "Process memory written." << endl;
    } else {
    cerr << "Cannot write process memory." << endl;
    }

    CloseHandle(hProc);
    }
    }

    return 0;
    }

    by Hero

  2. The Following 2 Users Say Thank You to Grooguz For This Useful Post:


  3. #2
    sh1ft
    sh1ft is offline
    New member sh1ft's Avatar
    Join Date
    2011 Dec
    Location
    Asia
    Posts
    17
    Thanks
    9
    Thanked 10 Times in 4 Posts
    Rep Power
    0
    I had try to hack my hp in online games before.The hp is 100 and I hacked its to 1000 but the hp still decrease like a normal hp.For example if someone hit me1k damage its will decrease half of my hp (100) but the same goes to my hacked hp (1000).

    My question is does the number only virtual ( I mean only an image, nothing more )?

    Or can the hp actually be hacked with the amount of number we want?

    Btw,im using both C++(noob programmer) and Cheat Engine.

  4. #3
    annnnndre
    annnnndre is offline
    Senior Member annnnndre's Avatar
    Join Date
    2011 Jul
    Location
    By your side, let's the game begin'
    Posts
    336
    Thanks
    118
    Thanked 177 Times in 87 Posts
    Rep Power
    0
    AWESOME VIDEO! I have download then on max resolution and already watch; I learn a lot with this; thanks!

  5. #4
    stdio.h
    stdio.h is offline
    New member
    Join Date
    2012 Jun
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    That was a great tutorial; Thank you very much for the link.
    That's the most informative video I have seen on this topic. Are you the maker of the video? I've subscribed anyway. Oh, and I turned it into C code, as it looks better imo.
    Code:
    #include <stdio.h>
    #include <windows.h>
    
    int main()
    {
        int newValue = 500;
        HWND hWnd = FindWindow(0, "Calculator");
    
        if (hWnd == 0) {
            fprintf(stderr, "Cannot find window.");
        } else {
            DWORD pId;
            GetWindowThreadProcessId(hWnd, &pId);
            HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
    
            if (!hProc) {
                fprintf(stderr, "Cannot open process.");
            } else {
                int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x000AFCC4, &newValue, (DWORD)sizeof(newValue), NULL);
    
                if (isSuccessful > 0) {
                    puts("Process memory written.");
                } else {
                    fprintf(stderr, "Cannot write process memory.");
                }
    
                CloseHandle(hProc);
            }
        }
        getchar();
        return 0;
    }
    Last edited by stdio.h; 2012-06-30 at 02:15 PM.

  6. #5
    Schoktra
    Schoktra is offline
    Guest
    Join Date
    2013 Jun
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Okay, I've followed this tutorial and wrote to a memory location and was quite elated. Then I close process, and open a new process for calculator and tried to run the program again which then it fails to write the memory. How can we change this code to make it always work? Like find memory address of start of program + the offset in the program memory so that it will always work even if we close and reopen the program many times? Otherwise if we use this to try to make game trainer it will only work the first time we run the game and no other time.

  7. #6
    reehfilho
    reehfilho is offline
    New member reehfilho's Avatar
    Join Date
    2013 Sep
    Location
    São Paulo / Jaú
    Posts
    14
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Very good guy, was exactly what I needed, I was confused by a lot more already gave it to lighten

    ------------------------------------------------------------

    CAra muito bom, era exatamente o que eu precisava, tava confuso com muita coisa, mais ja deu pra clarear

  8. #7
    lanceaurion
    lanceaurion is offline
    Senior Member lanceaurion's Avatar
    Join Date
    2012 Mar
    Posts
    305
    Thanks
    59
    Thanked 127 Times in 88 Posts
    Rep Power
    0
    what programs are you using Grooguz ?
    <---- If I helped, click the button thanks!

  9. #8
    agescop
    agescop is offline
    New member agescop's Avatar
    Join Date
    2012 Aug
    Posts
    43
    Thanks
    25
    Thanked 9 Times in 9 Posts
    Rep Power
    0
    Thanks be congratulated'll test here

Similar Threads

  1. Replies: 1
    Last Post: 2013-03-06, 09:59 PM
  2. [C#] How to Read and Write to the Process Memory
    By Grooguz in forum VB, .NET Framework
    Replies: 0
    Last Post: 2011-11-27, 05:27 AM
  3. Flash games memory hacking using MHS
    By Dwar in forum Game Researching Tutorials
    Replies: 3
    Last Post: 2011-08-01, 11:54 PM
  4. [C++] Memory-writing functions
    By Dwar in forum C/C++
    Replies: 0
    Last Post: 2010-11-29, 04:14 PM
  5. [Memory Scanner] Memory Hacking Software
    By Dwar in forum Files & Tools
    Replies: 3
    Last Post: 2010-11-29, 03:39 PM
Visitors found this page by searching for:

c memory hacking

cannot write to process memory

Hacking using c

memory hacking in c

cheat engine c

memory hacking c

cheatengine c

c cheat engine

memory hacking forumcheat engine to c c write memoryhttp:www.progamercity.netcode-tut2065-c-memory-hacking-c-cheatengine-writing-process-memory.htmlmemory hack cc memory hacker source codewrite memory C c memory hack source codecheat engine cannot open processwrite process memory c cheat engine write memoryhacking in cc memory writec memory hacking tutorialc writeprocessmemorymaking a c game hack using cheat enginec codes for hacking

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •