summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-01-25 15:41:29 -0500
committerMason Reed <mason@vector35.com>2025-01-25 15:41:29 -0500
commite19a72a20d5cb35d6f3873f308a3a98d7046d762 (patch)
tree10abaa9bdee57ab6a3dee67b0a972a388725cefe /rust
parent26ed2cdfb13591c63a52e978ead5eae0b6acb0c4 (diff)
Fix statically linking PDB import plugin for demo builds
Diffstat (limited to 'rust')
-rw-r--r--rust/Cargo.toml3
-rw-r--r--rust/src/collaboration/remote.rs2
-rw-r--r--rust/src/lib.rs6
3 files changed, 10 insertions, 1 deletions
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()) }
}