[−][src]Crate ovba
An Office VBA project parser written in 100% safe Rust.
This is a (partial) implementation of the [MS-OVBA]: Office VBA File Format Structure protocol (Revision 9.1, published 2020-02-19).
The main entry point into the API is the Project
type, returned by the
open_project
function.
Usage
Opening a project:
let data = std::fs::read("vbaProject.bin")?; let project = ovba::open_project(data)?;
Listing all CFB entries:
let data = std::fs::read("vbaProject.bin")?; let project = ovba::open_project(data)?; for (name, path) in &project.list()? { println!(r#"Name: "{}"; Path: "{}""#, name, path); }
A more complete example that dumps an entire VBA project's source code:
let data = std::fs::read("vbaProject.bin")?; let project = ovba::open_project(data)?; for module in &project.modules { let path = format!("/VBA\\{}", &module.stream_name); let offset = module.text_offset; let src_code = project.decompress_stream_from(&path, offset)?; std::fs::write("./out/".to_string() + &module.name, src_code)?; }
Structs
Information | Specifies version-independent information for the VBA project. |
Module | Specifies data for a module. |
Project | Represents a VBA project. |
ReferenceControl | Specifies a reference to a twiddled type library and its extended type library. |
ReferenceOriginal | Specifies the identifier of the Automation type library the containing
|
ReferenceProject | Specifies a reference to an external VBA project. |
ReferenceRegistered | Specifies a reference to an Automation type library. |
Enums
Error | Public error type. |
ModuleType | Specifies the containing module's type. |
Reference | Specifies a reference to an Automation type library or VBA project. |
SysKind | Specifies the platform for which the VBA project is created. |
Functions
open_project | Opens a VBA project. |
Type Definitions
Result | A type alias for |