Skip to main content

DllReader

Struct DllReader 

Source
pub struct DllReader<'config, R> { /* private fields */ }

Implementations§

Source§

impl<'config, R> DllReader<'config, R>

Source

pub fn new(reader: R, options: &'config DllReadConfig) -> Self

Constructs a .NET reader (DLL) using a generic PE reader.

Note: This is a lazy constructor and will not immediately execute the parsing workflow.

Source§

impl<'config, R> DllReader<'config, R>
where R: Read + Seek,

Source

pub fn get_assembly_info(&mut self) -> Result<DotNetAssemblyInfo, GaiaError>

Lazily reads basic assembly information.

Only reads basic identification information of the assembly without parsing the full type system. Suitable for scenarios where you need to quickly get assembly name, version, etc.

§Returns
  • Ok(DotNetAssemblyInfo) - Basic assembly information.
  • Err(GaiaError) - Error during the reading process.
Source

pub fn to_clr_program(&mut self) -> Result<ClrProgram, GaiaError>

Parses as a full CLR program.

Parses the entire .NET assembly, including all types, methods, fields, and other information. This is a heavyweight operation that consumes significant memory and time.

§Returns
  • Ok(ClrProgram) - Full representation of the CLR program.
  • Err(GaiaError) - Error during the parsing process.
Source

pub fn validate_assembly(&mut self) -> Result<Vec<String>, GaiaError>

Validates the integrity of the assembly.

Checks if the parsed .NET assembly contains all required components:

  • CLR Header: Contains runtime information.
  • Metadata Header: Describes the type system.
  • Metadata Streams: Contains the actual metadata.
§Returns
  • Ok(Vec<String>) - List of warning messages; an empty list indicates validation success.
  • Err(GaiaError) - Error during the validation process.
Source

pub fn get_assembly_summary(&mut self) -> String

Gets a summary of the assembly information.

Returns the basic information of the assembly in a friendly format, suitable for display or logging. If the assembly information is unavailable, it returns a corresponding error message.

§Returns
  • String - Formatted assembly information containing name, version, culture, public key token, and runtime version.

Trait Implementations§

Source§

impl<'config, R: Debug> Debug for DllReader<'config, R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'config, R: Read + Seek> PeReader<R> for DllReader<'config, R>

Source§

fn get_viewer(&mut self) -> &mut R

Get a mutable reference to the binary reader
Source§

fn add_diagnostics(&mut self, error: impl Into<GaiaError>)

Get a mutable reference to diagnostics information
Source§

fn get_section_headers(&mut self) -> Result<&[SectionHeader], GaiaError>

Get cached section headers
Source§

fn get_pe_header(&mut self) -> Result<&PeHeader, GaiaError>

Read PE header information (generic implementation)
Source§

fn get_program(&mut self) -> Result<&PeProgram, GaiaError>

Force read full PeProgram and cache the result
Source§

fn get_position(&mut self) -> Result<u64, GaiaError>
where R: Seek,

Source§

fn set_position(&mut self, offset: u64) -> Result<u64, GaiaError>
where R: Seek,

Source§

fn rva_to_file_offset( &self, rva: u32, sections: &[PeSection], ) -> Result<u32, GaiaError>

Convert RVA to file offset (generic implementation)
Source§

fn parse_import_table( &mut self, header: &PeHeader, sections: &[PeSection], ) -> Result<ImportTable, GaiaError>

Parse import table (generic implementation)
Source§

fn parse_export_table( &mut self, header: &PeHeader, sections: &[PeSection], ) -> Result<ExportTable, GaiaError>

Parse export table (generic implementation)
Source§

fn create_pe_info(&mut self) -> Result<PeInfo, GaiaError>

Create PE info view (generic implementation)

Auto Trait Implementations§

§

impl<'config, R> Freeze for DllReader<'config, R>
where R: Freeze,

§

impl<'config, R> !RefUnwindSafe for DllReader<'config, R>

§

impl<'config, R> Send for DllReader<'config, R>
where R: Send,

§

impl<'config, R> Sync for DllReader<'config, R>
where R: Sync,

§

impl<'config, R> Unpin for DllReader<'config, R>
where R: Unpin,

§

impl<'config, R> UnsafeUnpin for DllReader<'config, R>
where R: UnsafeUnpin,

§

impl<'config, R> !UnwindSafe for DllReader<'config, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more