L L4D2node

COM_DecryptBuffer

0x00127810 · 254 bytes · __cdecl

_Z17COM_DecryptBufferPhjPKh

Decompiled

undefined (3 params)

/* COM_DecryptBuffer(unsigned char*, unsigned int, unsigned char const*) */

void COM_DecryptBuffer(uchar *param_1,uint param_2,uchar *param_3)

{
  int iVar1;
  undefined1 *puVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  IceKey *pIVar6;
  int in_GS_OFFSET;
  int iStackY_50;
  undefined1 auStack_40 [4];
  uchar *local_3c;
  undefined1 *local_38;
  int local_34;
  undefined1 *local_30;
  IceKey local_2c [12];
  int local_20;
  
  pIVar6 = (IceKey *)&stack0xffffffb4;
  local_3c = param_1;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (param_3 != (uchar *)0x0) {
    iStackY_50 = 0x12784a;
    IceKey::IceKey(local_2c,0);
                    /* try { // try from 00127854 to 001278e9 has its CatchHandler @ 00127909 */
    iStackY_50 = 0x127859;
    IceKey::set(local_2c,param_3);
    iStackY_50 = 0x127864;
    uVar4 = IceKey::blockSize();
    iVar1 = -(((((uVar4 - 1) + param_2) / uVar4) * uVar4 + 0xf & 0xfffffff0) + 0x10);
    pIVar6 = local_2c + iVar1 + -0x20;
    local_38 = auStack_40 + iVar1;
    uVar5 = param_2;
    if ((int)uVar4 <= (int)param_2) {
      local_34 = -uVar4;
      local_30 = auStack_40 + iVar1;
      uVar3 = param_2 - uVar4;
      do {
        uVar5 = uVar3;
        puVar2 = local_30;
        *(uchar **)(local_2c + iVar1 + -0x1c) = param_1;
        *(undefined1 **)(&stack0xffffffbc + iVar1) = puVar2;
        *(IceKey **)(local_2c + iVar1 + -0x20) = local_2c;
        *(undefined4 *)((int)&iStackY_50 + iVar1) = 0x1278be;
        IceKey::decrypt(*(IceKey **)(local_2c + iVar1 + -0x20),*(uchar **)(local_2c + iVar1 + -0x1c)
                        ,*(uchar **)(&stack0xffffffbc + iVar1));
        local_30 = local_30 + uVar4;
        param_1 = param_1 + uVar4;
        uVar3 = uVar5 + local_34;
      } while ((int)uVar4 <= (int)(uVar5 + local_34 + uVar4));
    }
    *(uint *)(&stack0xffffffbc + iVar1) = param_2 - uVar5;
    *(undefined1 **)(local_2c + iVar1 + -0x1c) = local_38;
    *(uchar **)(local_2c + iVar1 + -0x20) = local_3c;
    *(undefined4 *)((int)&iStackY_50 + iVar1) = 0x1278ea;
    _V_memcpy(*(void **)(local_2c + iVar1 + -0x20),*(void **)(local_2c + iVar1 + -0x1c),
              *(int *)(&stack0xffffffbc + iVar1));
    *(IceKey **)(local_2c + iVar1 + -0x20) = local_2c;
    *(undefined4 *)((int)&iStackY_50 + iVar1) = 0x1278f5;
    IceKey::~IceKey(*(IceKey **)(local_2c + iVar1 + -0x20));
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  *(undefined **)(pIVar6 + -4) = &UNK_00127923;
  __stack_chk_fail();
}

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)