CPhoneHome::SendSessionMessage
0x00181b30 · 2002 bytes · __thiscall
_ZN10CPhoneHome18SendSessionMessageEhPKc
Decompiled
undefined (3 params)
/* CPhoneHome::SendSessionMessage(unsigned char, char const*) */
void __thiscall CPhoneHome::SendSessionMessage(CPhoneHome *this,uchar param_1,char *param_2)
{
uint *puVar1;
char cVar2;
byte bVar3;
int iVar4;
__uid_t __uid;
passwd *ppVar5;
long lVar6;
int *piVar7;
uint uVar8;
uint uVar9;
byte bVar10;
int in_GS_OFFSET;
IceKey local_10b8 [12];
uchar *local_10ac [3];
int local_10a0;
uchar *local_1094;
char local_1090;
undefined4 local_108c;
int local_1088;
uint local_1084;
int local_1080;
uint *local_107c;
uint *local_1078;
sockaddr local_1070;
sockaddr_in local_1060 [63];
undefined1 local_1021;
undefined1 local_1020 [2048];
uchar local_820 [2048];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
uVar8 = local_1084;
if (*(int *)(this + 0x38) != 0) {
bf_write::bf_write((bf_write *)local_10ac);
bf_write::StartWriting((bf_write *)local_10ac,local_1020,0x800,0,-1);
lVar6 = *(long *)(this + 0x38);
bf_write::bf_write((bf_write *)&local_1094);
bf_write::WriteByte((bf_write *)local_10ac,0x6d);
bf_write::WriteByte((bf_write *)local_10ac,10);
bf_write::WriteByte((bf_write *)local_10ac,3);
bf_write::WriteLong((bf_write *)local_10ac,lVar6);
IceKey::IceKey(local_10b8,1);
local_1070.sa_family._0_1_ = 0xbf;
local_1070.sa_family._1_1_ = 1;
local_1070.sa_data[0] = '\0';
local_1070.sa_data[1] = -0x22;
local_1070.sa_data[2] = 'U';
local_1070.sa_data[3] = '\'';
local_1070.sa_data[4] = -0x66;
local_1070.sa_data[5] = '\x01';
/* try { // try from 00181c84 to 00181eb9 has its CatchHandler @ 001822ac */
IceKey::set(local_10b8,(uchar *)&local_1070);
bf_write::StartWriting((bf_write *)&local_1094,local_820,0x800,0,-1);
bf_write::WriteByte((bf_write *)&local_1094,1);
bf_write::WriteByte((bf_write *)&local_1094,1);
bf_write::WriteString((bf_write *)&local_1094,(char *)(this + 0x14));
_V_memset(local_1060,0,0x40);
iVar4 = gethostname((char *)local_1060,0x40);
if (iVar4 == -1) {
/* try { // try from 001820a3 to 001820bc has its CatchHandler @ 001822ac */
V_strncpy((char *)local_1060,"Linux????",0x40);
}
local_1021 = 0;
bf_write::WriteString((bf_write *)&local_1094,(char *)local_1060);
_V_memset(local_1060,0,0x40);
__uid = getuid();
ppVar5 = getpwuid(__uid);
if (ppVar5 == (passwd *)0x0) {
V_strncpy((char *)local_1060,"LinuxUser??",0x40);
}
else {
V_strncpy((char *)local_1060,ppVar5->pw_name,0x40);
}
local_1021 = 0;
bf_write::WriteString((bf_write *)&local_1094,(char *)local_1060);
V_FileBase(com_gamedir,(char *)local_1060,0x40);
bf_write::WriteString((bf_write *)&local_1094,(char *)local_1060);
lVar6 = build_number();
bf_write::WriteLong((bf_write *)&local_1094,lVar6);
bf_write::WriteFloat((float)&local_1094);
bf_write::WriteByte((bf_write *)&local_1094,(uint)param_1);
if (param_2 != (char *)0x0) {
bf_write::WriteString((bf_write *)&local_1094,param_2);
}
cVar2 = Sys_IsDebuggerPresent();
if (cVar2 == '\0') {
piVar7 = (int *)CommandLine_Tier0();
iVar4 = (**(code **)(*piVar7 + 0x28))(piVar7,"-allowdebug");
uVar8 = (uint)(iVar4 != 0);
}
else {
uVar8 = 1;
}
bf_write::WriteByte((bf_write *)&local_1094,uVar8);
while (uVar8 = local_1088 + 7 >> 3, (uVar8 & 7) != 0) {
bf_write::WriteByte((bf_write *)&local_1094,0);
}
EncryptBuffer(local_10b8,local_1094,uVar8);
bf_write::WriteShort((bf_write *)local_10ac,local_1088 + 7 >> 3);
bf_write::WriteBytes((bf_write *)local_10ac,local_1094,local_1088 + 7 >> 3);
IceKey::~IceKey(local_10b8);
netadr_s::ToSockadr((netadr_s *)(this + 8),&local_1070);
CBlockingUDPSocket::SendSocketMessage
(*(CBlockingUDPSocket **)(this + 0x3c),(sockaddr_in *)&local_1070,local_10ac[0],
local_10a0 + 7 >> 3);
uVar8 = local_1084;
if ((*(int *)(this + 0x38) == 0) &&
(cVar2 = CBlockingUDPSocket::WaitForMessage(*(CBlockingUDPSocket **)(this + 0x3c),1.5),
uVar8 = local_1084, cVar2 != '\0')) {
local_1090 = '\0';
local_1094 = (uchar *)0x0;
local_108c = 0xffffffff;
local_1088 = 0;
CBitRead::StartReading((CBitRead *)&local_1094,local_820,0x80,0,-1);
iVar4 = CBlockingUDPSocket::ReceiveSocketMessage
(*(CBlockingUDPSocket **)(this + 0x3c),local_1060,local_820,0x80);
uVar8 = local_1084;
if (iVar4 != 0) {
CBitRead::StartReading((CBitRead *)&local_1094,local_820,iVar4,0,-1);
bVar3 = (byte)local_1084;
if (local_1080 < 8) {
uVar8 = local_1084;
if ((local_107c == local_1078) || (local_1078 <= local_107c)) goto LAB_00181b63;
puVar1 = local_107c + 1;
uVar8 = *local_107c;
local_107c = puVar1;
if (local_1090 != '\0') goto LAB_00181b63;
iVar4 = 8 - local_1080;
bVar10 = (byte)local_1080;
local_1080 = local_1080 + 0x18;
bVar3 = (byte)(((&CBitBuffer::s_nMaskTable)[iVar4] & uVar8) << (bVar10 & 0x1f)) | bVar3;
local_1084 = uVar8 >> ((byte)iVar4 & 0x1f);
}
else {
local_1080 = local_1080 + -8;
if (local_1080 == 0) {
local_1080 = 0x20;
if (local_107c == local_1078) {
local_1080 = 1;
local_1084 = 0;
local_107c = local_107c + 1;
}
else if (local_1078 < local_107c) {
local_1090 = '\x01';
local_1084 = 0;
}
else {
local_1084 = *local_107c;
local_107c = local_107c + 1;
}
}
else {
local_1084 = local_1084 >> 8;
}
}
uVar8 = local_1084;
if (bVar3 == 0x6e) {
if (local_1080 < 8) {
if ((local_107c == local_1078) || (local_1078 <= local_107c)) goto LAB_00181b63;
puVar1 = local_107c + 1;
uVar8 = *local_107c;
local_107c = puVar1;
if (local_1090 != '\0') goto LAB_00181b63;
iVar4 = 8 - local_1080;
bVar3 = (byte)local_1080;
local_1080 = local_1080 + 0x18;
uVar9 = ((&CBitBuffer::s_nMaskTable)[iVar4] & uVar8) << (bVar3 & 0x1f) | local_1084;
local_1084 = uVar8 >> ((byte)iVar4 & 0x1f);
}
else {
local_1080 = local_1080 + -8;
uVar9 = local_1084 & 0xff;
if (local_1080 == 0) {
local_1080 = 0x20;
if (local_107c == local_1078) {
local_1080 = 1;
local_1084 = 0;
local_107c = local_107c + 1;
}
else if (local_1078 < local_107c) {
local_1090 = '\x01';
local_1084 = 0;
}
else {
local_1084 = *local_107c;
local_107c = local_107c + 1;
}
}
else {
local_1084 = local_1084 >> 8;
}
}
iVar4 = local_1080;
uVar8 = local_1084;
if (uVar9 == 1) {
uVar9 = local_1084;
if (local_1080 < 0x20) {
if (local_107c == local_1078) {
local_1080 = 1;
local_1084 = 0;
local_1090 = '\x01';
}
else if (local_1078 < local_107c) {
local_1090 = '\x01';
local_1084 = 0;
}
else {
local_1084 = *local_107c;
local_107c = local_107c + 1;
}
uVar9 = 0;
if (local_1090 == '\0') {
uVar9 = ((&CBitBuffer::s_nMaskTable)[0x20 - iVar4] & local_1084) <<
((byte)local_1080 & 0x1f) | uVar8;
}
}
*(uint *)(this + 0x38) = uVar9;
uVar8 = local_1084;
}
}
}
}
}
LAB_00181b63:
local_1084 = uVar8;
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.