Jump to content
Tuts 4 You
Sign in to follow this  
Perplex

Added instruction without operand in dnlib

Recommended Posts

Perplex

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

Edited by Perplex (see edit history)

Share this post


Link to post
CodeExplorer

No it's not posible!
And why you want call witouth operand from first place?
 

  • Like 1

Share this post


Link to post
Perplex

I wanted add invalid instruction to for each mehod.

Share this post


Link to post
A200K
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 (see edit history)

Share this post


Link to post

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
Sign in to follow this  
×
×
  • Create New...