Looking at this text dump of a .NET PE file, you can see that a PE file starts off with the MS-DOS/COFF header, which all Windows programs must include. Following this header, you will find the PE header that supports Windows 32-bit programs. Immediately after the PE headers, you can find the code section for this program. The raw data (RAW DATA #1) of this section stores the CLR header, as follows:
RAW DATA #1 . . . clr Header: /* CLR HEADER */ 48 cb 2.00 runtime version 207C [ 214] RVA [size] of MetaData Directory 1 flags 6000001 entry point token 0 [ 0] RVA [size] of Resources Directory 0 [ 0] RVA [size] of StrongNameSignature Directory 0 [ 0] RVA [size] of CodeManagerTable Directory 0 [ 0] RVA [size] of VTableFixups Directory 0 [ 0] RVA [size] of ExportAddressTableJumps Directory
Section contains the following imports: mscoree.dll . . . 0 _CorExeMain . . .As mentioned earlier, the CLR header holds a number of pertinent details required by the runtime, including:
Runtime version Indicates the runtime version that is required to run this program
MetaData directory Is important because it indicates the location of the metadata needed by the CLR at runtime
Entry point token Is even more important because, for a single file assembly, this is the token that signifies the entry point, such as Main( ), that the CLR executes
Below the CLR Header, note that there is an imported function called _CorExeMain, which is implemented by mscoree.dll, the core execution engine of the CLR.[2] At the time of this writing, Windows 98, 2000, and Me have an OS loader that knows how to load standard PE files. To prevent massive changes to these operating systems and still allow .NET applications to run on them, Microsoft has updated the OS loaders for all these platforms. The updated loaders know how to check for the CLR header, and, if this header exists, it executes _CorExeMain, thus not only jumpstarting the CLR but also surrendering to it. You can then guess that the CLR will call Main( ), since it can find the entry point token within the CLR header.[3]
The common language runtime can either run garbage collection concurrently on a separate thread or on the same thread as the application. Use the
A delegate is a data structure that refers to a static method or to an object instance and an instance method ofthat object.
A component container is a specialized class that acts as a means of organizing and containing components. Through a container you can track your components, communicate with them via the Site that hosts the component, and provide a means of common disposal after they are no longer needed.
No comments:
Post a Comment