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 


.net c# not breaking on entrypoint

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

Joined: 20 Dec 2023
Posts: 1

PostPosted: Wed Dec 20, 2023 6:47 am    Post subject: .net c# not breaking on entrypoint Reply with quote

Hi all.

For a specific hack, I need to edit a const-value in memory before the program starts running.

I cannot hex-edit its value in the .exe, because the application has quite a complex amount of detection-mechanisms to detect modifications to the exe. For example, it calculates the MD5 hash of the executable and compares this hash to complex calculations of other file hashes.

My first success was accomplished using dnSpy. I launch the debugger and let int break on entrypoint. I search the memory for the specific string I need, I edit it and let the debugger continue. All works well.

However, I don't want to rely permanently on dnSpy so I was looking to program a launcher in CheatEngine.

First things first I thought, and I wrote this line of code to load up the exe but make it break on entrypoint.

Code:
createProcess("C:\\path\\file.exe",null,true,true)


Unfortunately, this does not work. The application just loads as it would when starting it through windows explorer

But when doing the same thing with the notepad.exe, it correctly halts on entrypoint

Code:
createProcess("C:\\Windows\\System32\\notepad.exe",null,true,true)


Anything I am missing?
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: Wed Dec 20, 2023 2:53 pm    Post subject: This post has 1 review(s) Reply with quote

.NET files have two different entrypoints, one of which CE's debugger is not designed to break on as far as I'm aware.

The 'break on entrypoint' flag passed to 'createProcess' is used to break on the general application entrypoint, which will be either a 'WinMain' or 'main' variant.
This does not break on the .NET defined entrypoint.

As an alternative, if you are familiar with writing code in C#, you can look into projects like Harmony or Mono.Cecil to write a .NET loader that can modify the program at runtime.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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