diff options
| -rw-r--r-- | Cargo.lock | 13 | ||||
| -rw-r--r-- | Cargo.toml | 13 | ||||
| -rw-r--r-- | plugins/pdb-ng/CMakeLists.txt | 44 | ||||
| -rw-r--r-- | plugins/pdb-ng/demo/Cargo.toml | 7 | ||||
| -rw-r--r-- | rust/Cargo.toml | 3 | ||||
| -rw-r--r-- | rust/src/collaboration/remote.rs | 2 | ||||
| -rw-r--r-- | rust/src/lib.rs | 6 |
7 files changed, 67 insertions, 21 deletions
@@ -1973,6 +1973,19 @@ dependencies = [ ] [[package]] +name = "pdb-import-plugin-static" +version = "0.1.0" +dependencies = [ + "anyhow", + "binaryninja", + "binaryninjacore-sys", + "itertools 0.11.0", + "log", + "pdb", + "regex", +] + +[[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -16,6 +16,7 @@ members = [ "plugins/dwarf/shared", "plugins/idb_import", "plugins/pdb-ng", + "plugins/pdb-ng/demo", "plugins/warp" ] @@ -24,5 +25,15 @@ binaryninja = { path = "rust" } binaryninjacore-sys = { path = "rust/binaryninjacore-sys" } [profile.release] -lto = true +lto = "thin" debug = "full" + +# Disable LTO on demo builds, it will export `rust_eh_personality` +[profile.release-demo] +inherits = "release" +lto = false + +# Disable LTO on demo builds, it will export `rust_eh_personality` +[profile.dev-demo] +inherits = "dev" +lto = false
\ No newline at end of file diff --git a/plugins/pdb-ng/CMakeLists.txt b/plugins/pdb-ng/CMakeLists.txt index d0282c1a..5f409b38 100644 --- a/plugins/pdb-ng/CMakeLists.txt +++ b/plugins/pdb-ng/CMakeLists.txt @@ -15,11 +15,21 @@ file(GLOB_RECURSE API_SOURCES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/../../rust/src/*.rs) if(CMAKE_BUILD_TYPE MATCHES Debug) - set(TARGET_DIR ${PROJECT_BINARY_DIR}/target/debug) - set(CARGO_OPTS --target-dir=${PROJECT_BINARY_DIR}/target) + if(DEMO) + set(TARGET_DIR ${PROJECT_BINARY_DIR}/target/dev-demo) + set(CARGO_OPTS --target-dir=${PROJECT_BINARY_DIR}/target --profile=dev-demo) + else() + set(TARGET_DIR ${PROJECT_BINARY_DIR}/target/debug) + set(CARGO_OPTS --target-dir=${PROJECT_BINARY_DIR}/target) + endif() else() - set(TARGET_DIR ${PROJECT_BINARY_DIR}/target/release) - set(CARGO_OPTS --target-dir=${PROJECT_BINARY_DIR}/target --release) + if(DEMO) + set(TARGET_DIR ${PROJECT_BINARY_DIR}/target/release-demo) + set(CARGO_OPTS --target-dir=${PROJECT_BINARY_DIR}/target --profile=release-demo) + else() + set(TARGET_DIR ${PROJECT_BINARY_DIR}/target/release) + set(CARGO_OPTS --target-dir=${PROJECT_BINARY_DIR}/target --release) + endif() endif() if(FORCE_COLORED_OUTPUT) @@ -60,11 +70,21 @@ set(RUSTUP_COMMAND ${RUSTUP_PATH} run ${CARGO_STABLE_VERSION} cargo) if(APPLE) if(UNIVERSAL) if(CMAKE_BUILD_TYPE MATCHES Debug) - set(AARCH64_LIB_PATH ${PROJECT_BINARY_DIR}/target/aarch64-apple-darwin/debug/${OUTPUT_FILE_NAME}) - set(X86_64_LIB_PATH ${PROJECT_BINARY_DIR}/target/x86_64-apple-darwin/debug/${OUTPUT_FILE_NAME}) + if(DEMO) + set(AARCH64_LIB_PATH ${PROJECT_BINARY_DIR}/target/aarch64-apple-darwin/dev-demo/${OUTPUT_FILE_NAME}) + set(X86_64_LIB_PATH ${PROJECT_BINARY_DIR}/target/x86_64-apple-darwin/dev-demo/${OUTPUT_FILE_NAME}) + else() + set(AARCH64_LIB_PATH ${PROJECT_BINARY_DIR}/target/aarch64-apple-darwin/debug/${OUTPUT_FILE_NAME}) + set(X86_64_LIB_PATH ${PROJECT_BINARY_DIR}/target/x86_64-apple-darwin/debug/${OUTPUT_FILE_NAME}) + endif() else() - set(AARCH64_LIB_PATH ${PROJECT_BINARY_DIR}/target/aarch64-apple-darwin/release/${OUTPUT_FILE_NAME}) - set(X86_64_LIB_PATH ${PROJECT_BINARY_DIR}/target/x86_64-apple-darwin/release/${OUTPUT_FILE_NAME}) + if(DEMO) + set(AARCH64_LIB_PATH ${PROJECT_BINARY_DIR}/target/aarch64-apple-darwin/release-demo/${OUTPUT_FILE_NAME}) + set(X86_64_LIB_PATH ${PROJECT_BINARY_DIR}/target/x86_64-apple-darwin/release-demo/${OUTPUT_FILE_NAME}) + else() + set(AARCH64_LIB_PATH ${PROJECT_BINARY_DIR}/target/aarch64-apple-darwin/release/${OUTPUT_FILE_NAME}) + set(X86_64_LIB_PATH ${PROJECT_BINARY_DIR}/target/x86_64-apple-darwin/release/${OUTPUT_FILE_NAME}) + endif() endif() add_custom_command( @@ -86,12 +106,6 @@ if(APPLE) DEPENDS ${PLUGIN_SOURCES} ${API_SOURCES} ) else() - if(CMAKE_BUILD_TYPE MATCHES Debug) - set(LIB_PATH ${PROJECT_BINARY_DIR}/target/debug/${OUTPUT_FILE_NAME}) - else() - set(LIB_PATH ${PROJECT_BINARY_DIR}/target/release/${OUTPUT_FILE_NAME}) - endif() - add_custom_command( OUTPUT ${OUTPUT_FILE_PATH} COMMAND ${CMAKE_COMMAND} -E env @@ -100,7 +114,7 @@ if(APPLE) COMMAND ${CMAKE_COMMAND} -E env MACOSX_DEPLOYMENT_TARGET=10.14 BINARYNINJADIR=${BINJA_LIB_DIR} ${RUSTUP_COMMAND} build ${CARGO_OPTS} ${CARGO_FEATURES} - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_PATH} ${OUTPUT_FILE_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${TARGET_DIR}/${OUTPUT_FILE_NAME} ${OUTPUT_FILE_PATH} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} DEPENDS ${PLUGIN_SOURCES} ${API_SOURCES} ) diff --git a/plugins/pdb-ng/demo/Cargo.toml b/plugins/pdb-ng/demo/Cargo.toml index f9f446b5..3a36023f 100644 --- a/plugins/pdb-ng/demo/Cargo.toml +++ b/plugins/pdb-ng/demo/Cargo.toml @@ -9,12 +9,11 @@ path = "../src/lib.rs" [dependencies] anyhow = "^1.0" -binaryninja = {path = "../../../"} -home = "^0.5.5" +binaryninja = { workspace = true, features = ["demo"]} +binaryninjacore-sys.workspace = true itertools = "^0.11" log = "0.4" -pdb = { git = "https://github.com/Vector35/pdb-rs", branch = "master" } -cab = "^0.4" +pdb = { git = "https://github.com/Vector35/pdb-rs", rev = "6016177" } regex = "1" [features] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 86e527d6..0a17730c 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -8,6 +8,9 @@ rust-version = "1.83.0" [features] # This is used when statically linking to prevent exporting CorePluginABIVersion and UiPluginABIVersion. no_exports = [] +# Add this if you want to support the demo version of the product. +# This will disable certain functions that do not exist in the demo build. +demo = ["no_exports"] [dependencies] log = { version = "0.4", features = ["std"] } diff --git a/rust/src/collaboration/remote.rs b/rust/src/collaboration/remote.rs index baf2ce80..382d1ca2 100644 --- a/rust/src/collaboration/remote.rs +++ b/rust/src/collaboration/remote.rs @@ -910,7 +910,7 @@ pub struct ConnectionOptions { pub password: Option<String>, /// Provide this if you want to authenticate with a token. /// - /// If you do not have a token you can use [ConnectionOptions::self]. + /// If you do not have a token you can use [ConnectionOptions::with_password]. pub token: Option<String>, } diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 08e31c00..159a7ec5 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -476,12 +476,18 @@ pub fn license_count() -> i32 { /// If not set the normal license retrieval will occur: /// 1. Check the BN_LICENSE environment variable /// 2. Check the Binary Ninja user directory for license.dat +#[cfg(not(feature = "demo"))] pub fn set_license<S: BnStrCompatible + Default>(license: Option<S>) { let license = license.unwrap_or_default().into_bytes_with_nul(); let license_slice = license.as_ref(); unsafe { BNSetLicense(license_slice.as_ptr() as *const c_char) } } +#[cfg(feature = "demo")] +pub fn set_license<S: BnStrCompatible + Default>(_license: Option<S>) { + panic!("Cannot set license in demo mode!"); +} + pub fn product() -> BnString { unsafe { BnString::from_raw(BNGetProduct()) } } |
