|
1 | 1 | use binaryninjacore_sys::*; |
2 | | -use std::ffi::CStr; |
| 2 | +use std::ffi::{c_char, CStr}; |
3 | 3 |
|
4 | 4 | use crate::architecture::CoreArchitecture; |
5 | 5 | use crate::rc::{Array, CoreArrayProvider, CoreArrayProviderInner}; |
6 | | -use crate::string::BnString; |
7 | 6 | use std::num::NonZeroU32; |
8 | 7 | use std::ptr::NonNull; |
9 | 8 |
|
10 | 9 | pub type BaseAddressDetectionPOISetting = BNBaseAddressDetectionPOISetting; |
11 | 10 | pub type BaseAddressDetectionConfidence = BNBaseAddressDetectionConfidence; |
12 | 11 | pub type BaseAddressDetectionPOIType = BNBaseAddressDetectionPOIType; |
13 | 12 |
|
| 13 | +/// This is the architecture name used to use the architecture auto-detection feature. |
| 14 | +const BASE_ADDRESS_AUTO_DETECTION_ARCH: &CStr = c"auto detect"; |
| 15 | + |
14 | 16 | pub enum BaseAddressDetectionAnalysis { |
15 | 17 | Basic, |
16 | 18 | ControlFlow, |
@@ -169,9 +171,12 @@ pub struct BaseAddressDetectionSettings { |
169 | 171 |
|
170 | 172 | impl BaseAddressDetectionSettings { |
171 | 173 | pub(crate) fn into_raw(value: &Self) -> BNBaseAddressDetectionSettings { |
172 | | - let arch_name = value.arch.map(|a| a.name()).unwrap_or(BnString::new("")); |
| 174 | + let arch_name = value |
| 175 | + .arch |
| 176 | + .map(|a| a.name().as_ptr()) |
| 177 | + .unwrap_or(BASE_ADDRESS_AUTO_DETECTION_ARCH.as_ptr() as *const c_char); |
173 | 178 | BNBaseAddressDetectionSettings { |
174 | | - Architecture: arch_name.as_ptr(), |
| 179 | + Architecture: arch_name, |
175 | 180 | Analysis: value.analysis.as_raw().as_ptr(), |
176 | 181 | MinStrlen: value.min_string_len, |
177 | 182 | Alignment: value.alignment.get(), |
|
0 commit comments