void main hasp_handle_t handle HASP_INVALID_HANDLE_ VALUE hasp_status_

 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
void main()
{
hasp_handle_t handle = HASP_INVALID_HANDLE_VALUE;
hasp_status_t status;
const hasp_feature_t feature = HASP_DEFAULT_FID;
status = hasp_login(feature, vendor_code, &handle);
if(status != HASP_STATUS_OK)
{
printf("ERROR! Unlicensed software usage!\n");
exit(0);
}
evaluating_the_function_of_six_variables(func_of_6_variables,delenie);
int bufsize = sizeof(best_variant);
status = hasp_encrypt(handle, &best_variant, bufsize);
if(status != HASP_STATUS_OK)
{
cout <<status<<"\n";
printf("ERROR! Encrypting is wrong!\n");
exit(0);
}
status = hasp_write(handle, HASP_FILEID_RW, 0, bufsize, best_variant);
if(status != HASP_STATUS_OK)
{
cout <<status<<"\n";
printf("ERROR! Writting is wrong!\n");
exit(0);
}
status = hasp_logout(handle);
//
status = hasp_login(feature, vendor_code, &handle);
if(status != HASP_STATUS_OK)
{
printf("ERROR! Unlicensed software usage!\n");
exit(0);
}
hasp_read(handle, HASP_FILEID_RO, 0, bufsize, &best_variant);
status = hasp_decrypt(handle, &best_variant, bufsize);
if(status != HASP_STATUS_OK)
{
cout <<status<<"\n";
printf("ERROR! Decrypting is wrong!\n");
exit(0);
}
status = hasp_logout(handle);
for(int j=0; j<6; j++)
{
printf("%.3f ", best_variant[j]);
}
printf("\n");
}