首页 > 学院 > 开发设计 > 正文

C#程序集系列02,使用记事本查看可执行程序集的IL代码

2019-11-17 02:54:05
字体:
来源:转载
供稿:网友

C#程序集系列02,使用记事本查看可执行程序集的IL代码

继续上一篇"C#程序集系列01,用记事本编写C#,IL代码,用DOS命令编译程序集,运行程序",在F盘的as文件夹中已经有了若干程序集。本篇体验使用记事本查看可执行程序集的IL代码。

→打开"VS2012开发人员命令提示",输入如下命令,并按回车8在as文件夹中多了1.txt和1.res这2个文件→输入如下命令打开1.txt9

//  Microsoft (R) .NET Framework IL Disassembler.  Version 4.0.30319.18020
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z/V.4..
  .ver 4:0:0:0
}
.assembly extern MyClass
{
  .ver 0:0:0:0
}
.assembly MainClass
{
  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
  .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
                                                                                                             63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.
  .hash algorithm 0x00008004
  .ver 0:0:0:0
}
.module MainClass.exe
// MVID: {73BA142E-F5C9-4C2E-8963-DB7213CB466A}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x00560000
// =============== CLASS MEMBERS DECLARATION ===================
.class PRivate auto ansi beforefieldinit MainClass
       extends [mscorlib]System.Object
{
  .method private hidebysig static void  Main() cil managed
  {
    .entrypoint
    // 代码大小       8 (0x8)
    .maxstack  8
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表