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 


Auto Asm Question.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Aug 11, 2008 5:05 pm    Post subject: Auto Asm Question. Reply with quote

Noobie question...

What is a label in autoasm?
And if you remove it from a script will it affect it?
Back to top
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Mon Aug 11, 2008 5:36 pm    Post subject: Reply with quote

http://www.keil.com/support/man/docs/a166/a166_st_label.htm
_________________
Gone
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: Mon Aug 11, 2008 5:39 pm    Post subject: Reply with quote

Code:
label(lol)

lol:


Just defines a label.
Back to top
View user's profile Send private message MSN Messenger
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Mon Aug 11, 2008 5:48 pm    Post subject: Re: Auto Asm Question. Reply with quote

dnsi0 wrote:
Noobie question...

What is a label in autoasm?
And if you remove it from a script will it affect it?

label is most likely a placeholder for the address.
like i set

Code:

label(lol)

400000:
nop
lol:

lol is 400001
Understand what i mean :s ?

_________________
Gone
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Aug 11, 2008 5:54 pm    Post subject: Reply with quote

no I dont get it. You didn't even declare what lol would be.

If I removed that, will if affect what the script is gonna do?
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: Mon Aug 11, 2008 5:56 pm    Post subject: Reply with quote

dnsi0 wrote:
no I dont get it. You didn't even declare what lol would be.

If I removed that, will if affect what the script is gonna do?


The script won't be run if it doesn't know what it is.
Back to top
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Aug 11, 2008 8:06 pm    Post subject: Reply with quote

So can you see if this script converted will work?
SS Mouse Tele with key press shift to tele -> tick script and tele.

Original:
Code:
[Enable]
alloc(MouseTele,128)
label(TeleOn)
label(DoTele)
label(Normal)
label(Return)

MouseTele:
push eax
mov eax,[00965c88]
mov eax,[eax+9B4]
cmp eax,c
pop eax
jae TeleOn
jmp Normal

TeleOn:
pushad
mov eax,[00965c88]
mov eax,[eax+978]
push [eax+88]
push [eax+84]
call DoTele
popad
jmp Return

DoTele:
push [esp+8]
push [esp+8]
mov eax,[00965B38]
mov eax,[eax+D38]
push eax
mov eax,[eax]
call [eax+40]
ret 8

Normal:
mov eax,[eax+000009b4]
jmp Return

0073A27F:
jmp MouseTele
nop
Return:

[disable]
dealloc(MouseTele)

0073A27F:
db 8B 80 B4 09 00 00


Me Fixing It:
Code:
[Enable]
alloc(MouseTele,128)
alloc(TeleOn,30)
alloc(DoTele,28)

TeleOn:
pushad
mov eax,[00965c88]
mov eax,[eax+978]
push [eax+88]
push [eax+84]
call DoTele
popad

DoTele:
push [esp+8]
push [esp+8]
mov eax,[00965B38]
mov eax,[eax+D38]
push eax
mov eax,[eax]
call [eax+40]
ret 8

0073A27F:
jmp TeleOn
nop
Return:

[disable]
dealloc(MouseTele)

0073A27F:
db 8B 80 B4 09 00 00
Back to top
View user's profile Send private message
Drops
Advanced Cheater
Reputation: 0

Joined: 22 Feb 2008
Posts: 62

PostPosted: Mon Aug 11, 2008 9:37 pm    Post subject: Reply with quote

dnsi0 wrote:
So can you see if this script converted will work?
SS Mouse Tele with key press shift to tele -> tick script and tele.

Original:
Code:
[Enable]
alloc(MouseTele,128)
label(TeleOn)
label(DoTele)
label(Normal)
label(Return)

MouseTele:
push eax
mov eax,[00965c88]
mov eax,[eax+9B4]
cmp eax,c
pop eax
jae TeleOn
jmp Normal

TeleOn:
pushad
mov eax,[00965c88]
mov eax,[eax+978]
push [eax+88]
push [eax+84]
call DoTele
popad
jmp Return

