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

Set an operand to MessageBox.Show()?

Recommended Posts

MindSystem

Hi, i want to set an operand to MessageBox.Show("test");

But when i debug, using this code : 

method.Body.Instructions.Insert(0, Instruction.Create(OpCodes.Ldstr, "test"));
                            object a = MessageBox.Show(method.Body.Instructions[0].Operand.ToString());
                            method.Body.Instructions.Insert(1, Instruction.Create(OpCodes.Nop));
                            method.Body.Instructions.OpCode = OpCodes.Call;
                            method.Body.Instructions.Operand = a; 

(Yeah the code is strange haha)

So, when i debug using this code, it shows messagebox unlimited...;

My Question is : how to set an operand to MessageBox.Show without get messagebox?


Thanks you ;)

Share this post


Link to post
XenocodeRCE

Create a new projet & on button1_click event put a M'essagebox show' then build it up and then decompile it. You will see what's missing from your code

Edited by XenocodeRCE (see edit history)
  • Like 1

Share this post


Link to post
MindSystem
2 hours ago, XenocodeRCE said:

Create a new projet & on button1_click event put a M'essagebox show' then build it up and then decompile it. You will see what's missing from your code

Yeah, i forgot the "pop" opcode 

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...