Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   How to Patch (IL Edit) of Assembles loaded from Resource (https://forum.exetools.com/showthread.php?t=20807)

th3tuga 01-12-2024 07:45

Quote:

Originally Posted by Gregory Morse (Post 129915)
I do not understand. Can someone explain with a simple example?

Dump the dll that is loaded from the resource, using DnSpy after it's loaded.
Then edit the dumped dll with your patches.
Remove the dll module initialize including the load statements from the exe.
Place the edited dll in the same folder with the exe and run. That's all.

I also use the nick Selya on some forums, since you cannot PM me here.
I respond only to known people though (no crack requests please).

cracki 01-13-2024 12:31

Quote:

Originally Posted by Levis (Post 129921)
Yes, all you need is to find a DLL or something that being called right before your target method, from the main executable, or any 3rd parties DLL,... then inject some small pieces of code to Reflective load your DLL into AppDomain, then you can do whatever you want, in this case, you're able to perform IL patch before the target method being called.
Remember that if your target is .NET Core, your hooking DLL must be .NET Core, too. Exact Runtime and exact version. For e.g, Target is .NET 6, then your code must be .NET 6, and so on.

If using function name is hard (when it's obfuscated), then you can try to resolve method using Method token. There is no big difference.

Thanks a lot for your guidance! The approach you suggested seems quite practical for my case :)

One other question:
How i can "resolve method using Method token" by HarmonyLib? is this possible?

Thanks again for the valuable insight!

Aakriti 01-13-2024 17:47

Quote:

Originally Posted by Levis (Post 129869)
In this case I think that you should write your own hooking program to dynamically patching the DLL during runtime. LibHarmony should make in-memory patching becomes easier. Just need to wait until the dll is loaded into memory and then call your patching module.

Using LibHarmony to create a custom hooking program for dynamic DLL patching is an efficient solution. This solution speeds the patching process by utilizing in-memory patching and waiting for DLL loading, hence increasing adaptability and runtime flexibility.

sendersu 01-14-2024 00:26

var method = AccessTools.TypeByName(typeName).Module.ResolveMethod(token);


All times are GMT +8. The time now is 01:01.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX