Skip to main content

FuncRecord

Struct FuncRecord 

Source
pub struct FuncRecord<'a> { /* private fields */ }
Expand description

Zero-copy view of a variable-length MSFT_FuncRecord.

The base fixed portion is BASE_SIZE (0x18) bytes. Optional attribute DWORDs and per-parameter data follow.

Constructed by FuncIter; the backing slice length equals the record size encoded in the Info field.

Implementations§

Source§

impl<'a> FuncRecord<'a>

Source

pub const BASE_SIZE: usize = 0x18

Minimum record size (the fixed fields before optional attributes).

Source

pub fn as_bytes(&self) -> &'a [u8]

Returns the raw backing bytes for this record.

Source

pub fn info(&self) -> u32

Raw Info field at offset 0x00.

Low 16 bits = record size in bytes; high 16 bits = member index.

Source

pub fn record_size(&self) -> usize

Record size in bytes (low 16 bits of info).

Source

pub fn datatype(&self) -> i32

Return type (encoded DataType at offset 0x04).

Negative values encode simple VT_* types inline. Non-negative values are offsets into the type descriptor table.

Source

pub fn flags(&self) -> u32

FUNCFLAG_* flags at offset 0x08.

Source

pub fn vtable_offset(&self) -> i16

VTable slot offset at offset 0x0C.

Source

pub fn funcdesc_size(&self) -> i16

FUNCDESC size at offset 0x0E.

Source

pub fn fkccic(&self) -> u32

FKCCIC field at offset 0x10.

Encodes function kind (bits 0-2), invoke kind (bits 3-6), calling convention (bits 8-11), and flags (bits 7, 12).

Source

pub fn func_kind(&self) -> u8

FUNC_* kind (bits 0-2 of fkccic).

0 = Virtual, 1 = PureVirtual, 2 = NonVirtual, 3 = Static, 4 = Dispatch.

Source

pub fn invoke_kind(&self) -> u8

INVOKE_* kind (bits 3-6 of fkccic).

1 = Func, 2 = PropertyGet, 4 = PropertyPut, 8 = PropertyPutRef.

Source

pub fn callconv(&self) -> u8

Calling convention (bits 8-11 of fkccic).

0 = FastCall, 1 = CDecl, 2 = Pascal, 4 = StdCall.

Source

pub fn nrargs(&self) -> i16

Number of parameters at offset 0x14.

Source

pub fn nroargs(&self) -> i16

Number of optional parameters at offset 0x16.

Source

pub fn has_cust_data(&self) -> bool

Whether this function has custom data (FKCCIC bit 7).

Source

pub fn has_arg_cust_data(&self) -> bool

Whether this function has per-argument custom data (FKCCIC bit 12).

Source

pub fn help_context(&self) -> Option<i32>

Help context (attribute 0, offset 0x18).

Returns None if the record is too short to contain this field.

Source

pub fn help_string_offset(&self) -> Option<i32>

Help string offset in the string table (attribute 1, offset 0x1C).

Returns None if the record is too short to contain this field.

Source

pub fn oentry(&self) -> Option<i32>

oEntry / DISPID (attribute 2, offset 0x20).

For DISPATCH interfaces this is the DISPID. For MODULE types this is a name offset or ordinal.

Returns None if the record is too short to contain this field.

Source

pub fn name_offset(&self) -> Option<i32>

Function name offset in the name table (attribute 3, offset 0x24).

Note: in practice, function names are read from the auxiliary arrays via TypeLib::func_name rather than from this record attribute.

Returns None if the record is too short to contain this field.

Source

pub fn helpstringcontext(&self) -> Option<i32>

Help string context (attribute 4, offset 0x28).

Returns None if the record is too short to contain this field.

Source

pub fn cust_data_offset(&self) -> Option<i32>

Offset into the CDGuids directory for this function’s custom data (attribute 5, offset 0x2C).

Only meaningful when has_cust_data returns true.

Returns None if the record is too short to contain this field.

Source

pub fn arg_cust_data_offset(&self, arg_index: usize) -> Option<i32>

Returns the custom data offset for argument arg_index.

The per-argument custom data array follows all optional attributes (when FKCCIC bit 12 is set). Returns None if the function has no per-argument custom data or the index is out of bounds.

Trait Implementations§

Source§

impl<'a> Clone for FuncRecord<'a>

Source§

fn clone(&self) -> FuncRecord<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for FuncRecord<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Copy for FuncRecord<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for FuncRecord<'a>

§

impl<'a> RefUnwindSafe for FuncRecord<'a>

§

impl<'a> Send for FuncRecord<'a>

§

impl<'a> Sync for FuncRecord<'a>

§

impl<'a> Unpin for FuncRecord<'a>

§

impl<'a> UnsafeUnpin for FuncRecord<'a>

§

impl<'a> UnwindSafe for FuncRecord<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.