DoTele:
push [esp+8]
push [esp+8]
mov eax,[00965B38]
mov eax,[eax+D38]
push eax
mov eax,[eax]
call [eax+40]
ret 8

Normal:
mov eax,[eax+000009b4]
jmp Return

0073A27F:
jmp MouseTele
nop
Return:

[disable]
dealloc(MouseTele)

0073A27F:
db 8B 80 B4 09 00 00


Me Fixing It:
Code:
[Enable]
alloc(MouseTele,128)
alloc(TeleOn,30)
alloc(DoTele,28)

TeleOn:
pushad
mov eax,[00965c88]
mov eax,[eax+978]
push [eax+88]
push [eax+84]
call DoTele
popad

DoTele:
push [esp+8]
push [esp+8]
mov eax,[00965B38]
mov eax,[eax+D38]
push eax
mov eax,[eax]
call [eax+40]
ret 8

0073A27F:
jmp TeleOn
nop
Return:

[disable]
dealloc(MouseTele)

0073A27F:
db 8B 80 B4 09 00 00


I'm not entirely sure, but a label just defines a point in the code. Like in c++, sometimes you have labels and use goto (label here);. For AA the top script works because basically the whole thing is the Mousetele procedure broken up into organized sections using labels. The second one would probably work fine, but I think you should decrease the amount you allocate to Mousetele. Sorry if this is confusing lol.

EDIT: uh just take away the alloc(mousetele,128) part since it looks like your just enabling it.
Back to top
View user's profile Send private message
Uzeil
Moderator
Reputation: 6

Joined: 21 Oct 2006
Posts: 2411

PostPosted: Tue Aug 12, 2008 4:17 am    Post subject: Reply with quote

A label is just a place in code.

Here's my way of explaining it through the example above.

Code:
alloc(MouseTele,128)
label(TeleOn)
label(DoTele)
label(Normal)
label(Return)


This is all that says:
Make room for up to 128 bytes of code, starting with an address I'll refer to as MouseTele.
Understand that when I say TeleOn, I'm refering to the point in code where I say 'TeleOn:'
" " where I say 'DoTele:'
" " Normal:
" " Return:


I don't know what your 'home' language is, so I'm restricting what I say to English(by 'home' language I was referring to coding, not Spanish or anything).

Labels are just that, labels for a point in code(labels, names, placeholders, 'label' is an english word, not 'coder lingo' or anything alien).

As for your adjustment(notice I called it an adjustment, not a 'fix')...

First of all, I'm ignoring the amounts you allocated. For all I know, you really did count out the number of bytes that code will take up and tried to work with it assuming they'd be allocated on top of eachother.

Issue: You took out the 'jmp Return' and the 'label(Return)', but left the 'Return:' at the end of the hook(lingo, just look for the 'Return:') Unless you want it to popad then go straight to DoTele, you're messing up. (And, even if you want it to go straight to DoTele, there is a high probability that after that 'popad' is what I'll call 'blank code'. This can either be a series of 00 00 or numbers counting up(depends on the CE version) like 11 22 33 or 12 34 56, haha.) - which is NOT something you want your code to run into).

Issue: You alloc but don't dealloc. As you turn the script on and off, you're just taking up more and more memory.



and uh
"The second one would probably work fine"
WOULD NOT, LOL.

