SepReadAndInsertCaps
NTSTATUS __stdcall SepReadAndInsertCaps(_HANDLE KeyHandle){
int v1;
__int64 v2;
int v3;
unsigned int v4;
VOID *v5;
_RTL_DYNAMIC_HASH_TABLE_ENTRY *v6;
unsigned int *PoolWithTag;
int v8;
unsigned int v9;
unsigned int v10;
NTSTATUS v11;
NTSTATUS v12;
NTSTATUS SingleCap;
_RTL_DYNAMIC_HASH_TABLE *v14;
__int64 v15;
UINT64 v16;
_RTL_DYNAMIC_HASH_TABLE_ENTRY **ResultLength;
UINT64 *ResultLengtha;
UINT64 NumberOfBytes;
VOID *pHandle;
_RTL_DYNAMIC_HASH_TABLE_ENTRY *Entry;
int v23;
__int64 v24;
_RTL_DYNAMIC_HASH_TABLE *HashTable;
WCHAR pszDest[344];
v3 = *(_DWORD *)(v2 + 48);
v4 = v1 + 50;
HashTable = (_RTL_DYNAMIC_HASH_TABLE *)v2;
v5 = *(VOID **)&KeyHandle;
v6 = 0i64;
v24 = *(_QWORD *)(v2 + 56);
Entry = 0i64;
pHandle = 0i64;
LODWORD(NumberOfBytes) = 0;
v23 = v3;
PoolWithTag = (unsigned int *)ExAllocatePoolWithTag(1ui64, (unsigned int)(v1 + 50), 1884513619i64);
if( !PoolWithTag )
goto LABEL_2;
v8 = ZwQueryKey(v5, KeyFullInformation, PoolWithTag, v4, &NumberOfBytes);
if( v8 >= 0 )
goto LABEL_8;
if( v8 != -2147483643 && v8 != -1073741789 )
{
LABEL_28:
if( v8 >= 0 )
goto LABEL_33;
LABEL_29:
if( v6 )
ExFreePoolWithTag(v6, 0x70536553u);
goto LABEL_31;
}
PoolWithTag = (unsigned int *)SepRmCapPoolExpand(PoolWithTag, (unsigned int)NumberOfBytes);
if( !PoolWithTag )
{
LABEL_2:
v8 = -1073741670;
goto LABEL_31;
}
v4 = NumberOfBytes;
v8 = ZwQueryKey(v5, KeyFullInformation, PoolWithTag, (unsigned int)NumberOfBytes, &NumberOfBytes);
if( v8 >= 0 )
{
LABEL_8:
v9 = PoolWithTag[5];
v10 = 0;
if( v9 )
{
while( 1 )
{
LODWORD(ResultLength) = v4;
v11 = ZwEnumerateKey(v5, v10, KeyBasicInformation, PoolWithTag, (UINT64)ResultLength, &NumberOfBytes);
v8 = v11;
if( v11 < 0 )
{
if( v11 != -2147483643 && v11 != -1073741789 )
goto LABEL_28;
PoolWithTag = (unsigned int *)SepRmCapPoolExpand(PoolWithTag, (unsigned int)NumberOfBytes);
if( !PoolWithTag )
goto LABEL_2;
v4 = NumberOfBytes;
LODWORD(ResultLengtha) = NumberOfBytes;
v8 = ZwEnumerateKey(v5, v10, KeyBasicInformation, PoolWithTag, (UINT64)ResultLengtha, &NumberOfBytes);
if( v8 < 0 )
goto LABEL_31;
}
*((_WORD *)PoolWithTag + ((unsigned __int64)PoolWithTag[3] >> 1) + 8) = 0;
v8 = RtlStringCchPrintfW(pszDest, 0x156ui64, (WCHAR *)L"%s\\%s");
if( v8 < 0 )
goto LABEL_31;
v8 = SepRegOpenKey(pszDest, 0x201ui64, &pHandle);
if( v8 < 0 )
goto LABEL_31;
v12 = ZwQueryKey(pHandle, KeyFullInformation, PoolWithTag, v4, &NumberOfBytes);
v8 = v12;
if( v12 < 0 )
{
if( v12 != -2147483643 && v12 != -1073741789 )
goto LABEL_28;
PoolWithTag = (unsigned int *)SepRmCapPoolExpand(PoolWithTag, (unsigned int)NumberOfBytes);
if( !PoolWithTag )
goto LABEL_2;
v4 = NumberOfBytes;
v8 = ZwQueryKey(pHandle, KeyFullInformation, PoolWithTag, (unsigned int)NumberOfBytes, &NumberOfBytes);
if( v8 < 0 )
goto LABEL_31;
}
ResultLength = &Entry;
SingleCap = SepReadSingleCap((_HANDLE)pHandle, PoolWithTag[10]);
v6 = Entry;
v8 = SingleCap;
if( SingleCap < 0 )
goto LABEL_29;
v14 = HashTable;
Entry[1].Linkage.Blink = (_LIST_ENTRY *)HashTable;
v15 = *((unsigned int *)&v6[1].Linkage.Flink->Flink + (unsigned int)BYTE1(v6[1].Linkage.Flink->Flink) + 1);
v16 = v15 + 1;
if( (_DWORD)v15 )
v16 = *((unsigned int *)&v6[1].Linkage.Flink->Flink + (unsigned int)BYTE1(v6[1].Linkage.Flink->Flink) + 1);
if( !RtlInsertEntryHashTable(v14, v6, v16, 0i64) )
{
v8 = -1073741670;
goto LABEL_28;
}
v6 = 0i64;
Entry = 0i64;
ZwClose((_HANDLE)pHandle);
++v10;
pHandle = 0i64;
if( v10 >= v9 )
goto LABEL_28;
}
}
goto LABEL_28;
}
LABEL_31:
if( pHandle )
ZwClose((_HANDLE)pHandle);
LABEL_33:
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0x70536553u);
return v8;
}Referenced by:
No references.