MSIL代码问题

Tho*_*mas 2 .net cil

我试图通过ildassemble和修改MSIL代码来修改程序集(我的).我只想弹出一个MessageBox.

这是我的代码:

.module extern Fusion.dll

.module extern kernel32.dll

.module extern advapi32.dll

.module extern aspnet_state.exe

.module extern webengine.dll

.module extern aspnet_wp.exe

.module extern mscorwks.dll

.module extern ole32.dll

.module extern mscoree.dll

.module extern Netapi32.dll

.assembly extern mscorlib

{

...

...

IL_0052: ldstr "ahahahahahah"

IL_0057: callvirt instance [mscorlib]System.Windows.Forms.MessageBox::Show(string)

IL_005c: ldloc.0

IL_005d: ret

} // end of method

...

我没有错误,但MessageBox没有出现:\

谢谢你的帮助!

And*_*rey 6

应该

  ldstr "ahahahahahah"
  call valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
  pop
  ret
Run Code Online (Sandbox Code Playgroud)

顺便说一句,MessageBox不应该在Web应用程序中工作,因为它与桌面用户交互

您的代码有什么问题:

callvirt instance [mscorlib]System.Windows.Forms.MessageBox::Show(string)
Run Code Online (Sandbox Code Playgroud)
  1. 显示是静态方法.所以它应该被称为a)与callb)没有instance
  2. MessageBox在System.Windows.Forms,而不在mscorlib
  3. 你应该指定结果类型,它实际上是DialogResult
  4. 你应该得到pop结果,因为你不需要它