Skip to content

Commit

Permalink
fix: download lib version and result pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
muneebkq committed Sep 6, 2024
1 parent 375ac99 commit 10abd10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion download-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

BASE_URL=https://dl.cryptlex.com/downloads
VERSION="v3.27.0";
VERSION="v3.30.0";

mkdir -p tmp/windows
WINDOWS_FILE_NAME="LexActivator-Win.zip"
Expand Down
2 changes: 1 addition & 1 deletion src/extern_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern "C" {
pub fn SetProductId(productId: cstrtype!() , flags: c_uint) -> c_int;
pub fn SetDataDirectory(dataDir: cstrtype!()) -> c_int;
pub fn SetDebugMode(enable: c_uint) -> c_uint;
pub fn SetCacheMode(mode: c_uint) -> c_uint;
pub fn SetCacheMode(mode: c_int) -> c_int;
pub fn SetCustomDeviceFingerprint(deviceFingerprint: cstrtype!()) -> c_int;
pub fn SetLicenseKey(licenseKey: cstrtype!()) -> c_int;
pub fn SetLicenseUserCredential(email: cstrtype!(), password: cstrtype!()) -> c_int;
Expand Down
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,16 @@ pub fn set_debug_mode(enable: u32) {
///
/// Returns `Ok(())` if mode is set successfully.
pub fn set_cache_mode(mode: bool) -> c_uint {
let c_mode: c_uint = if mode { 1 } else { 0 };
unsafe { SetCacheMode(c_mode) }
pub fn set_cache_mode(mode: bool) -> Result<(), LexActivatorError> {
let c_mode: c_int = if mode { 1 } else { 0 };
let status = unsafe { SetCacheMode(c_mode) };
if status == 0 {
Ok(())
} else {
return Err(LexActivatorError::from(status));
}
}


/// In case you don't want to use the LexActivator's advanced device fingerprinting algorithm, this function can be used to set a custom device fingerprint.
///
/// # Arguments
Expand Down

0 comments on commit 10abd10

Please sign in to comment.