프로그래밍/C# & .NET

ildasm (C# 디컴파일러)

Terry Cho 2010. 5. 10. 17:07

C#에도 자바의 JAD와 비슷하게 디컴파일툴이 있는데,
ildasm.exe라는 도구이다.

*.exe 파일을 ildasm을 통해서 디컴파일 해보면 어셈블리코드로 대략 어떤 작업을 하고 있는지 볼 수 있다. (Reverse engineering할때 유용할듯)

사용방법은
프로그램 > 시작 > Visual Studio Folder > Visual Studio Command Prompt를 실행한 후
ildasm 을 치면 GUI 툴이 뜬다.

파일메뉴에서 EXE 파일을 열면 된다.
보고싶은 메서드를 더블 클릭하면 어셈블리 코드를 보여준다.
아래는 간단한 HelloWorld.cs를 디어셈블해본 내용

HelloWorld.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            String str = Console.ReadLine();

            Console.WriteLine("Hello :"+str);
        }
    }

}

디어셈블한 결과


.method private hidebysig static void  Main(string[] args) cil managed
{
  .entrypoint
  // Code size       25 (0x19)
  .maxstack  2
  .locals init ([0] string str)
  IL_0000:  nop
  IL_0001:  call       string [mscorlib]System.Console::ReadLine()
  IL_0006:  stloc.0
  IL_0007:  ldstr      "Hello :"
  IL_000c:  ldloc.0
  IL_000d:  call       string [mscorlib]System.String::Concat(string,
                                                              string)
  IL_0012:  call       void [mscorlib]System.Console::WriteLine(string)
  IL_0017:  nop
  IL_0018:  ret
} // end of method Program::Main


 


그리드형

'프로그래밍 > C# & .NET' 카테고리의 다른 글

CLR 메모리 구조 (노트)  (0) 2010.05.12
자바개발자가 본 .NET 프레임웍  (0) 2010.05.11
ApplicationDomain  (0) 2010.05.11
Microsoft Sync Framework (MSF)  (1) 2010.05.10
C# 책 추천 부탁합니다.  (4) 2010.05.06