L L4D2node

AllocWString

0x0004b360 · 107 bytes · __cdecl

_Z12AllocWStringPKwi

Decompiled

undefined (2 params)

/* AllocWString(wchar_t const*, int) */

wchar_t * AllocWString(wchar_t *param_1,int param_2)

{
  size_t sVar1;
  uint uVar2;
  wchar_t *pwVar3;
  uint uVar4;
  
  if (param_2 == -1) {
    sVar1 = wcslen(param_1);
    uVar4 = sVar1 + 1;
  }
  else {
    sVar1 = wcslen(param_1);
    uVar4 = sVar1 + 1;
    if (param_2 <= (int)sVar1) {
      uVar4 = param_2 + 1;
    }
  }
  uVar2 = uVar4 * 4;
  if (0x1fc00000 < uVar4) {
    uVar2 = 0xffffffff;
  }
  pwVar3 = operator_new__(uVar2);
  V_wcsncpy(pwVar3,param_1,uVar4 * 4);
  return pwVar3;
}

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)