pub unsafe extern "C" fn BNRegisterPlatformRecognizerForViewType(
type_: *mut BNBinaryViewType,
id: u64,
endian: BNEndianness,
callback: Option<unsafe extern "C" fn(ctx: *mut c_void, view: *mut BNBinaryView, metadata: *mut BNMetadata) -> *mut BNPlatform>,
ctx: *mut c_void,
)Expand description
Expanded identification of Platform for BinaryViewTypes. Supersedes BNRegisterArchitectureForViewType and BNRegisterPlatformForViewType, as these have certain edge cases (overloaded elf families, for example) that can’t be represented.
The callback returns a Platform object or null (failure), and most recently added callbacks are called first to allow plugins to override any default behaviors. When a callback returns a platform, architecture will be derived from the identified platform.
The BinaryView pointer is the parent view (usually ‘Raw’) that the BinaryView is being created for. This means that generally speaking the callbacks need to be aware of the underlying file format, however the BinaryView implementation may have created datavars in the ‘Raw’ view by the time the callback is invoked. Behavior regarding when this callback is invoked and what has been made available in the BinaryView passed as an argument to the callback is up to the discretion of the BinaryView implementation.
The ‘id’ ind ‘endian’ arguments are used as a filter to determine which registered Platform recognizer callbacks are invoked.
Support for this API tentatively requires explicit support in the BinaryView implementation.