IL Disassembler


One of the many handy tools that ships with Visual Studio is the IL Disassembler (ildasm.exe). It can be used to navigate the metadata within a module, including the types the module exposes, as well as their properties and methods. The IL Disassembler can also be used to display the IL contained within a module.

The IL Disassembler can be found under your installation directory for Visual Studio 2005; the default path is C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ILDasm.exe. Once the IL Disassembler has been started, select File image from book Open. Open mscorlib.dll, which is located in your system directory under the default path of C:\Windows\Microsoft.NET\Framework\V2.0.50727\mscorlib.dll. Once mscorlib.dll has been loaded, ILDasm will display a set of folders for each namespace in this assembly. Expand the System namespace, then the ValueType namespace, and finally double-click the Equals method. A window similar to the one shown in Figure 5-3 will be displayed.

image from book
Figure 5-3

Figure 5-3 shows the IL for the Equals method. Notice how the Reflection API is used to navigate through the instance of the value type’s fields in order to determine whether the values of the two objects being compared are equal.

The IL Disassembler is a useful tool for learning how a particular module is implemented, but it could jeopardize your company’s proprietary logic. After all, what’s to prevent someone from using it to reverse engineer your code? Fortunately, Visual Studio 2005, like Visual Studio 2003, ships with a third-party tool called an obfuscator. The role of the obfuscator is to ensure that the IL Disassembler cannot build a meaningful representation of your application logic.

A complete discussion of the obfuscator that ships with Visual Studio 2005 is beyond the scope of this chapter, but to access this tool, select the Tools menu and choose Dotfuscator Community Edition. The obfuscator runs against your compiled application, taking your IL file and stripping out many of the items that are embedded by default during the compilation process.




Professional VB 2005 with. NET 3. 0
Professional VB 2005 with .NET 3.0 (Programmer to Programmer)
ISBN: 0470124709
EAN: 2147483647
Year: 2004
Pages: 267

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net