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
use std::os::raw::{c_char, c_void};
#[cfg_attr(
all(not(target_os = "macos"), target_pointer_width = "64"),
link(name = "VMProtectSDK64")
)]
#[cfg_attr(
all(target_os = "macos", target_pointer_width = "64"),
link(name = "VMProtectSDK")
)]
#[cfg_attr(target_pointer_width = "32", link(name = "VMProtectSDK32"))]
extern "system" {
pub fn VMProtectBegin(name: *const c_char);
pub fn VMProtectBeginVirtualization(name: *const c_char);
pub fn VMProtectBeginMutation(name: *const c_char);
pub fn VMProtectBeginUltra(name: *const c_char);
pub fn VMProtectBeginVirtualizationLockByKey(name: *const c_char);
pub fn VMProtectBeginUltraLockByKey(name: *const c_char);
pub fn VMProtectEnd();
pub fn VMProtectIsProtected() -> u8;
pub fn VMProtectIsDebuggerPresent(kernel: u8) -> u8;
pub fn VMProtectIsVirtualMachinePresent() -> u8;
pub fn VMProtectIsValidImageCRC() -> u8;
pub fn VMProtectDecryptStringA(value: *const c_char) -> *const c_char;
pub fn VMProtectDecryptStringW(value: *const i16) -> *const i16;
pub fn VMProtectFreeString(value: *const c_void) -> u8;
pub fn VMProtectSetSerialNumber(serial: *const c_char) -> u32;
pub fn VMProtectGetSerialNumberState() -> u32;
pub fn VMProtectGetSerialNumberData(data: *mut VMProtectSerialNumberData, size: u32) -> u8;
pub fn VMProtectGetCurrentHWID(hwid: *mut c_char, size: u32) -> u32;
pub fn VMProtectActivateLicense(code: *const c_char, serial: *mut c_char, size: u32) -> u32;
pub fn VMProtectDeactivateLicense(serial: *const c_char) -> u32;
pub fn VMProtectGetOfflineActivationString(
code: *const c_char,
buf: *const c_char,
size: u32,
) -> u32;
pub fn VMProtectGetOfflineDeactivationString(
serial: *const c_char,
buf: *const c_char,
size: u32,
) -> u32;
}
#[derive(Default, Clone, Copy)]
#[repr(C, packed)]
pub struct VMProtectDate {
pub w_year: u16,
pub b_month: u8,
pub b_day: u8,
}
#[derive(Clone, Copy)]
#[repr(C, packed)]
pub struct VMProtectSerialNumberData {
pub state: u32,
pub user_name: [u16; 256],
pub email: [u16; 256],
pub expire: VMProtectDate,
pub max_build: VMProtectDate,
pub running_time: u32,
pub user_data_length: u8,
pub user_data: [u8; 255],
}
impl Default for VMProtectSerialNumberData {
fn default() -> Self {
VMProtectSerialNumberData {
state: 0,
user_name: [0; 256],
email: [0; 256],
expire: VMProtectDate::default(),
max_build: VMProtectDate::default(),
running_time: 0,
user_data_length: 0,
user_data: [0; 255],
}
}
}