SafeReallocBlob

VOID *__stdcall SafeReallocBlob(
        VOID *BugCheckParameter2,
        UINT64 HeaderSize,
        UINT64 NumElements,
        UINT64 ElementSize,
        UINT64 *TotalSizeOut,
        UINT64 ElementSize2,
        UINT64 *a7){
  unsigned __int64 v8; 
  unsigned int v9; 
  size_t v10; 
  VOID **PoolWithTag; 
  VOID **v12; 

  if( !BugCheckParameter2 )
    return 0i64;
  v8 = (unsigned int)ElementSize * (unsigned __int64)(unsigned int)NumElements;
  if( v8 > 0xFFFFFFFF )
    return 0i64;
  v9 = v8 + HeaderSize;
  if( (int)v8 + (int)HeaderSize < (unsigned int)HeaderSize )
    return 0i64;
  if( a7 )
    *(_DWORD *)a7 = v9;
  if( v9 )
  {
    v10 = v8 + HeaderSize;
    PoolWithTag = ExAllocatePoolWithTag(1ui64, v9, 1920232557i64);
    v12 = PoolWithTag;
    if( PoolWithTag )
      memset(PoolWithTag, 0i64, v10);
  }
  else
  {
    v12 = 0i64;
  }
  if( !v12 )
    return 0i64;
  memmove(v12, BugCheckParameter2, *(_DWORD *)BugCheckParameter2);
  ExFreeHeapPool(BugCheckParameter2);
  return v12;
}

Referenced by:

RtlpMuiRegResizeLanguageConfigList
RtlpMuiRegResizeLanguages