clr_assembler/program/legacy.rs
1/// Legacy CLR header structure for backward compatibility.
2#[derive(Copy, Debug, Clone)]
3pub struct ClrHeader {
4 /// The total size of the header in bytes.
5 pub cb: u32,
6 /// The major version of the CLR runtime.
7 pub major_runtime_version: u16,
8 /// The minor version of the CLR runtime.
9 pub minor_runtime_version: u16,
10 /// The relative virtual address of the metadata.
11 pub metadata_rva: u32,
12 /// The size of the metadata in bytes.
13 pub metadata_size: u32,
14 /// Assembly flags, such as whether it is pure IL code.
15 pub flags: u32,
16}
17
18/// Legacy metadata header structure for backward compatibility.
19#[derive(Debug, Clone)]
20pub struct MetadataHeader {
21 /// The magic number, typically 0x424A5342 (BSJB).
22 pub signature: u32,
23 /// The major version of the metadata format.
24 pub major_version: u16,
25 /// The minor version of the metadata format.
26 pub minor_version: u16,
27 /// Reserved field, typically 0.
28 pub reserved: u32,
29 /// The length of the runtime version string.
30 pub version_length: u32,
31 /// The runtime version string content.
32 pub version_string: String,
33 /// Metadata flags.
34 pub flags: u16,
35 /// The number of metadata streams.
36 pub streams: u16,
37}
38
39/// Legacy stream header structure for backward compatibility.
40#[derive(Debug, Clone)]
41pub struct StreamHeader {
42 /// The offset of this stream in the metadata.
43 pub offset: u32,
44 /// The size of the stream in bytes.
45 pub size: u32,
46 /// The name of the stream, such as "#Strings", "#US", "#GUID", "#Blob".
47 pub name: String,
48}
49
50/// Legacy .NET assembly information for backward compatibility.
51#[derive(Debug, Clone)]
52pub struct DotNetAssemblyInfo {
53 /// The assembly name.
54 pub name: String,
55 /// The version number in format major.minor.build.revision.
56 pub version: String,
57 /// The culture information, such as "en-US"; null indicates neutral culture.
58 pub culture: Option<String>,
59 /// The public key token for strong name verification.
60 pub public_key_token: Option<String>,
61 /// The .NET runtime version, such as "v4.0.30319".
62 pub runtime_version: Option<String>,
63}