学习这个主要是为了提高分析反编译后的.net程序的能力。
代码:
.assembly PrintString{}
.method static public void main() il managed
{
.entrypoint //定义程序入口
.maxstack 8 //定义堆栈最大深度
ldstr "Hello, World!" //字符串参数压入堆栈
call void [mscorlib]System.Console::WriteLine(class System.String) //调用WriteLine方法
ret //返回
}
编辑器我用的是xaac.ide,编辑好代码后保存为hello.il文件。
在命令行下调用ilasm编译程序:ilasm /exe C:\hello.il
这样就能得到hello.exe文件了。在Visual Studio 命令提示下输入hello,回车即可运行程序,输出结果。
已经有(0)位网友发表了评论,你也评一评吧!
原创文章如转载,请注明:转载自Eddy Blog
原文地址:http://www.rrgod.com/program/90.html 欢迎订阅Eddy Blog。