Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Noob Question, Write Memory etc.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Thu Jan 28, 2010 6:20 pm    Post subject: Noob Question, Write Memory etc. Reply with quote

Hi, i found an adress in cheatengine.

Now i want to code a trainer.
So i need this in the theory:

- Find program
- let the user enter a value
- write value to the adress

The problem is, i only find tutorials that do not help me.

For example this:

Quote:
BYTE Bytestopatch[3] = { 0x90, 0x90, 0x90};


I dont have 3 arrays, i have 6 and i dont now what to enter after that. BECAUSE i do NOT want to nop this and i only find tutorials how to nop.

Oh my english is bad as hell, i would be happy if someone can give me a tutorial or a sourecode that is very easy to understand.

I not want to learn the hole c++ language. I know you guys hate me for that, but i just want to change window titel + adress.

Hm difficult to explain, but maybe you can help me.

The adress is: 009CA46C
Type: Float
Value: xxxx

For you guys its very easy to do, cause you know what you are doing ^^
You can show me or explain me how to, but please no "here is a tutorial for the whole c++ language". This doesnt help me.
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Thu Jan 28, 2010 7:06 pm    Post subject: Reply with quote

Code:
- Find program
- let the user enter a value
- write value to the adress


If you want the user to pick from a list of windows in a listbox, use EnumWindows() and obtain the window titles and place them in the listbox. Then get the hwnd, pid, and handle with that window title the user picked.

Use WriteProcessMemory() to edit the address to the value the user specified.

Pretty simple.
Back to top
View user's profile Send private message MSN Messenger
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Thu Jan 28, 2010 7:35 pm    Post subject: Reply with quote

Not a listbox, i want to have a console.

Now i have something done, but the value it should change... there is a error in the code or something like that.

Code:
                   int v1 = 5000;
                   DWORD new_v1 = sizeof(v1);
                   if(WriteProcessMemory(hProcess, (LPVOID)0x009CA46C, &v1, new_v1, NULL))


int v1 is the value i want to have.
Also i add some "cout" but they wont appear. The console window just close and the value is f*cked up in the game.

What is the error?

//Edit: hm i think is better if you can see the full code to help me.

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

using namespace std;

int main(int argc, char *argv[])
{
    HWND cheat = FindWindow(0, "Warcraft III");
    if(cheat == 0)
    {
             cout <<"             Game not running!\n";
    }
    else
    {
            DWORD ID;
            GetWindowThreadProcessId(cheat,  &ID);
            HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ID);
            if(!hProcess)
            {
                        cout <<"             Game not running!\n";
            }
            else
            {
                   int v1 = 5000;
                   DWORD new_v1 = sizeof(v1);
                   if(WriteProcessMemory(hProcess, (LPVOID)0x009CA46C, &v1, new_v1, NULL))
                   {
                                                   cout <<"             Hack successful injected!\n";
                   }

}
}
}
Back to top
View user's profile Send private message
rooski
Master Cheater
Reputation: 0

Joined: 31 Oct 2007
Posts: 340
Location: Siberia

PostPosted: Thu Jan 28, 2010 10:38 pm    Post subject: Reply with quote

put a return 0 at the end of you program.
dont see anything wrong , but im on my phone so half of code isnt showing Sad

and is the gold value in WC3 4 BYTE? thought it was double.

also to keep the console window open add

system ("pause")

right before the last return 0
Back to top
View user's profile Send private message
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Thu Jan 28, 2010 11:53 pm    Post subject: Reply with quote

int v1[] = {5000};
Back to top
View user's profile Send private message
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Fri Jan 29, 2010 7:30 am    Post subject: Reply with quote

It doesnt work. This hack is for the camera distance.

But the changed value is in CE correct, but in this code here is too high oO
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sat Jan 30, 2010 10:12 am    Post subject: Reply with quote

Then if your coding it in a console, let the user type the window name of the target window, so you can just use findwindow() to get the hWnd of what the user inputted. OR, the user can enter the Process name of the target, and you can use createtoolhelp32snapshot() to get the pid of the target, from there you can just get its handle and then start writing.
Back to top
View user's profile Send private message MSN Messenger
rooski
Master Cheater
Reputation: 0

Joined: 31 Oct 2007
Posts: 340
Location: Siberia

PostPosted: Sat Jan 30, 2010 1:32 pm    Post subject: Reply with quote

do this

L"Warcraft III"

instead of just

"Waracraft II"
Back to top
View user's profile Send private message
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sat Jan 30, 2010 3:25 pm    Post subject: Reply with quote

rooski wrote:
do this

L"Warcraft III"

instead of just

"Waracraft II"


Why? .....
FindWindow is working, his WriteProcessMemory ain't.
Back to top
View user's profile Send private message
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Sat Feb 06, 2010 1:00 pm    Post subject: Reply with quote

Guys, the problem is:

I change the value to 5000, its the camera distance. But ingame its too high, that means i get a black screen ingame. If i change the camera distance by scrolling the wheele, it goes back to normal.

The problem isnt: finding the window, or the offset.

The Problem is the value.

With CE i can change the value to 5000 with no problem, but in my c++ code there must be something wrong.

The code is this here:

Code:
                   int v1[] = {4000};
                   DWORD new_v1 = sizeof(v1);
                   if(WriteProcessMemory(hProcess, (LPVOID)0x009D5518, &v1, new_v1, NULL))


Any ideas?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Sat Feb 06, 2010 3:56 pm    Post subject: Reply with quote

try
Code:

float v1 = 4000;


besides that, not sure

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Sat Feb 06, 2010 4:31 pm    Post subject: Reply with quote

Dark Byte wrote:
try
Code:

float v1 = 4000;


besides that, not sure


Thanks, that works!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites