Jump to content
Tuts 4 You

Added instruction without operand in dnlib


Recommended Posts

How to add instruction without operand in dnlib, For example I wanted add Call opcode without operand, Is it possible?

Edited by Perplex
Link to comment
8 hours ago, Perplex said:

I wanted add invalid instruction to for each mehod.

IL code is compiled to native asm code on runtime, and even if you would just jump over this "invalid" instruction, the .net runtime wouldn't know how to parse this, causing your program to crash.


You'd have to remove this instruction before you call this function.


Otherwise, if you want, just try and see for yourself

method.Body.Instructions.Add( OpCodes.Call.ToInstruction( ) );

Edited by A200K
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...