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 


C++ ASM Help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Henley
Grandmaster Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 671

PostPosted: Thu Mar 06, 2008 12:13 am    Post subject: C++ ASM Help Reply with quote

I changed the question:

CE:
Code:
alloc(Apple,8)
alloc(begin,24)

begin:
mov [Apple+4], eax


If I put that into C++, Apple wouldn't be defined, how would I define it?

I tried this, but DCed from game:

Code:
void _declspec(naked) begin(void)
{
_asm
    {
    mov [Apple+4], eax
    Apple:
    }
}


Last edited by Henley on Thu Mar 06, 2008 10:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Thu Mar 06, 2008 12:51 am    Post subject: Reply with quote

At this point one would ask: "Why are you jumping into oblivion?"
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Thu Mar 06, 2008 2:26 am    Post subject: Reply with quote

Code:
void _declspec(naked) Orange(void)
{
     _asm  {   
        cmp eax,ebx
        je Orange
     
        Orange:
        //abc
     }
}
Back to top
View user's profile Send private message MSN Messenger
Henley
Grandmaster Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 671

PostPosted: Thu Mar 06, 2008 11:12 pm    Post subject: Reply with quote

I changed the question and Thanks noz, I can't believe I couldn't figure that out >.>
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Mar 07, 2008 3:58 am    Post subject: Reply with quote

aznkidtroll wrote:
I changed the question and Thanks noz, I can't believe I couldn't figure that out >.>
Why to change the question? Why not to post a reply with an another question?

The answer: new operator.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Mar 07, 2008 4:30 am    Post subject: Reply with quote

Look at the code:
Code:
alloc(Apple,8)
alloc(begin,24)

begin:
mov [Apple+4], eax


It allocates "begin" and "Apple" and makes changes at "begin", simply allocate memory and there make your changes. (mov [Apple+4], eax and whatever you need)
Jump from the address you want to code cave to that address you allocated and at the end of your code cave jump back. (look for a code caving tutorial, see how a code cave works)
Back to top
View user's profile Send private message
Henley
Grandmaster Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 671

PostPosted: Sat Mar 08, 2008 1:15 pm    Post subject: Reply with quote

Symbol wrote:
Look at the code:
Code:
alloc(Apple,8)
alloc(begin,24)

begin:
mov [Apple+4], eax


It allocates "begin" and "Apple" and makes changes at "begin", simply allocate memory and there make your changes. (mov [Apple+4], eax and whatever you need)
Jump from the address you want to code cave to that address you allocated and at the end of your code cave jump back. (look for a code caving tutorial, see how a code cave works)


I'm stuck at allocating memory for Apple Embarassed .

i'll just give the whole code out :\

Code:
void _declspec(naked) CamVacON(void)
{
_asm
{   
push edx
push ecx
mov edx,[0x00850460]
mov ecx,[edx+658]
cmp esi,ecx
je normal
mov [y], eax //eax = y
mov ecx,[edi-4]
mov [x], ecx //ecx = x
cmp [edx+380],6
je dotele
cmp [edx+380],2
je dotele
jmp normal

dotele:
mov ecx,[x]
sub ecx, 50 //ecx =x
mov [edx+0xF00],ecx
mov ecx,[y] //eax = y
sub ecx, 15 //eax = y
mov [edx+0xF04],ecx
mov [edx+380],13

normal:
pop ecx
pop edx
mov [edi],eax
mov ebx,[ebp+14]
jmp returnhere

returnhere:

}
}


Look at the script, the "x" and "y" isn't identified and I'm pretty much stuck on allocating memory for them. So when I allocate memory for it, they are defined right?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Mar 08, 2008 1:47 pm    Post subject: Reply with quote

Use VirtualAlloc/VirtualAllocEx to allocate memory of a given size.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Henley
Grandmaster Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 671

PostPosted: Sat Mar 08, 2008 11:36 pm    Post subject: Reply with quote

Wiccaan wrote:
Use VirtualAlloc/VirtualAllocEx to allocate memory of a given size.


Sad but that doesn't define x and y
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Mar 08, 2008 11:48 pm    Post subject: Reply with quote

Just define them as DWORDs outside of the function?

DWORD X;
DWORD Y;

At the top under your includes. They are given memory addresses then and can be used to store values. You can also access them from other functions if need be.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Sun Mar 09, 2008 7:00 am    Post subject: Reply with quote

aznkidtroll wrote:
Symbol wrote:
Look at the code:
Code:
alloc(Apple,8)
alloc(begin,24)

begin:
mov [Apple+4], eax


It allocates "begin" and "Apple" and makes changes at "begin", simply allocate memory and there make your changes. (mov [Apple+4], eax and whatever you need)
Jump from the address you want to code cave to that address you allocated and at the end of your code cave jump back. (look for a code caving tutorial, see how a code cave works)


I'm stuck at allocating memory for Apple Embarassed .

i'll just give the whole code out :\

Code:
void _declspec(naked) CamVacON(void)
{
_asm
{   
push edx
push ecx
mov edx,[0x00850460]
mov ecx,[edx+658]
cmp esi,ecx
je normal
mov [y], eax //eax = y
mov ecx,[edi-4]
mov [x], ecx //ecx = x
cmp [edx+380],6
je dotele
cmp [edx+380],2
je dotele
jmp normal

dotele:
mov ecx,[x]
sub ecx, 50 //ecx =x
mov [edx+0xF00],ecx
mov ecx,[y] //eax = y
sub ecx, 15 //eax = y
mov [edx+0xF04],ecx
mov [edx+380],13

normal:
pop ecx
pop edx
mov [edi],eax
mov ebx,[ebp+14]
jmp returnhere

returnhere:

}
}


Look at the script, the "x" and "y" isn't identified and I'm pretty much stuck on allocating memory for them. So when I allocate memory for it, they are defined right?


Thank you ^_^

PM Me your msn i will help you out w/ it!

_________________
Gone
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