Hooking, Memory write tutorials

01/14/2012 16:30 DarkTwilight#1
Dear readers,

does anyone know any good online tutorials (in English please, since my german is not really superb) which introduce and teach you the art of Hooking and reading / writing from the memory?

I know C++ but never did anything with hooking or memory reading/writing so far i.e. game hacking but I really would like to learn it.

I hope someone knows some nice tutorials :)

P.S. could someone explain me the following:
I would like to get the text which I write in my game, to be available in my C++ program.

I downloaded cheat engine and wrote some text in game and then did a search for that text. I repeated this process and in the end I was left with 6 memory values.

- 1Aff26D8
- 1B100C4 (this one also shows what other people type and changes all the time)
- 298D0Db2
- 2A50C8Dc (this one does the same as the 2nd)
- 3E80A450
- 43ED5744 (same as 2nd and 4th)

Now for my question. How can I get the text I type, to show up in my C++ program?

Queue, vectors, list, how does this work, and what would you do?

Hopefully some tips from you guys :)

Thanks in forward <3


P.S. I did a re-scan and now everything has new memory values.
I will worry about that later, lets say I just know the values and will change them manually everytime in my C++ tool. I just want to know how to read from the memory and display it in my console application (I am using Qt Creator).

I posted a screenshot with info. Hopefully that helps a bit to, when explaining stuff to me :)


[Only registered and activated users can see links. Click Here To Register...]
01/14/2012 16:53 jacky919#2
What kind of memoryhacking you want to use?
There are two ways I know:
DLL Injection or
using [Only registered and activated users can see links. Click Here To Register...] an edit memory with
[Only registered and activated users can see links. Click Here To Register...]
reading can be done with [Only registered and activated users can see links. Click Here To Register...]
01/14/2012 17:22 DarkTwilight#3
ohhhh, I dont know mate, never used any. I think what ever most people would suggest, would be the one I would like to learn first. In the end I want to learn them all, just for the sake of knowledge lol :)

Anyways, if it helps, I want to get what ever is in the chat window of a game called Final Fantasy XIV. If there is something new there, I want it to show in my C++ program to. In other words, just keep scanning the FFXIV memory and everytime a new line of chat comes, also display it in my C++ tool.

I see most people use write / read memory (online tutorials) so I think it would be best to start there instead of starting at DLL injection?

Thanks for your answer so far jacky919!

P.S. Most tutorials I see people talk about addresses like "0x100579C", but that is no where near what CheatEngine is showing me. Am I doing something wrong?

I just wrote this code (which seems good?) only thing is I have no clue how to get a 0x000000 address from anything lol :P

Code:
#include <iostream>
#include <iomanip>
#include <windows.h>

using namespace std;

int main()
{
    // set some variables
    DWORD address = 0x100579C;	// the address which we want to read from
    int value = 0;		// storage for our value
    DWORD pid;			// process id storage
    HWND hwnd;			// handle storage

    // get the window handle
    hwnd = FindWindow(NULL, L"FINAL FANTASY XIV");		    // put the handle name in variable hwnd
    if(!hwnd)						    // check if the screen is found, if not display an error
    {
	cout << "Window not found!";
	cin.get();
    }

    // get the process
    GetWindowThreadProcessId(hwnd, &pid);		    // get the window his handle and put it into pid variable
    HANDLE phandle = OpenProcess(PROCESS_VM_READ, 0, pid);  // check if it is found, if not display an error
    if(!phandle)
    {
	cout << "Handle not found!";
	cin.get();
    }

    while(true)
    {
	// read what is in the memory and put it in the variable value.
	// we also check how much we are reading by calling sizeof(value).
	// at last we can check the number of bytes but we dont do that atm
	ReadProcessMemory(phandle, (void*)address, &value, sizeof(value), NULL);

	cout << value << endl;
	Sleep(5000);
    }

    return 0;
}
01/14/2012 17:44 jacky919#4
you have to find the pointer to your address otherwise you won't be able to use your programm (hack) after restarting the game, except your address is a static one (colored green in CE)

The differnces between a DLL-injection and using the WinAPI functions named about are, if you are using a DLL-injection you compile a DLL and inject it in your process.
The DLL usually starts a new thread in which your hacking functions are called. You are able to direct access the process memory, let me explain:
Code:
int* address = reinterpret_cast<int*>(0xFAFAFA);
*address = 9999;
Like this you can eccess address 0xFAFAFA for example and change it's value to 9999.
The other way is writing an application which is accessing the memory with WinAPI functions.
Looked at that way an DLL-injection is easier to perform in C++

Edit: Can characters not in ASCII table entered in the chat? e.g. ä/ö/ü or chinese/japanese words
01/14/2012 18:57 DarkTwilight#5
Thanks for your reply jacky919.
You can use characters like "ëäöüï" in chat, you can even write japanese symbols (or chinese) in the chat. It accepts a lot. But you can also make macro's like:

type in: hell
press TAB-Key
It will give you various auto-complete suggestments like:

1. hello
2. hellfire
3. hellsguard

those things are some kind of macro function or w/e to call it. They come out as weard signs when I scan them with CE but thats least of my concerns haha. Im sure there is a way to fix that by replacing with some regdex code or something.

Anyways, using DLL injection looks nice, perhaps that will be the best method for me to use. On the downside, is it detectable? (the game does NOT use any anti-cheat software) cause if so, then I would go for the other option :P

If undetectable, then yes, DLL Injection would be best for me to start learning. Anyways, you have any suggestion on a tutorial on how to do that, or could you write me a simple one with nice comments in it so I can tear it apart and play around with it and so learn it?

Yet, I have no clue how to get the pointer to the address I need lol. The only information I can find about that "chat" is what CE gives me (CE = Cheat Engine lol).

Have a nice weekend, and thanks again for your fast anwers, really appreciate it :D

Yours sincerely


edit:
You know of any books that learn you this kind of coding in C++ ?
Dont know what is is called... hooking, memory reading / writing, (dis)assembly and so on?
I cant find any good books which can be ordered in the Europe ; ;
01/14/2012 19:26 jacky919#6
There are ways to detect a DLL-injection, but I don't think FinalFantasy is using those methods. I don't know any game detecting DLL-injections.

Code doesn't have any sense, the only thing could happen is your game will crash
I didn't compile it, but it should work
01/14/2012 22:17 phize#7
You should check out some CE tutorials on the official forum, they should be good for you.
01/16/2012 00:50 DarkTwilight#8
awesome thanks for your answers guys :)

Where can I find those? all I see in C++ section on forum and nothing "official" there?

thanks for your answers guys!

Quote:
Originally Posted by Synsia View Post
You should check out some CE tutorials on the official forum, they should be good for you.
01/16/2012 09:53 phize#9
[Only registered and activated users can see links. Click Here To Register...]