visualbasic/lib.rs
1//! Parse and inspect Visual Basic 6 compiled binaries.
2//!
3//! This crate provides typed access to all internal structures within a
4//! VB6 compiled executable, from the PE entry point down to individual
5//! P-Code bytecode instructions.
6//!
7//! # Quick Start
8//!
9//! ```no_run
10//! use visualbasic::VbProject;
11//!
12//! let file_bytes = std::fs::read("sample.exe").unwrap();
13//! let project = VbProject::from_bytes(&file_bytes).unwrap();
14//!
15//! println!("Objects: {}", project.object_count());
16//! for obj in project.objects() {
17//! let obj = obj.unwrap();
18//! println!(" Object: {:?}", obj.name());
19//! }
20//! ```
21//!
22//! # Architecture
23//!
24//! The crate is organized in layers:
25//!
26//! - **Address translation** ([`addressmap::AddressMap`]): Converts VAs/RVAs to file offsets
27//! using section tables from [`goblin`].
28//! - **VB structures** ([`vb`]): View types for each structure in the VB6
29//! internal format (VBHeader, ProjectData, ObjectTable, etc.).
30//! - **P-Code decoding** ([`pcode`]): Opcode tables, operand types, and a streaming
31//! instruction iterator.
32//! - **High-level API** ([`VbProject`]): Ties everything together into a convenient
33//! exploration interface.
34//!
35//! # Design
36//!
37//! All structure types borrow from the original file byte slice (`&'a [u8]`).
38//! Accessor methods read directly from the underlying buffer using
39//! little-endian byte decoding.
40
41#![deny(missing_docs, unsafe_code)]
42
43pub mod addressmap;
44pub mod entrypoint;
45pub mod error;
46pub mod pcode;
47pub mod project;
48pub mod vb;
49
50mod util;
51
52// Re-export primary types at crate root.
53pub use addressmap::AddressMap;
54pub use error::Error;
55pub use project::{MethodEntry, PCodeMethod, VbControl, VbObject, VbProject};