Hello!
I want to make a trainer (just for that not because I need to cheat at a game).
I have an application made by me (Untitled1.exe......ftw!) when I press any key it makes the number from x to x++... Another program I need is when I run it to make that int value 100.
I know the address (ArtMoney) and I just need the code part... please don't post whole bunch of codes without explaining... after all I'm here to learn.

~h.dan :icon_mrgreen:

>>I know the address (ArtMoney)
I have no clue what that means.

>>after all I'm here to learn
Great, so start by writing your own code.

// put include statements here
int main()
{
   // put your code here
}

I know the variable address and I need more tutorials... as is said I'm not here for codes... I'm here for functions and what they do, and finally that they have some LITTLE spoiler for the trainer.

I know the variable address and I need more tutorials... as is said I'm not here for codes... I'm here for functions and what they do, and finally that they have some LITTLE spoiler for the trainer.

What trainer? What variable? What game? Tutorials on what subject? What do these functions need to do? We need far more details.

It's not a game it's a program I made that when pressing any key it adds up 1 to the integer... I just want to experience with variables (in this case it's a medium integer). I want to make a program a variable on another program to change.

This is the program that adds 1.

#include <iostream>
#include <ostream>
#include <ios>

using namespace std;

int main()
    {
          int n;
          n = 1;
          while(1)
                  {
                        cout << n << endl;
                        n++;
                        system("@pause > nul");
                        system("cls");
                  }
          return 0;
    }

I know the variables address in hexadecimal.
This is the program b that SHOULD change the value at that address with its own one.

#include <iostream>
#include <ostream>
#include <ios>

using namespace std;

int main()
    {
          int myval;
          myval =&0x00250874;
          myval = 9000;
    }

But everyone knows I missed something... well whats missing? :icon_neutral:
And yes I'm using WindBlows.

In MS-Windows and *nix each process (program) has its own address space, and the address in one program can not normally be changed by another program. That is one of the security features of the operating systems. Just because you printed out the address of a variable in program A doesn't mean you can use that address in program B because in program B that address might point to a completly different thing (such as code) in program B's address space, or it might not be the address of anything at all.

That address is not relative to the operating system but relative to the program.

I know I was just saying that because I putted the MS-DOS commands... but how trainers work then? The x=&a shows the address...I wandered if it's a way to change 'a' with another program like a trainer... :-/

I know I was just saying that because I putted the MS-DOS commands... but how trainers work then? The x=&a shows the address...I wandered if it's a way to change 'a' with another program like a trainer... :-/

Perhaps, Inter process communication may be an answer.
>>but how trainers work then?
I don't get it. What trainers?

Thanks about the link. I think it will do. "Trainers"... I meant a program that in conception is a game trainer... nevermind now I think link will help :-)

Prabakar, a trainer is something that lets you cheat on games. They can give you like infinite money and health and stuff.
hdan, to get a variables address in your own program do this:

#include <iostream>
#include <ostream>
#include <ios>

using namespace std;

int main()
{
          int n;
          n = 1;
          cout << &n;
          cin.get();
          return 0;
}

I have tried to do the same thing in the past. Here's the code. You need the text of the window for the program to cheat on.

#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <iostream>
using namespace std;

int Memory(char Caption[], int long Address, int Value, bool _w)
{
    DWORD PROC_ID;
    HANDLE PROC_HANDLE;

    GetWindowThreadProcessId(FindWindow(NULL, (LPCTSTR)Caption), &PROC_ID);
    PROC_HANDLE = OpenProcess(PROCESS_ALL_ACCESS, false, PROC_ID);
    if(_w)
        WriteProcessMemory(PROC_HANDLE, (LPVOID)Address, &Value, sizeof(long int), NULL);
    else
        ReadProcessMemory(PROC_HANDLE, (LPVOID)Address, &Value, sizeof(long int), NULL);
    CloseHandle(PROC_HANDLE);
    return Value;
}

int main()
{
    SetConsoleTitle("EditMemory");
    char Caption[1000];
    cout << "Enter the caption: ";
    cin.getline(Caption, 1000);
    HWND Test = FindWindow(NULL, Caption);
    if (!Test)
    {
    cout << "\nCannot find window \"" << Caption << "\"!";
    cin.get();
    return 0;
    }
    
    LPVOID Address;
    cout << "\nEnter the address: ";
    cin >> Address;
    
    int Value;
    cout << "\nEnter the value to write: ";
    cin >> Value;
    
    bool _w;
    char aChar[100];
    cout << "\nEnter 'w' to write, or 'r' to read: ";
    cin >> aChar;
    
    switch (aChar[0])
    {
       case 'w':
       _w = true;
       break;
       
       case 'r':
       _w = false;
       break;
       
       default:
       cout << "\nYou didn't enter 'w' or 'r'!";
       cin.ignore();
       cin.get();
       return 0;
       break;
    }
    cout << "\nThe value is: " << Memory(Caption, (int long)Address, Value, _w);
    cin.ignore();
    while (getch() != 'q')
    {
    Sleep(10);
    }
    return 0;
}
Comments
Impressive:)

Thank you but I'll really appreciate if you would explain. Sorry if I disturb you too much :-/

Dragon thanks for the links ... I would never thought searching that.

so if you have address of int - you can try this :)

int * money = (int*)0x7ffd8000;
*money = 666;

so if you have address of int - you can try this :)

int * money = (int*)0x7ffd8000;
*money = 666;

Read threads before opening mouth and inserting foot :)

when he says trainer I do Beleive he means like a flash game trainer.

Its a whole lot easier in VB but like he means to take the variable in a game such as health; take its original value of 100 and change it to something like 1000.

Im pretty sure thats what he means....again its alot easier in VB so i would think about doing a trainer there first

This article has been dead for over six months. Start a new discussion instead.