AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WardenWin.cpp File Reference
#include "WardenWin.h"
#include "ByteBuffer.h"
#include "Common.h"
#include "CryptoRandom.h"
#include "GameTime.h"
#include "HMAC.h"
#include "Log.h"
#include "Opcodes.h"
#include "Player.h"
#include "SessionKeyGenerator.h"
#include "Util.h"
#include "WardenCheckMgr.h"
#include "WardenModuleWin.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"

Go to the source code of this file.

Functions

static constexpr uint8 GetCheckPacketBaseSize (uint8 type)
 
static uint16 GetCheckPacketSize (WardenCheck const *check)
 
static WorldIntConfigs GetMaxWardenChecksForType (uint8 type)
 

Variables

static constexpr char _luaEvalPrefix [] = "local S,T,R=SendAddonMessage,function()"
 
static constexpr char _luaEvalMidfix [] = " end R=S and T()if R then S('_TW',"
 
static constexpr char _luaEvalPostfix [] = ",'GUILD')end"
 

Function Documentation

◆ GetCheckPacketBaseSize()

static constexpr uint8 GetCheckPacketBaseSize ( uint8  type)
staticconstexpr
43{
44 switch (type)
45 {
46 case DRIVER_CHECK:
47 case MPQ_CHECK: return 1;
48 case LUA_EVAL_CHECK: return 1 + sizeof(_luaEvalPrefix) - 1 + sizeof(_luaEvalMidfix) - 1 + 4 + sizeof(_luaEvalPostfix) - 1;
49 case PAGE_CHECK_A: return (4 + 1);
50 case PAGE_CHECK_B: return (4 + 1);
52 case MEM_CHECK: return (1 + 4 + 1);
53 default: return 0;
54 }
55}
@ DRIVER_CHECK
Definition: Warden.h:54
@ PAGE_CHECK_A
Definition: Warden.h:50
@ PAGE_CHECK_B
Definition: Warden.h:51
@ LUA_EVAL_CHECK
Definition: Warden.h:53
@ MPQ_CHECK
Definition: Warden.h:52
@ MEM_CHECK
Definition: Warden.h:49
@ MODULE_CHECK
Definition: Warden.h:57
static constexpr char _luaEvalPrefix[]
Definition: WardenWin.cpp:36
static constexpr char _luaEvalMidfix[]
Definition: WardenWin.cpp:37
static constexpr char _luaEvalPostfix[]
Definition: WardenWin.cpp:38
static constexpr size_t SHA1_DIGEST_LENGTH_BYTES
Definition: CryptoConstants.h:28

References _luaEvalMidfix, _luaEvalPostfix, _luaEvalPrefix, DRIVER_CHECK, LUA_EVAL_CHECK, MEM_CHECK, MODULE_CHECK, MPQ_CHECK, PAGE_CHECK_A, PAGE_CHECK_B, and Acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES.

Referenced by GetCheckPacketSize().

◆ GetCheckPacketSize()

static uint16 GetCheckPacketSize ( WardenCheck const *  check)
static
58{
59 if (!check)
60 {
61 return 0;
62 }
63
64 uint16 size = 1;
65
66 if (check->CheckId >= WardenPayloadMgr::WardenPayloadOffsetMin && check->Type == LUA_EVAL_CHECK)
67 {
68 // Custom payload has no prefix, midfix, postfix.
69 size = size + (4 + 1);
70 }
71 else
72 {
73 size = size + GetCheckPacketBaseSize(check->Type); // 1 byte check type
74 }
75
76 if (!check->Str.empty())
77 {
78 size += (static_cast<uint16>(check->Str.length()) + 1); // 1 byte string length
79 }
80
81 BigNumber tempNumber = check->Data;
82 if (!tempNumber.GetNumBytes())
83 {
84 size += tempNumber.GetNumBytes();
85 }
86 return size;
87}
std::uint16_t uint16
Definition: Define.h:109
static constexpr uint8 GetCheckPacketBaseSize(uint8 type)
Definition: WardenWin.cpp:42
Definition: BigNumber.h:29
int32 GetNumBytes() const
Definition: BigNumber.cpp:178
static uint16 constexpr WardenPayloadOffsetMin
The minimum id available for custom payloads.
Definition: WardenPayloadMgr.h:115

References WardenCheck::CheckId, WardenCheck::Data, GetCheckPacketBaseSize(), BigNumber::GetNumBytes(), LUA_EVAL_CHECK, WardenCheck::Str, WardenCheck::Type, and WardenPayloadMgr::WardenPayloadOffsetMin.

Referenced by WardenWin::RequestChecks().

◆ GetMaxWardenChecksForType()

static WorldIntConfigs GetMaxWardenChecksForType ( uint8  type)
static
91{
92 // Should never be higher type than defined
94
95 switch (type)
96 {
101 default:
102 break;
103 }
104
106}
#define ASSERT
Definition: Errors.h:68
constexpr uint8 MAX_WARDEN_CHECK_TYPES
Definition: WardenCheckMgr.h:41
@ WARDEN_CHECK_MEM_TYPE
Definition: WardenCheckMgr.h:36
@ WARDEN_CHECK_LUA_TYPE
Definition: WardenCheckMgr.h:37
@ CONFIG_WARDEN_NUM_LUA_CHECKS
Definition: IWorld.h:378
@ CONFIG_WARDEN_NUM_MEM_CHECKS
Definition: IWorld.h:377
@ CONFIG_WARDEN_NUM_OTHER_CHECKS
Definition: IWorld.h:379

References ASSERT, CONFIG_WARDEN_NUM_LUA_CHECKS, CONFIG_WARDEN_NUM_MEM_CHECKS, CONFIG_WARDEN_NUM_OTHER_CHECKS, MAX_WARDEN_CHECK_TYPES, WARDEN_CHECK_LUA_TYPE, and WARDEN_CHECK_MEM_TYPE.

Referenced by WardenWin::RequestChecks().

Variable Documentation

◆ _luaEvalMidfix

constexpr char _luaEvalMidfix[] = " end R=S and T()if R then S('_TW',"
staticconstexpr

◆ _luaEvalPostfix

constexpr char _luaEvalPostfix[] = ",'GUILD')end"
staticconstexpr

◆ _luaEvalPrefix

constexpr char _luaEvalPrefix[] = "local S,T,R=SendAddonMessage,function()"
staticconstexpr