-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathKIntranetAuthorizeLegacy.cc
More file actions
145 lines (119 loc) · 5.38 KB
/
Copy pathKIntranetAuthorizeLegacy.cc
File metadata and controls
145 lines (119 loc) · 5.38 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <new>
#include "KIntranetAuthorizeLegacy.h"
#include "Logger.h"
namespace {
QString fromNullableWideString(const wchar_t* value) {
return value ? QString::fromWCharArray(value) : QStringLiteral("<null>");
}
QString* constructString(QString* out, const char* value) {
if (!out) {
return nullptr;
}
return new (out) QString(value);
}
constexpr int kAuthorizationSuccess = 0;
constexpr int kActivatedStatus = 2;
} // namespace
KIntranetAuthorizeLegacy::KIntranetAuthorizeLegacy(QObject* parent) : QObject(parent) {
Logger::instance().writer().stream() << "[AuthBypass] KIntranetAuthorizeLegacy created.";
}
bool KIntranetAuthorizeLegacy::IsValid() {
Logger::instance().writer().stream() << "[AuthBypass] IsValid() => true";
return true;
}
bool KIntranetAuthorizeLegacy::IsActivated() {
Logger::instance().writer().stream() << "[AuthBypass] IsActivated() => true";
return true;
}
bool KIntranetAuthorizeLegacy::RequestAuthorization(bool async) {
Logger::instance().writer().stream() << "[AuthBypass] RequestAuthorization(Async = " << async << ") => true";
return true;
}
bool KIntranetAuthorizeLegacy::CheckFeatureExists(const wchar_t* feature) {
const QString featureStr = fromNullableWideString(feature);
Logger::instance().writer().stream() << "[AuthBypass] CheckFeatureExists(Feature = " << featureStr << ") => true";
return true;
}
int KIntranetAuthorizeLegacy::IsAuthorized(const wchar_t* feature, int reserved) {
Q_UNUSED(reserved);
const QString featureStr = fromNullableWideString(feature);
Logger::instance().writer().stream() << "[AuthBypass] IsAuthorized(Feature = " << featureStr << ") => 0";
return kAuthorizationSuccess;
}
int KIntranetAuthorizeLegacy::IsAccountAuthorized(const wchar_t* feature, const wchar_t* auth1, const wchar_t* auth2, int reserved) {
Q_UNUSED(reserved);
const QString featureStr = fromNullableWideString(feature);
const QString auth1Str = fromNullableWideString(auth1);
const QString auth2Str = fromNullableWideString(auth2);
Logger::instance().writer().stream() << "[AuthBypass] IsAccountAuthorized(Feature = " << featureStr << ", Auth1 = " << auth1Str << ", Auth2 = " << auth2Str << ") => 0";
return kAuthorizationSuccess;
}
int KIntranetAuthorizeLegacy::IsSerialAuthorized(const wchar_t* feature, const wchar_t* auth1, const wchar_t* auth2, int reserved) {
Q_UNUSED(reserved);
const QString featureStr = fromNullableWideString(feature);
const QString auth1Str = fromNullableWideString(auth1);
const QString auth2Str = fromNullableWideString(auth2);
Logger::instance().writer().stream() << "[AuthBypass] IsSerialAuthorized(Feature = " << featureStr << ", Auth1 = " << auth1Str << ", Auth2 = " << auth2Str << ") => 0";
return kAuthorizationSuccess;
}
int KIntranetAuthorizeLegacy::GetStatusCode() {
Logger::instance().writer().stream() << "[AuthBypass] GetStatusCode() => " << kActivatedStatus;
return kActivatedStatus;
}
QString* KIntranetAuthorizeLegacy::GetLicenseInfo(QString* out) {
QString* result = constructString(out, "WPS PDF Pro");
if (result) {
Logger::instance().writer().stream() << "[AuthBypass] GetLicenseInfo() => " << *result;
}
return result;
}
bool KIntranetAuthorizeLegacy::IsServerNetworkOnline() {
Logger::instance().writer().stream() << "[AuthBypass] IsServerNetworkOnline() => true";
return true;
}
char KIntranetAuthorizeLegacy::AddObserver(bool enable) {
Logger::instance().writer().stream() << "[AuthBypass] AddObserver(Enable = " << enable << ") => true";
return 1;
}
char KIntranetAuthorizeLegacy::RemoveObserver(void* observer) {
Logger::instance().writer().stream() << "[AuthBypass] RemoveObserver(Observer = " << observer << ") => true";
return 1;
}
int KIntranetAuthorizeLegacy::CheckIntranetAuth(const IntranetAuthRequest* request) {
Logger::instance().writer().stream() << "[AuthBypass] CheckIntranetAuth(Request = " << request << ") => 0";
return kAuthorizationSuccess;
}
char KIntranetAuthorizeLegacy::SendNetworkLog(void* logStruct) {
Logger::instance().writer().stream() << "[AuthBypass] SendNetworkLog(Log = " << logStruct << ") => suppressed";
return 0;
}
QString* KIntranetAuthorizeLegacy::GetVersionString(QString* out) {
QString* result = constructString(out, "12.8.0.23123");
if (result) {
Logger::instance().writer().stream() << "[AuthBypass] GetVersionString() => " << *result;
}
return result;
}
int KIntranetAuthorizeLegacy::GetAuthExpireTime(const wchar_t* feature, std::int64_t* startTime, std::int64_t* endTime) {
Logger::instance().writer().stream() << "[AuthBypass] GetAuthExpireTime(Feature = " << fromNullableWideString(feature) << ")";
if (!startTime || !endTime) {
return 1;
}
*startTime = -1;
*endTime = -1;
return kAuthorizationSuccess;
}
bool KIntranetAuthorizeLegacy::RefreshAuthorization() {
Logger::instance().writer().stream() << "[AuthBypass] RefreshAuthorization() => true";
return true;
}
QString* KIntranetAuthorizeLegacy::GetAccountInfo(QString* out) {
QString* result = constructString(out, "Authorized Premium User");
if (result) {
Logger::instance().writer().stream() << "[AuthBypass] GetAccountInfo() => " << *result;
}
return result;
}
void KIntranetAuthorizeLegacy::VerifyAuthorization() {
Logger::instance().writer().stream() << "[AuthBypass] VerifyAuthorization()";
}