simontardif / managedhook

Managed Hook allows you to hook any methods with a handler that is called before and after the hooked method is called.
Apache License 2.0
6 stars 3 forks source link

Add support for x86 #4

Open emlinhax opened 2 years ago

simontardif commented 2 years ago

I'm still debugging this change :) there is an issue with internal or private struct type used in a method. it's not your change, it's something I'm doing wrong on how to handle this case I convert the type as an object, so the method signature is not the same, and this hack seemed to work in x64 but not for x86 process. (apparently only struct has this issue) I investigate a way to change my approach for internal or private types. Maybe by using C# DynamicMethod instead of compiling a script would work. That way, I would have exactly the same signature.

this hack: https://github.com/simontardif/managedhook/blob/master/ManagedHook/Hook.cs#L301

emlinhax commented 2 years ago

Using a DynamicMethod sounds like the best idea honestly. Using CSharpCompiler at runtime is kinda hacky.