Skip to main content

VmwareStateBuilder

Struct VmwareStateBuilder 

Source
pub struct VmwareStateBuilder { /* private fields */ }
Expand description

Build a synthetic VMware .vmss/.vmsn state file.

Produces the VMware group/tag binary format:

  • 12-byte file header: magic(u32=0xBED2BED0) + unknown(u32=0) + group_count(u32)
  • Group entries (80 bytes each): name(64 bytes null-terminated) + tags_offset(u64) + padding(8 bytes)
  • “memory” group with region tags containing paddr(u64) + data
  • Optional “cpu” group with CR3 tag

Tag format for memory regions:

  • flags: u8 (0x06 = large data with explicit size)
  • name_length: u8
  • name: bytes (“regionPPN”, “regionBytes”)
  • data_length: u32
  • payload: depends on tag name

Tag format for CPU CR3:

  • flags: u8 (0x46 = indexed + 8-byte data)
  • name_length: u8
  • name: “CR3”
  • index0: u8 (0 = CPU 0)
  • index1: u8 (3 = CR register 3)
  • value: u64

Tag terminator: flags byte = 0

Implementations§

Source§

impl VmwareStateBuilder

Source

pub fn new() -> Self

Create a new empty builder.

Source

pub fn add_region(self, paddr: u64, data: &[u8]) -> Self

Add a physical memory region at the given physical address.

Source

pub fn cr3(self, cr3: u64) -> Self

Set the CR3 / DirectoryTableBase value (adds a “cpu” group).

Source

pub fn build(self) -> Vec<u8>

Build the complete VMware state file as a byte vector.

Trait Implementations§

Source§

impl Default for VmwareStateBuilder

Source§

fn default() -> VmwareStateBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, 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.