Quake II RTX doxygen  1.0 dev
ac.c File Reference
#include "client.h"

Go to the source code of this file.

Typedefs

typedef PVOID(* FNINIT) (VOID)
 

Functions

qboolean Sys_GetAntiCheatAPI (void)
 

Variables

STATIC PVOID anticheatApi
 
STATIC FNINIT anticheatInit
 
STATIC HMODULE anticheatHandle
 

Typedef Documentation

◆ FNINIT

typedef PVOID(* FNINIT) (VOID)

Definition at line 25 of file ac.c.

Function Documentation

◆ Sys_GetAntiCheatAPI()

qboolean Sys_GetAntiCheatAPI ( void  )

Definition at line 31 of file ac.c.

32 {
33  qboolean updated = qfalse;
34 
35  //already loaded, just reinit
36  if (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 
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 }

Referenced by CL_ConnectionlessPacket().

Variable Documentation

◆ anticheatApi

STATIC PVOID anticheatApi

Definition at line 27 of file ac.c.

Referenced by Sys_GetAntiCheatAPI().

◆ anticheatHandle

STATIC HMODULE anticheatHandle

Definition at line 29 of file ac.c.

Referenced by Sys_GetAntiCheatAPI().

◆ anticheatInit

STATIC FNINIT anticheatInit

Definition at line 28 of file ac.c.

Referenced by Sys_GetAntiCheatAPI().

anticheatInit
STATIC FNINIT anticheatInit
Definition: ac.c:28
anticheatApi
STATIC PVOID anticheatApi
Definition: ac.c:27
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