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 


How to inject any dll in cetrainers with button ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
RecoXD
How do I cheat?
Reputation: 0

Joined: 26 Jul 2022
Posts: 8

PostPosted: Tue Jul 26, 2022 11:17 am    Post subject: How to inject any dll in cetrainers with button ? Reply with quote

i just made a cetrainer for a game, but i need to a button in trainer that injects
specific dll to cetrainer when you click the button

i added a basic cepanelbutton to trainer and added it this function:

Code:
function UDF1_CEPanel6Click(sender)
injectDLL([[c:\Users\%username%\Desktop\tabg\DLL.dll]])
end


but it doesnt work, am i doing it wrong?



( i tried to send screenshot but i dont have permission )
Back to top
View user's profile Send private message
RecoXD
How do I cheat?
Reputation: 0

Joined: 26 Jul 2022
Posts: 8

PostPosted: Wed Jul 27, 2022 2:52 am    Post subject: Reply with quote

50 views and no reply Sad

Okay, lets change question like that,

How can i write a lua script that auto injects a specific dll to itself when trainer starts
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Jul 27, 2022 3:21 am    Post subject: Reply with quote

wait until the process has fully started. If you try to inject a dll while it's still loading, it'll fail
_________________
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
RecoXD
How do I cheat?
Reputation: 0

Joined: 26 Jul 2022
Posts: 8

PostPosted: Wed Jul 27, 2022 6:48 am    Post subject: Reply with quote

Sad Sad Sad Sad Sad Sad

to be short, im using that method which called "access without real handle" this method allows me to read games memorry that normally not allowed cuz of game's A-C

(thats why i have to inject dll)


so to use that method i have to inject a dll to cheat engine or cetrainer or a exe that i generated from cheatengine..

what would you suggest I do?
( the point is im not injecting that dll to game, im injecting it to trainer which commands doing "detecting it self and injecting dll" how can i do it)

( by the way, is the code i wrote at the beginning correct? )
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1260

PostPosted: Wed Jul 27, 2022 7:00 am    Post subject: Reply with quote

From past memories. (Maybe it will give you a goal start to walk)

