RtlpCreateHashTable
UINT8 __stdcall RtlpCreateHashTable(
_RTL_DYNAMIC_HASH_TABLE **HashTable,
UINT64 InitialSize,
UINT64 Shift,
UINT64 Flags){
int v4;
int v5;
int v6;
unsigned int v7;
char *PoolWithTag;
int v10;
_LIST_ENTRY *v11;
__int64 v12;
unsigned int v14;
char v15;
unsigned int v16;
int v17;
VOID **v18;
VOID **v19;
__int64 v20;
_LIST_ENTRY *SecondLevelDir;
UINT64 v22;
VOID *v23;
v4 = InitialSize - 1;
v5 = Flags;
v6 = Shift;
v7 = InitialSize;
if( (((_DWORD)InitialSize - 1) & (unsigned int)InitialSize) != 0 || (unsigned int)(InitialSize - 128) > 0x7FFF00 )
return 0;
PoolWithTag = (char *)*HashTable;
v10 = 0;
if( !*HashTable )
{
PoolWithTag = (char *)ExAllocatePoolWithTag(0x200ui64, 0x28ui64, 1650545736i64);
if( !PoolWithTag )
return 0;
v10 = 1;
}
*(_QWORD *)(PoolWithTag + 20) = 0i64;
*(_QWORD *)(PoolWithTag + 28) = 0i64;
*((_DWORD *)PoolWithTag + 9) = 0;
*((_DWORD *)PoolWithTag + 3) = 0;
*(_DWORD *)PoolWithTag = v5 | v10;
*((_DWORD *)PoolWithTag + 2) = v7;
*((_DWORD *)PoolWithTag + 4) = v4;
*((_DWORD *)PoolWithTag + 1) = v6;
if( v7 > 0x80 )
{
_BitScanReverse(&v14, v7 + 127);
v15 = v14;
v16 = v14 - 7;
v17 = (v7 + 127) ^ (1 << v15);
v18 = ExAllocatePoolWithTag(0x200ui64, 0x80ui64, 1650545736i64);
v19 = v18;
if( v18 )
{
memset(v18, 0i64, 0x80u);
v20 = 0i64;
*((_QWORD *)PoolWithTag + 4) = v19;
while( 1 )
{
SecondLevelDir = RtlpAllocateSecondLevelDir((unsigned int)v20);
if( !SecondLevelDir )
break;
if( (unsigned int)v20 >= v16 )
v22 = (unsigned int)(v17 + 1);
else
v22 = (unsigned int)(1 << (v20 + 7));
RtlpInitializeSecondLevelDir(SecondLevelDir, v22);
v19[v20] = v23;
v20 = (unsigned int)(v20 + 1);
if( (unsigned int)v20 > v16 )
goto LABEL_7;
}
}
goto LABEL_18;
}
v11 = RtlpAllocateSecondLevelDir(0i64);
if( !v11 )
{
LABEL_18:
RtlDeleteHashTable((_RTL_DYNAMIC_HASH_TABLE *)PoolWithTag);
return 0;
}
RtlpInitializeSecondLevelDir(v11, *((unsigned int *)PoolWithTag + 2));
*((_QWORD *)PoolWithTag + 4) = v12;
LABEL_7:
*HashTable = (_RTL_DYNAMIC_HASH_TABLE *)PoolWithTag;
return 1;
}Referenced by:
RtlCreateHashTable
RtlCreateHashTableEx
SepInitializeSingletonAttributesStructures