BinFilePointer Type
Represents a pointer to binary, which is used to exclusively point to a region of a binary that is (1) mapped to both VM and file, (2) mapped to VM only, or (3) mapped to file only. For the other cases, the pointer is considered invalid (null). The pointer internally holds inclusive ranges of the virtual addresses and the file offsets.
Record fields
| Record Field |
Description
|
The first (inclusive) virtual address of the pointed region.
|
|
The last (inclusive) virtual address of the pointed region.
|
|
Full Usage:
MaxOffset
Field type: int
|
|
Full Usage:
Offset
Field type: int
|
The first (inclusive) file offset corresponding to Addr. This is -1 for a null pointer.
|
Instance members
| Instance member |
Description
|
|
Advances the pointer forward by the given amount of bytes. See the
|
|
Advances the pointer forward by the given (non-negative) amount of bytes. The address moves forward unconditionally, while the file offset is clamped to one past the max offset, marking the pointer as virtual once it leaves the file-backed region. The amount is assumed to be non-negative and small enough not to overflow the address; callers must check whether the result can read file bytes before dereferencing.
|
Full Usage:
this.CanRead
Parameters:
int
Returns: bool
Modifiers: inline |
Checks if the pointer can read the given number of bytes within its
virtual address range. The check is purely address-based (it does not
consider the file offset), so a virtual pointer can still report
|
Full Usage:
this.CanReadFileBytes
Returns: bool
Modifiers: inline |
Checks if the pointer currently points to file-backed bytes.
|
Full Usage:
this.IsNull
Returns: bool
Modifiers: inline |
Checks if the pointer is null.
|
Full Usage:
this.IsVirtual
Returns: bool
Modifiers: inline |
Checks if the pointer is virtual, meaning that it currently points to a region that is mapped to VM but not to the file.
|
Full Usage:
this.ReadableAmount
Returns: int
Modifiers: inline |
Returns the number of file bytes available from the current offset up to (and including) the max offset. This is zero or negative when the pointer is virtual (i.e., not backed by the file), so callers should guard with IsVirtual before using this to slice file contents.
|
Static members
| Static member |
Description
|
||||
Full Usage:
BinFilePointer.Advance(p, amount)
Parameters:
BinFilePointer
amount : int
Returns: BinFilePointer
|
Advances the given pointer forward by the given amount of bytes. This is a static counterpart of the instance `Advance` method, provided for piping and interop convenience.
|
||||
Full Usage:
BinFilePointer.CreateFileBacked(addr, maxAddr, offset, maxOffset)
Parameters: Returns: BinFilePointer
|
Creates a pointer to a region backed by file bytes. Both address and file offset ranges are inclusive, and the two ranges are expected to have the same length.
|
||||
|
Creates a pointer to a virtual-memory region that is not backed by file bytes. The resulting pointer has no readable file offset range.
|
||||
|
Returns a null pointer.
|
B2R2