Dark Byte wrote:
Just create your own form and write the script that is usually automatically generated for you manually (The trainerscript generator is as it's name says, just a simple script generator based on the config you give)

Just make sure that your script when executed at least shows one form (CE picks the icon of the first visible form for the taskbar)

as for checking if a dll is injected try to keep track of that yourself (e.g a global variable that when injected is true)
also, it's not really a problem if a dll gets injected multiple times, loading a dll a second time just increases it's reference count

(alternatively, run an aa script that accesses a dll export and check if it fails or not)

You can add the dll as a tablefile which you can extract when loaded.
Code:

yourdllTF=findTableFile('yourdll.dll')
tablefile_saveToFile(yourdllTF, "Pathtodllextraction\\yourdll.dll")
injectdll("Pathtodllextraction\\yourdll.dll")

You can make use of getCheatEngineDir() if you wish to write it to the place CE's exe is

tip:
You can make use of [[ ]] as strings
e.g:
Code:

    autoAssemble([[
        globalalloc(tempfunc, 1024)
        tempfunc:
        mov eax, my_init
        call eax
        ret
    ]]);


as for
Quote:

I also want to check if this is BP when running a function in the DLL from Lua

No idea what you mean with BP (breakpoint?)

(tip2: No need to set eax to the address of my_init, you can directly call my_init)


Here is an example you should test;
Code:
newdllpath = getCheatEngineDir()..[[clibs64]] --or clibs32
--print(newdllpath)
mydll = "yourAddTableDLLname.dll"
findTableFile(mydll).saveToFile(newdllpath..'\\'..mydll)
injectdll(newdllpath..'\\'..mydll)
--loadlibrary(newdllpath..'\\'..mydll)

_________________
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
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Wed Jul 27, 2022 7:16 am    Post subject: Reply with quote

From the generated exe view, GetCheatEngineDir() <it end with \ >is its temporary root directory (not the installed cheat engine directory of the user).
So, if you include the dll in extra files while generating the trainer, the path to it should be,
GetCheatEngineDir()..[[DLL.dll]]

Also %username% will not automatic expand if you means it the os environment variable.

_________________
- Retarded.
Back to top
View user's profile Send private message
RecoXD
How do I cheat?
Reputation: 0

Joined: 26 Jul 2022
Posts: 8

PostPosted: Wed Jul 27, 2022 7:41 am    Post subject: Reply with quote

AylinCE
panraven

First of all, AylinCE if you are from turkish, can you explain me all this with Turkish language ? Or some social media like discord.. or i will try to do as much as i can in english version

(((( Here is my tag: recoxd#0088 if you cant contact me here empty server: gg/j4bgs6hbTk )))))



panraven yes i put dll to extra files, but how can i make it to inject dll to itself not the game. i have to inject dll the trainer (itself)
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Wed Jul 27, 2022 8:24 am    Post subject: This post has 1 review(s) Reply with quote

@"...make it to inject dll to itself not the game"
I'm not sure, but you may try attach ce to itself first then inject the dll, then attach to target process. (ie. "trainer" should be the ce~.exe and include files packed by your installed ce (a copy version), not user's installed ce )
<ADDED: if it is *.cetrainer but not *.exe then it should use user's ce, yet I'm not sure if there's no problem to inject dll to ce itself>
<ADDEDx2, ok it should be *.exe trainer that use "save as *exe" <not menu item "generate generic trainer...">, as "generic.." and *.cetrainer are not including extra files>
You can attach ce to itself by openProcess(getCheatEngineProcessID())

_________________
- Retarded.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1260

PostPosted: Wed Jul 27, 2022 9:15 am    Post subject: Reply with quote

TR = [ Bu yöntemi daha önce hiç kullanmadım. Verdiğim bilgi veya kodlar araştırma sonucudur. Daha fazla yarımcı olamıyorum. ]

EN = [ I think you can find more examples in the CEF search section.
https://forum.cheatengine.org/search.php ]

_________________
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
RecoXD
How do I cheat?
Reputation: 0

Joined: 26 Jul 2022
Posts: 8

PostPosted: Wed Jul 27, 2022 9:55 am    Post subject: Reply with quote

Discorddan felan biyerden ekran açsam yardımcı olsan olurmu tek istediğim cheat engineden buildliceğim exenin açılışta process olarak kendini seçip kendine dll injectlemesi :/ veya bir buton aracalığıyla
Back to top
View user's profile Send private message
RecoXD
How do I cheat?
Reputation: 0

Joined: 26 Jul 2022
Posts: 8

PostPosted: Thu Jul 28, 2022 5:22 am    Post subject: Panraven Reply with quote

Panraven

@panraven

according to what you said, then will this lua code work in exe?
(i added the dll.dll to extra files )


Code:
function UDF1_CEPanel6Click(sender)

openProcess(getCheatEngineProcessID())
GetCheatEngineDir()[[DLL.dll]]
injectDLL[[DLL.dll]]

end




( im bad at lua so please explain me all Sad )[/b]
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Thu Jul 28, 2022 9:46 am    Post subject: Reply with quote

Have you run the code? If there are error, the error message may be the hint to fix it.
Anyway, the .. in the expression GetCheatEngineDir()..[[DLL.dll]] is lua infix operator for string concatenation, to join 2 string to form a new string.
In this case it return the string of the full path to the dll files.

Now since you are attaching a dll to the trainer/ce, you don't need to wait/place the relevant code inside a button handle function.
They should be execute in very beginning code, directly.
For instance,
Code:

-- in the beginning lines
openProcess(getCheatEngineProcessID())
injectDLL( GetCheatEngineDir()..[[DLL.dll]])
... other code ...

_________________
- Retarded.
Back to top
View user's profile Send private message
RecoXD
How do I cheat?
Reputation: 0

Joined: 26 Jul 2022
Posts: 8

PostPosted: Thu Jul 28, 2022 12:01 pm    Post subject: Reply with quote

panraven
@panraven


can you help me very quick on discord please ?? Sad it will take only minutes please[/b]
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 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