1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! Process model for .NET emulation.
//!
//! This module provides the process-based abstraction for .NET emulation,
//! including configuration, process building, and execution management.
//! It serves as the high-level interface for setting up and running
//! emulation sessions.
//!
//! # Overview
//!
//! The process module organizes emulation around an [`EmulationProcess`],
//! which represents a single emulated .NET process with its own:
//!
//! - Address space (memory regions, PE images)
//! - Runtime state (method stubs, type information)
//! - Capture context (for collecting extracted data)
//! - Configuration (limits, behavior settings)
//!
//! # Key Components
//!
//! - [`ProcessBuilder`] - Fluent API for configuring and creating processes
//! - [`EmulationProcess`] - Central orchestrator for emulation execution
//! - [`EmulationConfig`] - Comprehensive configuration with presets
//! - [`CaptureConfig`] - Configuration for runtime data capture
//! - [`EmulationLimits`] - Resource and execution limits
//!
//! # Workflow
//!
//! The typical workflow for using this module is:
//!
//! 1. Create a [`ProcessBuilder`]
//! 2. Configure the builder with assembly, mappings, and settings
//! 3. Call [`build()`](ProcessBuilder::build) to create an [`EmulationProcess`]
//! 4. Execute methods using [`execute_method()`](EmulationProcess::execute_method)
//! 5. Retrieve captured data after execution
//!
//! # Example
//!
//! ```rust,no_run
//! use dotscope::emulation::{ProcessBuilder, EmulationConfig};
//! use dotscope::CilObject;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Load the target assembly
//! let assembly = CilObject::from_path("packed.exe")?;
//!
//! // Build the emulation process
//! let process = ProcessBuilder::new()
//! .assembly(assembly)
//! .for_extraction()
//! .capture_assemblies()
//! .capture_strings()
//! .build()?;
//!
//! // Find and execute the entry point
//! if let Some(entry_point) = process.find_entry_point() {
//! let outcome = process.execute_method(entry_point, vec![])?;
//! println!("Execution completed: {:?}", outcome);
//! }
//!
//! // Retrieve captured assemblies
//! for asm in process.captured_assemblies() {
//! println!("Captured assembly: {} bytes", asm.data.len());
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Configuration Presets
//!
//! The module provides preset configurations for common scenarios:
//!
//! - [`EmulationConfig::extraction()`] - For unpacking protected assemblies
//! - [`EmulationConfig::analysis()`] - For static analysis with symbolic tracking
//! - [`EmulationConfig::full()`] - For complete emulation with strict mode
//! - [`EmulationConfig::minimal()`] - For simple constant folding
//!
//! # See Also
//!
//! - [`crate::emulation::engine`] - Low-level execution engine
//! - [`crate::emulation::memory`] - Memory subsystem
//! - [`crate::emulation::stubs`] - Method stub implementations
pub use ProcessBuilder;
pub use ;
pub use ;