(Too much serious. Couldn't not do it.)

_________________


Mini Engine v3.0
Mipla v1.0

Reposted old threads out of the MS section.
Back to top
View user's profile Send private message
Drops
Advanced Cheater
Reputation: 0

Joined: 22 Feb 2008
Posts: 62

PostPosted: Tue Aug 12, 2008 7:51 am    Post subject: Reply with quote

My bad, I didn't look at it closely enough Sad I just noticed there was a section missing after I posted. Thanks for correcting me lol.
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Tue Aug 12, 2008 9:04 am    Post subject: Reply with quote

Uzeil wrote:
A label is just a place in code.

Here's my way of explaining it through the example above.

Code:
alloc(MouseTele,128)
label(TeleOn)
label(DoTele)
label(Normal)
label(Return)


This is all that says:
Make room for up to 128 bytes of code, starting with an address I'll refer to as MouseTele.
Understand that when I say TeleOn, I'm refering to the point in code where I say 'TeleOn:'
" " where I say 'DoTele:'
" " Normal:
" " Return:


I don't know what your 'home' language is, so I'm restricting what I say to English(by 'home' language I was referring to coding, not Spanish or anything).

Labels are just that, labels for a point in code(labels, names, placeholders, 'label' is an english word, not 'coder lingo' or anything alien).

As for your adjustment(notice I called it an adjustment, not a 'fix')...

First of all, I'm ignoring the amounts you allocated. For all I know, you really did count out the number of bytes that code will take up and tried to work with it assuming they'd be allocated on top of eachother.

Issue: You took out the 'jmp Return' and the 'label(Return)', but left the 'Return:' at the end of the hook(lingo, just look for the 'Return:') Unless you want it to popad then go straight to DoTele, you're messing up. (And, even if you want it to go straight to DoTele, there is a high probability that after that 'popad' is what I'll call 'blank code'. This can either be a series of 00 00 or numbers counting up(depends on the CE version) like 11 22 33 or 12 34 56, haha.) - which is NOT something you want your code to run into).

Issue: You alloc but don't dealloc. As you turn the script on and off, you're just taking up more and more memory.



and uh
"The second one would probably work fine"
WOULD NOT, LOL.

(Too much serious. Couldn't not do it.)


I know that. In my final dll vrsion I did correct the memory. BUt when I press the key to activate, It crashes maple without an error.

So... Can I replace Labels with alloc?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Tue Aug 12, 2008 10:11 am    Post subject: Reply with quote

Quote:
BUt when I press the key to activate, It crashes maple without an error.

That means the script executed properly, but WHAT the script does is wrong.

Are you sure 0073A27F , 00965B38 and 00965c88 are still the same ? (seeing you say you 'fixed' a script, but don't change addresses)

Also, your teleOn has no jmp return which causes to immediately go to DoTele, where it's ret8 will then jump to a random address that might have been on the stack and running undefined code

_________________
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
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Tue Aug 12, 2008 10:30 am    Post subject: Reply with quote

o... By jumping return do you mean that you jump to the code after where i cut the code off to init codecave?


Oh yea and. How do you calculate jumps?

I know one jump and that is (where u are)-(where u are going+5)
or something...

And where does jmp Return lead the code?
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Aug 12, 2008 10:43 am    Post subject: Reply with quote

When you intialize a code cave your breaking off the current code flow to a part you have allocated yourself.. from there you rewrite the instructions you overwrite and then jump back to the address after the codecave. If you dont jump back your code will be stuck wherever your allocated code left off in some random undefined spot. Which will lead to a crash.

using a label like

label(returnhere)

then after the address mod

0451505:
jmp mycodecave
returnhere:

also allows you to jump back like this

mycodecave:
//rewrite instructions
//do w/e else u wanna do
jmp returnhere

_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Tue Aug 12, 2008 11:09 am    Post subject: Reply with quote

Thanks I think I understand now.

So...
if I create a label:
label(asd)
and my codecave is at 00401000 (which is impossible)

Code:
alloc(cc,1024)

00401000:
jmp cc
asd:

cc:
blab blab blab
jmp asd


will make this
when program runs into 00401000 it jumps to cc.
after it finishes cc code it jumps back to 00401005 right?

Another attempt at fixing:

Code:
[Enable]
alloc(TeleOn,30)
alloc(DoTele,28)

TeleOn:
pushad
mov eax,[00965c88]
mov eax,[eax+978]
push [eax+88]
push [eax+84]
call DoTele
popad
jmp 73A285

DoTele:
push [esp+8]
push [esp+8]
mov eax,[00965B38]
mov eax,[eax+D38]
push eax
mov eax,[eax]
call [eax+40]
ret 8

0073A27F:
jmp TeleOn
nop

[disable]
dealloc(MouseTele)

0073A27F:
db 8B 80 B4 09 00 00
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