I'm trying to get the jmp opcode to work in Cil
jmp void ILTest.Program::MyFunc2(int32)
ilasm is fine with it, but when I run the program I always get "common language runtime detects an invalid program" exception.
I know this is unverifiable code so I have tried to give permissions
SecurityPermission perm =
new SecurityPermission(SecurityPermissionFlag.Execution |
SecurityPermissionFlag.SkipVerification |
SecurityPermissionFlag.UnmanagedCode);
but it does not seem to have any effect.
Has anyone got a program using 'jmp' working?
jmp can only jump to a method with the same arguments as the current method. Make sure you're already in a method taking an int32 as a parameter, and that you've nothing pushed on the stack: it must be empty. Also ensure you're not in a try/catch/filter/finally block.
If you can't meet those criteria, use a call instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With