Quake II RTX doxygen
1.0 dev
ac.c
Go to the documentation of this file.
1
/*
2
Copyright (C) 2006 r1ch.net
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License along
15
with this program; if not, write to the Free Software Foundation, Inc.,
16
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
//
20
// r1ch.net anticheat support
21
//
22
23
#include "
client.h
"
24
25
typedef
PVOID (*
FNINIT
)(VOID);
26
27
STATIC
PVOID
anticheatApi
;
28
STATIC
FNINIT
anticheatInit
;
29
STATIC
HMODULE
anticheatHandle
;
30
31
qboolean
Sys_GetAntiCheatAPI
(
void
)
32
{
33
qboolean updated = qfalse;
34
35
//already loaded, just reinit
36
if
(
anticheatInit
) {
37
anticheatApi
=
anticheatInit
();
38
if
(!
anticheatApi
) {
39
Com_LPrintf
(PRINT_ERROR,
"Anticheat failed to reinitialize!\n"
);
40
FreeLibrary(
anticheatHandle
);
41
anticheatHandle
= NULL;
42
anticheatInit
= NULL;
43
return
qfalse;
44
}
45
return
qtrue;
46
}
47
48
reInit:
49
anticheatHandle
= LoadLibrary(
"anticheat"
);
50
if
(!
anticheatHandle
) {
51
Com_LPrintf
(PRINT_ERROR,
"Anticheat failed to load.\n"
);
52
return
qfalse;
53
}
54
55
//this should never fail unless the anticheat.dll is bad
56
anticheatInit
= (
FNINIT
)GetProcAddress(
57
anticheatHandle
,
"Initialize"
);
58
if
(!
anticheatInit
) {
59
Com_LPrintf
(PRINT_ERROR,
60
"Couldn't get API of anticheat.dll!\n"
61
"Please check you are using a valid "
62
"anticheat.dll from http://antiche.at/"
);
63
FreeLibrary(
anticheatHandle
);
64
anticheatHandle
= NULL;
65
return
qfalse;
66
}
67
68
anticheatApi
=
anticheatInit
();
69
if
(
anticheatApi
) {
70
return
qtrue;
// succeeded
71
}
72
73
FreeLibrary(
anticheatHandle
);
74
anticheatHandle
= NULL;
75
anticheatInit
= NULL;
76
if
(!updated) {
77
updated = qtrue;
78
goto
reInit;
79
}
80
81
Com_LPrintf
(PRINT_ERROR,
"Anticheat failed to initialize.\n"
);
82
83
return
qfalse;
84
}
85
Sys_GetAntiCheatAPI
qboolean Sys_GetAntiCheatAPI(void)
Definition:
ac.c:31
anticheatInit
STATIC FNINIT anticheatInit
Definition:
ac.c:28
anticheatApi
STATIC PVOID anticheatApi
Definition:
ac.c:27
STATIC
#define STATIC
Definition:
client.h:41
client.h
Com_LPrintf
void Com_LPrintf(print_type_t type, const char *fmt,...)
Definition:
g_main.c:242
anticheatHandle
STATIC HMODULE anticheatHandle
Definition:
ac.c:29
FNINIT
PVOID(* FNINIT)(VOID)
Definition:
ac.c:25
src
windows
ac.c
Generated by
1.8.17