Decompile fn_08212 (CNProtectGameGuardMgr::Destroy)

Batch #13802 by codeplay: 1 byte-identical, 0 confirmed by peer review.

- fn_08212 CNProtectGameGuardMgr::Destroy: byte-identical

Merged automatically: every function is byte-identical to the original.
This commit is contained in:
ragnarok-clanker 2026-11-06 22:12:52 +00:00
commit 8ff084db76
2 changed files with 31 additions and 19 deletions

View file

@ -29,7 +29,6 @@ int InitNPGameMon();
int __stdcall GameGuardCallback(int code, const int* packet);
void SetCallbackToGameMon(int(__stdcall* callback)(int, const int*));
void WriteMyLog(const char* file, int line, const char* format, ...);
void __fastcall DestroyAuthTokenVector(void* tokens);
namespace {
template <std::size_t Length, std::uint64_t Key>
@ -70,6 +69,18 @@ namespace {
}
}
// OFFSET: 0x0076C3E0
// FUNCTION: fn_45544
CNProtectGameGuardMgr::~CNProtectGameGuardMgr() {
if (this->m_gameLib) {
CloseNPGameMon();
::operator delete(this->m_gameLib, 1);
this->m_gameLib = nullptr;
}
DeleteCriticalSection(&this->m_lock);
}
// OFFSET: 0x0076C670
// FUNCTION: fn_08205
void CNProtectGameGuardMgr::ProcessAuth(int, int) {
@ -94,10 +105,8 @@ int CNProtectGameGuardMgr::Create() {
// OFFSET: 0x0076CEA0
// FUNCTION: fn_08212
void CNProtectGameGuardMgr::Destroy() {
typedef void(__thiscall * DeletingDestructor)(CNProtectGameGuardMgr*, unsigned char);
if (g_nProtectGameGuardMgr) {
(*reinterpret_cast<DeletingDestructor**>(g_nProtectGameGuardMgr))[0](g_nProtectGameGuardMgr, 1);
delete g_nProtectGameGuardMgr;
g_nProtectGameGuardMgr = nullptr;
}
}
@ -209,16 +218,11 @@ int __stdcall GameGuardCallback(int code, const int* packet) {
return 0;
}
case 0x3FB: {
const int id = packet[0];
const int size = packet[1];
CNProtectGameGuardMgr* manager = g_nProtectGameGuardMgr;
const unsigned char* data = reinterpret_cast<const unsigned char*>(packet + 2);
CNProtectGameGuardMgr::CSAuthToken token = {};
token.id = id;
if (size != 0) {
token.bytes.assign(data, data + size);
}
NSyncObject lock(&g_nProtectGameGuardMgr->m_lock);
g_nProtectGameGuardMgr->m_tokens.push_back(token);
CNProtectGameGuardMgr::lcCSAuthToken token(packet[0], std::vector<unsigned char>(data, data + packet[1]));
NSyncObject lock(&manager->m_lock);
manager->m_tokens.push_back(token);
break;
}
default:

View file

@ -6,10 +6,18 @@
#include <vector>
#include <windows.h>
// VTABLE: vt_00506
class CNProtectGameGuardMgr {
public:
struct CSAuthToken {
/* 0000 */ void* vtable;
// VTABLE: vt_00505
class lcCSAuthToken {
public:
// INLINED
lcCSAuthToken(int id, const std::vector<unsigned char>& bytes) : id(id), bytes(bytes) {
}
virtual ~lcCSAuthToken() = default;
/* 0004 */ int id;
/* 0008 */ std::vector<unsigned char> bytes;
};
@ -18,14 +26,15 @@ public:
static void Destroy();
static const char* GameName();
/* 0000 */ void* vtable;
virtual ~CNProtectGameGuardMgr();
/* 0004 */ bool m_initialized;
/* 0008 */ unsigned int unknown_0008;
/* 000C */ void* m_gameLib;
/* 0010 */ bool m_hasError;
/* 0014 */ std::string m_errorMessage;
/* 002C */ CRITICAL_SECTION m_lock;
/* 0044 */ std::vector<CSAuthToken> m_tokens;
/* 0044 */ std::vector<lcCSAuthToken> m_tokens;
void ProcessAuth(int first, int second);
void Stop();
@ -33,7 +42,6 @@ public:
int HasError();
std::string ErrorMessage();
void SetHwnd(HWND window);
void ScalarDeletingDestructor(unsigned char flags);
int Initialize();
void IncrementCounter();
void SetError(const char* file, int line, std::string message);
@ -44,7 +52,7 @@ public:
static_assert(offsetof(CNProtectGameGuardMgr, m_errorMessage) == 0x14);
static_assert(offsetof(CNProtectGameGuardMgr, m_lock) == 0x2C);
static_assert(offsetof(CNProtectGameGuardMgr, m_tokens) == 0x44);
static_assert(sizeof(CNProtectGameGuardMgr::CSAuthToken) == 0x14);
static_assert(sizeof(CNProtectGameGuardMgr::lcCSAuthToken) == 0x14);
static_assert(sizeof(CNProtectGameGuardMgr) == 0x50);
#endif