(
ctxt: *mut c_void,
bv: *mut BNBinaryView,
arch: *mut BNArchitecture,
result: *mut BNRelocationInfo,
count: usize,
)
| 426 | } |
| 427 | |
| 428 | extern "C" fn cb_get_relocation_info<R>( |
| 429 | ctxt: *mut c_void, |
| 430 | bv: *mut BNBinaryView, |
| 431 | arch: *mut BNArchitecture, |
| 432 | result: *mut BNRelocationInfo, |
| 433 | count: usize, |
| 434 | ) -> bool |
| 435 | where |
| 436 | R: 'static + RelocationHandler<Handle = CustomRelocationHandlerHandle<R>> + Send + Sync, |
| 437 | { |
| 438 | let custom_handler = unsafe { &*(ctxt as *mut R) }; |
| 439 | let bv = unsafe { BinaryView::ref_from_raw(BNNewViewReference(bv)) }; |
| 440 | let arch = unsafe { CoreArchitecture::from_raw(arch) }; |
| 441 | let result = unsafe { core::slice::from_raw_parts_mut(result, count) }; |
| 442 | let mut info = result |
| 443 | .iter() |
| 444 | .map(RelocationInfo::from_raw) |
| 445 | .collect::<Vec<_>>(); |
| 446 | let ok = |
| 447 | custom_handler.get_relocation_info(bv.as_ref(), arch.as_ref(), info.as_mut_slice()); |
| 448 | for (result, info) in result.iter_mut().zip(info.iter()) { |
| 449 | *result = info.as_raw(); |
| 450 | } |
| 451 | ok |
| 452 | } |
| 453 | |
| 454 | extern "C" fn cb_apply_relocation<R>( |
| 455 | ctxt: *mut c_void, |
nothing calls this directly
no test coverage detected