用Reflector反編譯的問題

來源:互聯網
上載者:User
建立了一個winform工程,名為TestIL,包含一個表單Form1,編譯產生exe檔案,使用Reflector反編譯Form1的Main函數,代碼如下:
.method private hidebysig static void Main() cil managed{      .custom instance  void [mscorlib]System.STAThreadAttribute::.ctor()      // Code Size: 11 byte(s)      .maxstack 1      L_0000: newobj instance  void TestIL.Form1::.ctor()      L_0005: call void [System.Windows.Forms]System.Windows.Forms.
Application::Run([System.Windows.Forms]System.Windows.Forms.Form) L_000a: ret }
又使用ILDASM反編譯相同的函數,代碼如下:






.method private hidebysig static void  Main() cil managed
{
  .entrypoint //注意這個
  .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() =
( 01 00 00 00 )
  // 代碼大小       11 (0xb)
  .maxstack  1
  IL_0000:  newobj     instance void TestIL.Form1::.ctor()
  IL_0005:  call       void [System.Windows.Forms]System.Windows.Forms.
Application::Run(class [System.Windows.Forms]System.Windows.Forms.Form)
  IL_000a:  ret
} // end of method Form1::Main






















Reflector反編譯的代碼沒有.entrypoint,由於才開始接觸這方面的知識,
在《Inside MICROSOFT .NET IL Assembler》(電子版)
中找到對.entrypoint的說明:


.entrypoint identifies the current method as the entry point of the
application (the assembly). Each managed EXE file must have a single
entry point.The ILAsm compiler will refuse to compile a module without
a specified entry point, unless you use the /DLL command-line option.


看來還是.net內建的工具保險些

不知是否有其他原因,還請大家指教

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.