pub struct PCodeMethod<'a> { /* private fields */ }Expand description
A single P-Code method/procedure within a VB6 object.
Provides access to the procedure’s metadata (frame size, proc size) and a streaming iterator over its decoded P-Code instructions.
Implementations§
Source§impl<'a> PCodeMethod<'a>
impl<'a> PCodeMethod<'a>
Sourcepub fn parse(
map: &AddressMap<'a>,
methods_va: u32,
index: u16,
) -> Result<Self, Error>
pub fn parse( map: &AddressMap<'a>, methods_va: u32, index: u16, ) -> Result<Self, Error>
Parses a P-Code method from a method table entry.
The method table at methods_va contains 4-byte VA entries. For
P-Code methods the VA points to a call stub
(mov edx, <rtmi_addr>; call ProcCallEngine); this function
detects the stub, extracts the RTMI address, parses the
ProcDscInfo, and locates the P-Code byte stream.
§Arguments
map- Address map for VA-to-offset resolution.methods_va- Base VA of the method dispatch table.index- Zero-based slot within the table.
§Returns
A PCodeMethod with the parsed procedure descriptor, the raw
P-Code bytes, and the constant pool base VA.
§Errors
Returns an error if any VA in the resolution chain (method table entry, stub, ProcDscInfo, ObjectInfo, or P-Code region) cannot be resolved to valid file offsets.
Sourcepub fn proc_dsc(&self) -> &ProcDscInfo<'a>
pub fn proc_dsc(&self) -> &ProcDscInfo<'a>
Returns the ProcDscInfo (RTMI) for this method.
Sourcepub fn frame_size(&self) -> u16
pub fn frame_size(&self) -> u16
Stack frame size for local variables.
Sourcepub fn pcode_bytes(&self) -> &'a [u8] ⓘ
pub fn pcode_bytes(&self) -> &'a [u8] ⓘ
Raw P-Code bytes for this method (slice into the file buffer).
Sourcepub fn data_const_va(&self) -> u32
pub fn data_const_va(&self) -> u32
Constant pool base VA for resolving string/API references.
Sourcepub fn pcode_va(&self) -> u32
pub fn pcode_va(&self) -> u32
VA of the first P-Code byte in the PE image.
This is the address where the P-Code instruction stream begins,
computed as proc_dsc_va - proc_size.
Sourcepub fn proc_dsc_va(&self) -> u32
pub fn proc_dsc_va(&self) -> u32
VA of the ProcDscInfo (RTMI) structure in the PE image.
The ProcDscInfo immediately follows the P-Code byte stream.
Sourcepub fn stub_va(&self) -> u32
pub fn stub_va(&self) -> u32
VA of the call stub or direct ProcDscInfo pointer.
This is the raw VA from the method dispatch table entry — the
native stub code (mov edx, <RTMI>; call ProcCallEngine) that
launches the P-Code interpreter for this method.
Sourcepub fn instructions(&self) -> InstructionIterator<'a> ⓘ
pub fn instructions(&self) -> InstructionIterator<'a> ⓘ
Returns a streaming iterator over decoded P-Code instructions.
Sourcepub fn constant_pool<'m>(&self, map: &'m AddressMap<'a>) -> ConstantPool<'m>where
'a: 'm,
pub fn constant_pool<'m>(&self, map: &'m AddressMap<'a>) -> ConstantPool<'m>where
'a: 'm,
Creates a ConstantPool reader for this method’s constant pool.
The constant pool is shared by all methods in the same object and
is used to resolve %s operands (string literals, API stubs, etc.).