Expand description
§clrmeta
ECMA-335 CLI/.NET metadata parsing library with read/write support.
This crate provides functionality to parse, modify, and write CLR metadata from .NET assemblies. It works with raw metadata bytes, making it PE-agnostic and suitable for use with any PE parser.
§Features
- Parse BSJB metadata root and stream headers
- Access heaps: #Strings, #US, #GUID, #Blob
- Parse metadata tables: Module, TypeDef, TypeRef, MethodDef, Assembly, AssemblyRef, etc.
- Modify metadata structures
- Write metadata back to bytes
§Example
ⓘ
use clrmeta::Metadata;
// Parse metadata from raw bytes
let metadata = Metadata::parse(&metadata_bytes)?;
println!("Runtime version: {}", metadata.version());
if let Some(assembly) = metadata.assembly() {
println!("Assembly: {} v{}.{}.{}.{}",
assembly.name,
assembly.version.0, assembly.version.1,
assembly.version.2, assembly.version.3);
}
// Modify and write back
let modified_bytes = metadata.write();Re-exports§
pub use error::Error;pub use error::Result;pub use metadata::AssemblyInfo;pub use metadata::AssemblyRefInfo;pub use metadata::Metadata;pub use metadata::MethodInfo;pub use metadata::ResolvedType;pub use metadata::TypeInfo;pub use root::MetadataRoot;pub use stream::StreamHeader;pub use heaps::BlobHeap;pub use heaps::GuidHeap;pub use heaps::StringsHeap;pub use heaps::UserStringsHeap;pub use tables::CodedIndex;pub use tables::CodedIndexKind;pub use tables::TableId;pub use tables::TablesHeader;pub use tables::AssemblyRefRow;pub use tables::AssemblyRow;pub use tables::ClassLayoutRow;pub use tables::ConstantRow;pub use tables::CustomAttributeRow;pub use tables::DeclSecurityRow;pub use tables::EncLogRow;pub use tables::EncMapRow;pub use tables::EventMapRow;pub use tables::EventPtrRow;pub use tables::EventRow;pub use tables::FieldLayoutRow;pub use tables::FieldMarshalRow;pub use tables::FieldPtrRow;pub use tables::FieldRow;pub use tables::FieldRvaRow;pub use tables::GenericParamConstraintRow;pub use tables::GenericParamRow;pub use tables::ImplMapRow;pub use tables::InterfaceImplRow;pub use tables::MemberRefRow;pub use tables::MethodDefRow;pub use tables::MethodImplRow;pub use tables::MethodPtrRow;pub use tables::MethodSemanticsRow;pub use tables::MethodSpecRow;pub use tables::ModuleRefRow;pub use tables::ModuleRow;pub use tables::NestedClassRow;pub use tables::ParamPtrRow;pub use tables::ParamRow;pub use tables::PropertyMapRow;pub use tables::PropertyPtrRow;pub use tables::PropertyRow;pub use tables::StandAloneSigRow;pub use tables::TypeDefRow;pub use tables::TypeRefRow;pub use tables::TypeSpecRow;pub use signature::CallingConvention;pub use signature::ElementType;pub use signature::FieldSig;pub use signature::LocalVarSig;pub use signature::MethodSig;pub use signature::PropertySig;pub use signature::TypeSig;
Modules§
- crypto
- Cryptographic utilities for CLR metadata.
- error
- Error types for clrmeta.
- heaps
- Metadata heaps: #Strings, #US, #GUID, #Blob.
- metadata
- High-level metadata API.
- reader
- Binary reader for parsing metadata structures.
- root
- Metadata root (BSJB header) parsing and writing.
- signature
- Signature parsing for method, field, and property signatures.
- stream
- Metadata stream header parsing and writing.
- tables
- Metadata tables parsing and writing.
- writer
- Binary writer for serializing metadata structures.