-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextern_functions.rs
119 lines (108 loc) · 6.32 KB
/
extern_functions.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//https://doc.rust-lang.org/std/os/raw/index.html#types
use std::ffi::{c_char, c_int, c_uint, c_longlong, c_ulonglong};
use crate::LexActivatorCode;
#[cfg(windows)]
macro_rules! cstrtype {
() => {
*const u16
};
}
#[cfg(not(windows))]
macro_rules! cstrtype {
() => {
*const c_char
};
}
#[cfg(windows)]
macro_rules! strtype {
() => {
*mut u16
}
}
#[cfg(not(windows))]
macro_rules! strtype {
() => {
*mut c_char
}
}
pub type CallbackType = extern "C" fn(LexActivatorCode);
extern "C" {
// --------------- Setter Functions ---------------
pub fn SetProductData(productData: cstrtype!()) -> c_int;
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_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;
pub fn SetLicenseCallback(callback: CallbackType) ->c_int;
pub fn SetActivationLeaseDuration(leaseDuration: c_longlong) -> c_int;
pub fn SetActivationMetadata(key: cstrtype!(), value: cstrtype!()) -> c_int;
pub fn SetTrialActivationMetadata(key: cstrtype!(), value: cstrtype!()) -> c_int;
pub fn SetAppVersion(appVersion: cstrtype!()) -> c_int;
pub fn SetReleaseVersion(releaseVersion: cstrtype!()) -> c_int;
pub fn SetReleasePublishedDate(releasePublishedDate: c_uint) -> c_int;
pub fn SetReleasePlatform(platform: cstrtype!()) -> c_int;
pub fn SetReleaseChannel(channel: cstrtype!()) -> c_int;
pub fn SetOfflineActivationRequestMeterAttributeUses(name: cstrtype!(), uses: c_uint) -> c_int;
pub fn SetNetworkProxy(proxy: cstrtype!()) -> c_int;
pub fn SetCryptlexHost(host: cstrtype!()) -> c_int;
pub fn SetTwoFactorAuthenticationCode(twoFactorAuthenticationCode: cstrtype!()) -> c_int;
// --------------- Getter Functions ---------------
pub fn GetProductMetadata(key: cstrtype!(), value: strtype!(), length: c_uint) -> c_int;
pub fn GetProductVersionName(name: strtype!(), length: c_uint) -> c_int;
pub fn GetProductVersionDisplayName(name: strtype!(), length: c_uint) -> c_int;
pub fn GetProductVersionFeatureFlag(name: cstrtype!(), enabled: *mut c_uint, data: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseMetadata(key: cstrtype!(), value: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseKey(licenseKey: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseAllowedActivations(allowedActivations: *mut c_longlong) -> c_int;
pub fn GetLicenseAllowedDeactivations(allowedDeactivations: *mut c_longlong) -> c_int;
pub fn GetLicenseTotalActivations(totalActivations: *mut c_uint) -> c_int;
pub fn GetLicenseTotalDeactivations(totalDeactivations: *mut c_uint) -> c_int;
pub fn GetLicenseCreationDate(creationDate: *mut c_uint) -> c_int;
pub fn GetLicenseActivationDate(activationDate: *mut c_uint) -> c_int;
pub fn GetLicenseExpiryDate(expiryDate: *mut c_uint) -> c_int;
pub fn GetLicenseMaintenanceExpiryDate(maintenanceExpiryDate: *mut c_uint) -> c_int;
pub fn GetLicenseMaxAllowedReleaseVersion(maxAllowedReleaseVersion: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseUserEmail(email: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseUserName(name: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseUserCompany(company: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseUserMetadata(key: cstrtype!(), value: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseOrganizationName(organizationName: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseOrganizationAddressInternal(organizationAddressJson: strtype!(), length: c_uint) -> c_int;
pub fn GetUserLicensesInternal(userLicenses: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseType(licenseType: strtype!(), length: c_uint) -> c_int;
pub fn GetActivationId(id:strtype!(), length: c_uint) -> c_int;
pub fn GetActivationMetadata(key: cstrtype!(), value: strtype!(), length: c_uint) -> c_int;
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 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;
pub fn GetLocalTrialExpiryDate(localTrialExpiryDate: *mut c_uint) -> c_int;
pub fn GetLibraryVersion(libraryVersion: strtype!(), length: c_uint) -> c_int;
pub fn GetLicenseMeterAttribute(name: cstrtype!(), allowedUses: *mut c_longlong, totalUses: *mut c_ulonglong, grossUses: *mut c_ulonglong) -> c_int;
// --------------- LexActivator Action Functions ---------------
pub fn AuthenticateUser(email: cstrtype!(), password: cstrtype!()) -> c_int;
pub fn AuthenticateUserWithIdToken(idToken: cstrtype!()) -> c_int;
pub fn ActivateLicense() -> c_int;
pub fn ActivateLicenseOffline(filePath: cstrtype!()) -> c_int;
pub fn GenerateOfflineActivationRequest(filePath: cstrtype!()) -> c_int;
pub fn DeactivateLicense() -> c_int;
pub fn GenerateOfflineDeactivationRequest(filePath: cstrtype!()) -> c_int;
pub fn IsLicenseGenuine() -> c_int;
pub fn IsLicenseValid() -> c_int;
pub fn ActivateTrial() -> c_int;
pub fn ActivateTrialOffline(filePath: cstrtype!()) -> c_int;
pub fn GenerateOfflineTrialActivationRequest(filePath: cstrtype!()) -> c_int;
pub fn IsTrialGenuine() -> c_int;
pub fn ActivateLocalTrial(trialLength: c_uint) -> c_int;
pub fn IsLocalTrialGenuine() -> c_int;
pub fn ExtendLocalTrial(trialExtensionLength: c_uint) -> c_int;
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 Reset() -> c_int;
}