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 


autoAssemble lua function fails to execute

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
yazigegeda
Expert Cheater
Reputation: 0

Joined: 22 Jan 2019
Posts: 183

PostPosted: Tue Jul 02, 2024 5:19 am    Post subject: autoAssemble lua function fails to execute Reply with quote

Code:



[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat

{$lua}
autoAssemble([[
alloc(newmem,1024,ntdll.dll)
label(title)
label(text)
newmem:
sub rsp,68
mov r9,0
lea r8,[title]
lea rdx,[text]
xor rcx,rcx
call MessageBoxA
add rsp,68
ret

title:
db 'hello',0

text:
db 'text',0
createthread(newmem)
]],true)
 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat





I am using cheat engine 7.5 and this assembly instruction was successfully executed by the attached process, but I wanted to execute it on the ce itself, but no popups popped up after I executed it. Is this a bug? Help me

:cry:
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1528

PostPosted: Tue Jul 02, 2024 6:47 am    Post subject: Reply with quote

Do you think the application is correct?
Code:
alloc(newmem,1024,ntdll.dll)


ntdll.dll ?

Library: User32.lib
DLL: User32.dll

Source:
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox

This might be more useful:

Code:
[ENABLE]

{$lua}
if syntaxcheck then return end
function MessageBox(title,text,uType)
 return executeCodeLocalEx("user32.MessageBoxA", MainForm.Handle, text, title, uType)
end

aa1 = MessageBox("The title", "the text", 3)

{$asm}
[DISABLE]

{$lua}
if syntaxcheck then return end
 showMessage("select: "..aa1)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
yazigegeda
Expert Cheater
Reputation: 0

Joined: 22 Jan 2019
Posts: 183

PostPosted: Tue Jul 02, 2024 6:54 am    Post subject: Reply with quote

AylinCE wrote:
Do you think the application is correct?
Code:
alloc(newmem,1024,ntdll.dll)


ntdll.dll ?

Library: User32.lib
DLL: User32.dll

Source:
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox

This might be more useful:

Code:
[ENABLE]

{$lua}
if syntaxcheck then return end
function MessageBox(title,text,uType)
 return executeCodeLocalEx("user32.MessageBoxA", MainForm.Handle, text, title, uType)
end

aa1 = MessageBox("The title", "the text", 3)

{$asm}
[DISABLE]

{$lua}
if syntaxcheck then return end
 showMessage("select: "..aa1)



Thank you for your reply. First of all, there was no problem when I used cheat engine 7.1 and the older version 6.4, and I could popup normally, but I couldn't use 7.4 and 7.5, I don't know why
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1528

PostPosted: Tue Jul 02, 2024 7:21 am    Post subject: Reply with quote

Reasons;
In cases related to Cheat Engine:
Development, Update-related changes, additions or changed syntax, etc.

In Windows related cases:

Again, attachments or library contents that have changed, been deprecated, moved to another program, DLL or syntax, etc.

Also, are you sure that "ntdll.dll" still works in 7.1 and 6.+?

You can test the example I gave in any version on 6+.

And whatever the result you want to do or get with this code, I recommend you focus on it and produce a solution.

Remember; Latest versions of CE allow you to use all-encompassing features.
However, older versions exist to use certain features and this certainly does not include updates to Lua syntaxes. Wink

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
yazigegeda
Expert Cheater
Reputation: 0

Joined: 22 Jan 2019
Posts: 183

PostPosted: Tue Jul 02, 2024 7:43 am    Post subject: Reply with quote

AylinCE wrote:
Reasons;
In cases related to Cheat Engine:
Development, Update-related changes, additions or changed syntax, etc.

In Windows related cases:

Again, attachments or library contents that have changed, been deprecated, moved to another program, DLL or syntax, etc.

Also, are you sure that "ntdll.dll" still works in 7.1 and 6.+?

You can test the example I gave in any version on 6+.

And whatever the result you want to do or get with this code, I recommend you focus on it and produce a solution.

Remember; Latest versions of CE allow you to use all-encompassing features.
However, older versions exist to use certain features and this certainly does not include updates to Lua syntaxes. ;)



Because my requirements need to be allocated on the ntdll address, I remove ntdll: alloc(newmem,1024), this works, but I want to allocate alloc(newmem,1024, ntDl.dll) above the ntdll address and it will not be executed. Yes, all versions except 7.4 and 7.5 seem to work fine
:cry:
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4706

PostPosted: Tue Jul 02, 2024 11:43 am    Post subject: Reply with quote

If "MessageBoxA" symbol lookup works, try that instead
Code:
alloc(newmem,1024,MessageBoxA)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
yazigegeda
Expert Cheater
Reputation: 0

Joined: 22 Jan 2019
Posts: 183

PostPosted: Tue Jul 02, 2024 7:45 pm    Post subject: Reply with quote

ParkourPenguin wrote:
If "MessageBoxA" symbol lookup works, try that instead
Code:
alloc(newmem,1024,MessageBoxA)




Thank you! He can work normally
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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