L L4D2node

MD5_Hash_File

0x001152d0 · 514 bytes · __cdecl

_Z13MD5_Hash_FilePhPKcbPj

Decompiled

undefined (4 params)

/* MD5_Hash_File(unsigned char*, char const*, bool, unsigned int*) */

undefined4 MD5_Hash_File(uchar *param_1,char *param_2,bool param_3,uint *param_4)

{
  char cVar1;
  int iVar2;
  undefined4 uVar3;
  uint uVar4;
  int iVar5;
  MD5Context_t *pMVar6;
  int in_GS_OFFSET;
  byte bVar7;
  void *local_47c;
  MD5Context_t local_478 [88];
  uchar local_420 [1024];
  int local_20;
  
  bVar7 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar2 = COM_OpenFile(param_2,&local_47c,0);
  if ((local_47c != (void *)0x0) && (iVar2 != -1)) {
    pMVar6 = local_478;
    for (iVar5 = 0x16; iVar5 != 0; iVar5 = iVar5 + -1) {
      *(undefined4 *)pMVar6 = 0;
      pMVar6 = pMVar6 + (uint)bVar7 * -8 + 4;
    }
    MD5Init(local_478);
    if (param_3) {
      MD5Update(local_478,(uchar *)param_4,0x10);
    }
    do {
      if (iVar2 < 1) {
        if (local_47c != (void *)0x0) {
          (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,local_47c);
        }
LAB_0011546f:
        MD5Final(param_1,local_478);
        uVar3 = 1;
        goto LAB_00115412;
      }
      if (iVar2 < 0x401) {
        uVar4 = (**(code **)g_pFileSystem[1])(g_pFileSystem + 1,local_420,iVar2);
      }
      else {
        uVar4 = (**(code **)g_pFileSystem[1])(g_pFileSystem + 1,local_420,0x400,local_47c);
      }
      if (0 < (int)uVar4) {
        iVar2 = iVar2 - uVar4;
        MD5Update(local_478,local_420,uVar4);
      }
      cVar1 = (**(code **)(*g_pFileSystem + 0x5c))(g_pFileSystem,local_47c);
      if (cVar1 != '\0') {
        (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,local_47c);
        local_47c = (void *)0x0;
        goto LAB_0011546f;
      }
      uVar3 = (**(code **)(*g_pFileSystem + 0x58))(g_pFileSystem,local_47c);
    } while ((char)uVar3 != '\0');
    if (local_47c != (void *)0x0) {
      (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,local_47c);
      goto LAB_00115412;
    }
  }
  uVar3 = 0;
LAB_00115412:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar3;
  }
                    /* WARNING: Subroutine does not return */
  __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)