EmpParseTargetRules
NTSTATUS __stdcall EmpParseTargetRules(VOID *ParsedInfHandle){
NTSTATUS v2;
unsigned int v3;
unsigned int v4;
char *KeyName;
_EMP_RULE_DB_RECORD *v6;
_EMP_RULE_DB_RECORD *v7;
_EMP_RULE_DB_RECORD v8;
int v9;
VOID **StringIndexList;
_EMP_TARGET_RULE *v11;
int v12;
unsigned int v13;
VOID **v14;
unsigned int v15;
unsigned int i;
INT8 *SectionLineIndex;
VOID **v18;
VOID **PoolWithTag;
UINT64 v21;
UINT64 IndexListCount;
UINT64 StartingIndex;
unsigned int SectionLineCount;
UINT64 ValueIndex;
NTSTATUS GuidFromName;
_GUID NameGuid;
NameGuid = 0i64;
v2 = 0;
SectionLineCount = EmpInfParseGetSectionLineCount(ParsedInfHandle, (INT8 *)"TargetRuleDef");
v3 = SectionLineCount;
if( SectionLineCount )
{
v4 = 0;
while( 1 )
{
v2 = 0;
KeyName = CmpGetKeyName(ParsedInfHandle, (PSTR)"TargetRuleDef", v4);
if( !KeyName )
goto LABEL_17;
GuidFromName = EmpInfParseGetGuidFromName(ParsedInfHandle, (PSTR)"RuleNameGuidDef", KeyName, &NameGuid);
v2 = GuidFromName;
if( GuidFromName < 0 )
goto LABEL_17;
EmpSearchRuleDatabase();
v7 = v6;
if( !v6 )
goto LABEL_17;
v8 = v6[10];
v9 = 0;
StringIndexList = 0i64;
LODWORD(StartingIndex) = 0;
if( !(v6[11] + v8) )
goto LABEL_16;
HIDWORD(StartingIndex) = CmpGetSectionLineIndexValueCount(ParsedInfHandle, (PSTR)"TargetRuleDef", v4);
if( HIDWORD(StartingIndex) )
break;
LABEL_17:
if( ++v4 >= v3 )
return v2;
}
v11 = EmpSearchTargetRuleList(v7);
v13 = v12 * (v7[11] + v7[10]);
ValueIndex = (UINT64)v11;
if( v11 )
{
v13 += v11[6];
PoolWithTag = ExAllocatePoolWithTag(1ui64, 4i64 * v13, 1953058117i64);
StringIndexList = PoolWithTag;
if( !PoolWithTag )
return -1073741670;
memset(PoolWithTag, 0i64, 4 * v13);
v21 = ValueIndex;
memmove(StringIndexList, *(const VOID **)(ValueIndex + 16), 4 * *(_DWORD *)(ValueIndex + 24));
v9 = *(_DWORD *)(v21 + 24);
LODWORD(StartingIndex) = v9;
ExFreePoolWithTag(*(PVOID *)(ValueIndex + 16), 0x74694D45u);
}
else
{
v14 = ExAllocatePoolWithTag(1ui64, 4i64 * v13, 1953058117i64);
StringIndexList = v14;
if( !v14 )
return -1073741670;
memset(v14, 0i64, 4 * v13);
v3 = SectionLineCount;
}
LODWORD(ValueIndex) = 0;
if( HIDWORD(StartingIndex) )
{
v15 = HIDWORD(StartingIndex);
for( i = ValueIndex; i < v15; ++i )
{
SectionLineIndex = CmpGetSectionLineIndex(ParsedInfHandle, (PSTR)"TargetRuleDef", v4, i);
LODWORD(IndexListCount) = v13;
EmpParseTargetRuleStringIndexList(
ParsedInfHandle,
SectionLineIndex,
(unsigned int)v7[10],
(unsigned int)v7[11],
(UINT64 *)StringIndexList,
IndexListCount,
&StartingIndex);
}
v2 = GuidFromName;
v3 = SectionLineCount;
v9 = StartingIndex;
}
if( !v9 )
{
ExFreePoolWithTag(StringIndexList, 0x74694D45u);
goto LABEL_17;
}
LABEL_16:
v18 = ExAllocatePoolWithTag(1ui64, 0x28ui64, 1953058117i64);
*(_DWORD *)v18 = 0;
++dword_140C5088C;
v18[1] = v7;
v18[2] = StringIndexList;
*((_DWORD *)v18 + 6) = v9;
v18[4] = (VOID *)EmpTargetRuleListHead;
EmpTargetRuleListHead = (__int64)(v18 + 4);
goto LABEL_17;
}
return v2;
}Referenced by:
EmpParseInfDatabase