From d6b0d3a3673a11068fb3b943f2b65b769583945f Mon Sep 17 00:00:00 2001 From: Huzaif Mushtaq Mir Date: Wed, 3 Dec 2025 15:45:46 +0530 Subject: [PATCH] feat: add GetLastActivationError --- src/extern_functions.rs | 1 + src/lib.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/extern_functions.rs b/src/extern_functions.rs index bcec7d3..f3c5518 100644 --- a/src/extern_functions.rs +++ b/src/extern_functions.rs @@ -91,6 +91,7 @@ extern "C" { pub fn GetActivationMode(initialMode: strtype!(), initialModeLength: c_uint, currentMode: strtype!(), currentModeLength: c_uint) -> c_int; pub fn GetActivationMeterAttributeUses(name: cstrtype!(), uses: *mut c_uint) -> c_int; pub fn GetServerSyncGracePeriodExpiryDate(gracePeriodExpiryDate: *mut c_uint) -> c_int; + pub fn GetLastActivationError(errorCode: *mut c_uint) -> c_int; pub fn GetTrialActivationMetadata(key: cstrtype!(), value: strtype!(), length: c_uint) -> c_int; pub fn GetTrialExpiryDate(trialExpiryDate: *mut c_uint) -> c_int; pub fn GetTrialId(trialId: strtype!(), length: c_uint) -> c_int; diff --git a/src/lib.rs b/src/lib.rs index 3ddabc8..5b88f5a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1688,6 +1688,23 @@ pub fn get_server_sync_grace_period_expiry_date() -> Result Result { + let status: i32; + let mut error_code: c_uint = 0; + status = unsafe { GetLastActivationError(&mut error_code) }; + if status == 0 { + Ok(error_code) + } else { + return Err(LexActivatorError::from(status)); + } +} + /// Retrieves the metadata value associated with the specified key for the trial activation. /// /// # Arguments