TypedObject class

TypedObject represents a typed object in the target process’s virtual address space. It can be constructed from a type and an address, or by looking up fields of a struct, dereferencing pointers, accessing array elements, and so on.

TypedObject.name → string

Get the name of the object.

TypedObject.address → integer

Get the virtual address of the object as an int.

TypedObject.type → string

Get the type name of the object.

TypedObject.module → string

Get the module name of the typed object.

TypedObject.size → integer

Get the size of the object in bytes.

TypedObject.value

Returns the value of the object, if it’s a primitive type. Raises an error otherwise.

obj[key]
obj.key

If key is an integer, attempts an array element access. If the object is not an array or pointer, raises an error.

If key is a string, and does not name a built-in property, attempts to look up a field with that name. If no such field exists, raises an error.

The following are equivalent:

foo.m_bar
foo['m_bar']
foo.f('m_bar')
foo.field('m_bar')
obj.f(f)
obj.field(f)

Explicit way of looking up a field. f names the field to look up. If the field doesn’t exist, raises an error.

This method is necessary if the field sought is hidden by a built-in property, like name. In that case, obj.name and obj['name'] will yield the name property instead of performing a field lookup.

TypedObject.readString([count]) → string

Read an ANSI string from the target process starting at this object’s address. count (optional) specifies the maximum number of characters to read.

TypedObject.readWideString([count]) → string

Read a wide string from the target process starting at this object’s address. count (optional) specifies the maximum number of characters to read.

TypedObject.readBytes(count) → string

Read a block of count bytes from the target process from this object’s address.

New in version 1.0.3.

TypedObject.deref → TypedObject

Dereference the current object, if it’s a pointer or array.

TypedObject.getRuntimeObject() → TypedObject

Attempts to dynamically down-cast the current object if it has a vtable.

#obj

If this object represents an array, returns its length, otherwise raises an error.