Closed Meigyoku-Thmn closed 5 years ago
That's actually the role for the Deviare2 code instead. It has direct .net access, and will let you CreateProcess with a suspended mode. In-Proc is compatible with Deviare2, but for .net Deviare2 is a lot easier to use.
Edit: BTW, that error is just a generic error for .net runtimes not working correctly, you might try uninstalling and reinstalling.
Thanks for replying! So I will try out Deviare2 instead!
Suppose the target exe looks like this:
What I want to do is to hook the Console.WriteLine method right before the target has any chance to run "Main" method, so I tried to open process with HookLib.ProcessCreationFlags.CREATE_SUSPENDED flag:
Then I injected my C++ DLL which would load my C# DLL:
In my C# DLL, the code looks like this:
But everytime I run it, when I resume the target process, it just crashes with an error: "CLR error: 80004005. The program will now terminate."
So is there a way to suspend it at its Main method?