From e151425087b6c0ee8c4d099bfc2d6d1268201db0 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Wed, 23 Oct 2024 20:47:31 -0400 Subject: Add WARP integration https://github.com/Vector35/warp/ --- rust/src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'rust/src') diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 068aa8c3..0c1022c0 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -173,6 +173,8 @@ pub mod types; pub mod update; pub mod workflow; +use std::collections::HashMap; +use std::ffi::CStr; use std::path::PathBuf; use std::ptr; @@ -596,6 +598,21 @@ pub fn path_relative_to_user_directory(path: S) -> R )) } +pub fn memory_info() -> HashMap { + let mut count = 0; + let mut usage = HashMap::new(); + unsafe { + let info_ptr = binaryninjacore_sys::BNGetMemoryUsageInfo(&mut count); + let info_list = std::slice::from_raw_parts(info_ptr, count); + for info in info_list { + let info_name = CStr::from_ptr(info.name).to_str().unwrap().to_string(); + usage.insert(info_name, info.value); + } + binaryninjacore_sys::BNFreeMemoryUsageInfo(info_ptr, count); + } + usage +} + pub fn version() -> string::BnString { unsafe { string::BnString::from_raw(binaryninjacore_sys::BNGetVersionString()) } } -- cgit v1.3.1