Metadata and PE file structure

Source: Internet
Author: User

Metadata is stored in one area of the PE file, while msil is stored in another area of the PE file. The metadata section contains a series of tables and heaps. The msil part contains the Il language and metadata tags that point to a row of a table in the metadata part or to a heap.
Metadata table and heap
A metadata table contains various information about a program, such as a table that describes various classes in the program, and another table that describes fields in various classes. If there are 10 classes in your code, there will be 10 rows in the class table, each row corresponds to a class. At the same time, the class table also references other tables and heaps. For example, the class Table references the method definition table.
Metadata also stores information in the heap structure. There are four heap structures: String, blob, user string, and guid. All strings used for Naming types and members are stored in the String Heap. For example, a method table does not store the name of a method directly, but instead points a pointer to the place where the method name is stored in the String Heap.
Metadata ID:
The metadata identifiers in msil are unique and point to a row in a specific metadata table. Each metadata representation is a 4-byte number. The first byte is used to describe which table points to the metadata, and the last three bytes are used to indicate which row points to the table, that is, the offset in the table. For example, if the number of the method definition table is 0x06, 0x06000004 points to the fourth row of the method definition table.
Metadata in the PE file:
After a C # program is compiled, a PE file is generated, which contains three parts. The following table describes the content of each part:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.