L L4D2node

CPhoneHome::RequestSessionId

0x00182330 · 1953 bytes · __thiscall

_ZN10CPhoneHome16RequestSessionIdERj

Decompiled

undefined (2 params)

/* CPhoneHome::RequestSessionId(unsigned int&) */

undefined4 __thiscall CPhoneHome::RequestSessionId(CPhoneHome *this,uint *param_1)

{
  uint *puVar1;
  char cVar2;
  byte bVar3;
  int iVar4;
  __uid_t __uid;
  passwd *ppVar5;
  long lVar6;
  int *piVar7;
  uint uVar8;
  undefined4 uVar9;
  int iVar10;
  uint uVar11;
  byte bVar12;
  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);
  *param_1 = 0;
  bf_write::bf_write((bf_write *)local_10ac);
  bf_write::StartWriting((bf_write *)local_10ac,local_1020,0x800,0,-1);
  uVar8 = *param_1;
  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,uVar8);
  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 0018244d to 00182685 has its CatchHandler @ 00182add */
  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 001828a9 to 001828c8 has its CatchHandler @ 00182add */
    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,1);
  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);
  iVar4 = 3;
  IceKey::~IceKey(local_10b8);
  netadr_s::ToSockadr((netadr_s *)(this + 8),&local_1070);
  do {
    CBlockingUDPSocket::SendSocketMessage
              (*(CBlockingUDPSocket **)(this + 0x3c),(sockaddr_in *)&local_1070,local_10ac[0],
               local_10a0 + 7 >> 3);
    uVar9 = CBlockingUDPSocket::WaitForMessage(*(CBlockingUDPSocket **)(this + 0x3c),1.5);
    if ((char)uVar9 != '\0') {
      local_1090 = '\0';
      local_1094 = (uchar *)0x0;
      local_108c = 0xffffffff;
      local_1088 = 0;
      CBitRead::StartReading((CBitRead *)&local_1094,local_820,0x80,0,-1);
      iVar10 = CBlockingUDPSocket::ReceiveSocketMessage
                         (*(CBlockingUDPSocket **)(this + 0x3c),local_1060,local_820,0x80);
      if (iVar10 != 0) {
        CBitRead::StartReading((CBitRead *)&local_1094,local_820,iVar10,0,-1);
        bVar3 = (byte)local_1084;
        if (local_1080 < 8) {
          uVar8 = local_1084;
          if ((local_107c == local_1078) || (local_1078 <= local_107c)) break;
          puVar1 = local_107c + 1;
          uVar8 = *local_107c;
          local_107c = puVar1;
          if (local_1090 != '\0') break;
          iVar4 = 8 - local_1080;
          bVar12 = (byte)local_1080;
          local_1080 = local_1080 + 0x18;
          bVar3 = (byte)(((&CBitBuffer::s_nMaskTable)[iVar4] & uVar8) << (bVar12 & 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) break;
        if (local_1080 < 8) {
          if ((local_107c == local_1078) || (local_1078 <= local_107c)) break;
          puVar1 = local_107c + 1;
          uVar8 = *local_107c;
          local_107c = puVar1;
          if (local_1090 != '\0') break;
          iVar4 = 8 - local_1080;
          bVar3 = (byte)local_1080;
          local_1080 = local_1080 + 0x18;
          uVar11 = ((&CBitBuffer::s_nMaskTable)[iVar4] & uVar8) << (bVar3 & 0x1f) | local_1084;
          local_1084 = uVar8 >> ((byte)iVar4 & 0x1f);
        }
        else {
          local_1080 = local_1080 + -8;
          uVar11 = 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;
          }
        }
        uVar8 = local_1084;
        if (uVar11 == 1) {
          uVar11 = local_1084;
          if (local_1080 < 0x20) {
            uVar11 = 0;
            if ((local_107c != local_1078) && (local_107c < local_1078)) {
              puVar1 = local_107c + 1;
              uVar8 = *local_107c;
              local_107c = puVar1;
              if (local_1090 == '\0') {
                uVar11 = ((&CBitBuffer::s_nMaskTable)[0x20 - local_1080] & uVar8) <<
                         ((byte)local_1080 & 0x1f) | local_1084;
              }
            }
          }
          local_1084 = uVar8;
          *param_1 = uVar11;
          goto LAB_001826fd;
        }
        break;
      }
    }
    iVar4 = iVar4 + -1;
    uVar8 = local_1084;
  } while (iVar4 != 0);
  local_1084 = uVar8;
  uVar9 = 0;
LAB_001826fd:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return uVar9;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)