Quick question

Posts 1–4 of 4 · Page 1 of 1
Quick question
How would I be able to edit an address's EAX value in c++?
Quote Originally Posted by J-C View Post
How would I be able to edit an address's EAX value in c++?
Addresses don't have EAX values. EAX is a register on the processor, and so can be a million different things depending on the situation. the current instruction or address may have code at that location to change it, but more often then not the eax is a general pupose register used to store values, and most importantly hold the return value from functions (including many assembly instructions). So my question to you is why do you want to change it?
Quote Originally Posted by why06 View Post
Addresses don't have EAX values. EAX is a register on the processor, and so can be a million different things depending on the situation. the current instruction or address may have code at that location to change it, but more often then not the eax is a general pupose register used to store values, and most importantly hold the return value from functions (including many assembly instructions). So my question to you is why do you want to change it?
He may want to change an instruction to do something else. Like, if you ever find the address that holds the amount of ammo you have in any FPS game, there will most likely be another instruction writing to it.

@OP

I will use Minesweeper and the number of mines as an example.

Address 1005194 holds the number of mines. In CE, you can find what instructions write to which address. I got 0100346E.

The instruction is:
Code:
add [1005194],eax
Already, you can tell what needs to be done. I think an easy way to change the value of EAX would be to create a jump. From there you can add another instruction before the one mentioned above.

Code:
mov eax,SomeValue
In C++ I guess you could create a DLL and inject it. Create your own function and jump to it. After you've created the jump of course.

[php]

DWORD address = 0x0100346E;

void myFunction()
{
__asm
{
mov eax,1
add [1005194],eax
ret
}
}

void Jump()
{
DWORD* FunctionAddy = (DWORD*)myFunction;
*(BYTE*)address = 0xE9; // jump
*(DWORD*)(address+1) = ((FunctionAddy-address)-5);
}

//Dll main crap.

DLL_PROCESS_ATTACH:
Jump();
break;

[/php]

Don't expect that to work. I'm trying to give you a general idea of how you can modify the contents of EAX. Like Why said, EAX is a register not a value.

Syntax may be wrong. This whole method may be wrong. Oh well.
well thanks for the help I will try doing this later on .
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?