|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Dr.Disrespect Grandmaster Cheater Reputation: 3
Joined: 17 Feb 2016 Posts: 526
|
Posted: Tue Apr 26, 2016 7:52 pm Post subject: Is there a way to show a message from asm? |
|
|
Sorry for the misleading title, I don't know how to define my question. But here is what I want to do, I want to make my trainer show a message box, such as "gold has been increased", and I want to code in ASM, not in Lua, which has the "showMessage" function. How to do that? Is it possible? |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4299
|
Posted: Tue Apr 26, 2016 8:43 pm Post subject: |
|
|
The easiest way I can think of is to use the MessageBox function:
Code: | globalalloc(derp,2048)
label(caption)
label(text)
createthread(derp)
derp:
push 0
push caption
push text
push 0
call USER32.MessageBoxA
ret
db CC CC CC CC
caption:
db 'Cheat Activated',0
text:
db 'Gold has been increased!',0 |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Dr.Disrespect Grandmaster Cheater Reputation: 3
Joined: 17 Feb 2016 Posts: 526
|
Posted: Tue Apr 26, 2016 10:08 pm Post subject: |
|
|
ParkourPenguin wrote: | The easiest way I can think of is to use the MessageBox function:
Code: | globalalloc(derp,2048)
label(caption)
label(text)
createthread(derp)
derp:
push 0
push caption
push text
push 0
call USER32.MessageBoxA
ret
db CC CC CC CC
caption:
db 'Cheat Activated',0
text:
db 'Gold has been increased!',0 |
|
Thanks a lot, Penguin.
I suppose I can use eax instead of "text", right? So I can display the value of eax to the user. BTW, why push two 0s? Is it because messagebox function has four parameters?
Code: |
push 0
push caption
push eax <-------------------can I do this?
push 0
call .....
|
Edit:
One more question: why use this after calling "USER32.MessageBoxA":
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4299
|
Posted: Tue Apr 26, 2016 10:35 pm Post subject: |
|
|
If eax points to a string, then yes. Otherwise, no. If eax contains a number you want to display, you'll need a string representation of that number. If you can find some library function which converts an integer to a string, great. If not, then you'll have to implement that yourself.
Yes, the MessageBox function has four parameters. Look at the documentation I linked to for more information.
That db CC... is a sequence of int3 instructions I use to distinguish executable code from the data it uses. It's not needed, but it's helpful when viewing that memory in the disassembler to tell what's meant to be executable code and what's not. I also sometimes use that to align the data on a 4-byte or 8-byte boundary, but that doesn't really matter that much in this case. _________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Dr.Disrespect Grandmaster Cheater Reputation: 3
Joined: 17 Feb 2016 Posts: 526
|
Posted: Wed Apr 27, 2016 12:35 pm Post subject: |
|
|
ParkourPenguin wrote: | If eax points to a string, then yes. Otherwise, no. If eax contains a number you want to display, you'll need a string representation of that number. If you can find some library function which converts an integer to a string, great. If not, then you'll have to implement that yourself.
Yes, the MessageBox function has four parameters. Look at the documentation I linked to for more information.
That db CC... is a sequence of int3 instructions I use to distinguish executable code from the data it uses. It's not needed, but it's helpful when viewing that memory in the disassembler to tell what's meant to be executable code and what's not. I also sometimes use that to align the data on a 4-byte or 8-byte boundary, but that doesn't really matter that much in this case. |
Sorry for the late reply, Penguin. Thank you so much. |
|
Back to top |
|
|
|
|
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
|
|