diff --git a/LICENSE b/LICENSE index 8dc514c..de73e0e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Cryptlex +Copyright (c) 2026 Cryptlex Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build.rs b/build.rs index 69b454d..e2d1428 100644 --- a/build.rs +++ b/build.rs @@ -20,7 +20,7 @@ fn download_and_setup_libs() -> Result<(), Box> { fs::create_dir_all(&libs_dir)?; } - let version = "v3.35.1"; + let version = "v3.38.0"; let base_url = "https://dl.cryptlex.com/downloads"; // Determine which library to download based on target diff --git a/src/extern_functions.rs b/src/extern_functions.rs index bcec7d3..08c2efb 100644 --- a/src/extern_functions.rs +++ b/src/extern_functions.rs @@ -119,5 +119,6 @@ extern "C" { pub fn IncrementActivationMeterAttributeUses(name: cstrtype!(), increment: c_uint) -> c_int; pub fn DecrementActivationMeterAttributeUses(name: cstrtype!(), decrement: c_uint) -> c_int; pub fn ResetActivationMeterAttributeUses(name: cstrtype!()) -> c_int; + pub fn MigrateToSystemWideActivation(oldPermissionFlag: c_uint) -> c_int; pub fn Reset() -> c_int; } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 3ddabc8..5db1988 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2306,6 +2306,30 @@ pub fn reset_activation_meter_attribute_uses(name: String) -> Result<(), LexActi } } +/// Migrates existing license data to system-wide storage. +/// +/// Call this function after set_product_data(). +/// +/// If you intend to use a custom data directory after migration, set it first using set_data_directory(). +/// +/// # Arguments +/// +/// * `old_permission_flag` - permission flag used previously +/// +/// # Returns +/// +/// Returns `Ok(LexActivatorStatus)` with the status code `LexActivatorStatus::LA_OK` if migration succeeds, If an error occurs, an `Err` containing the `LexActivatorError`is returned. + +pub fn migrate_to_system_wide_activation(old_permission_flag: PermissionFlags) -> Result { + let c_old_permission_flag: c_uint = old_permission_flag as c_uint; + let status = unsafe { MigrateToSystemWideActivation(c_old_permission_flag) }; + if status == 0 { + Ok(LexActivatorStatus::LA_OK) + } else { + return Err(LexActivatorError::from(status)); + } +} + /// Resets the activation and trial data stored in the machine. /// /// This function is meant for developer testing only.