EtwpSetProviderTraitsCommon
INT64 __fastcall EtwpSetProviderTraitsCommon(
_ETW_REG_ENTRY *RegEntry,
_ETW_PROVIDER_TRAITS *Traits,
_FAST_MUTEX *Mutex,
_RTL_RB_TREE *Tree){
unsigned __int64 v4;
__int16 v6;
__int64 v7;
bool v8;
_DWORD *v9;
unsigned __int64 v10;
unsigned __int64 v11;
bool v12;
char v13;
NTSTATUS v14;
unsigned __int64 v15;
unsigned int v16;
const _GUID *ProviderGroupFromTraits;
unsigned int v20;
PVOID P;
_GUID v24;
INT64 a1;
unsigned int v26;
PFAST_MUTEX FastMutex;
__int64 v28;
v4 = a1;
v6 = 0;
v20 = (unsigned int)Traits;
P = (PVOID)a1;
if( v26 < 3 )
goto LABEL_39;
if( *(unsigned __int16 *)(a1 + 28) != v26 )
goto LABEL_39;
v7 = (unsigned int)strnlen((const char *)(a1 + 30), v26 - 2) + 3;
v8 = (_DWORD)v7 == v26;
if( (unsigned int)v7 > v26 )
goto LABEL_39;
if( (unsigned int)v7 < v26 )
{
while( (int)v7 + 2 <= v26 )
{
LODWORD(v7) = *(unsigned __int16 *)(v7 + a1 + 28) + (_DWORD)v7;
v8 = (_DWORD)v7 == v26;
if( (unsigned int)v7 >= v26 )
goto LABEL_7;
}
LABEL_39:
v16 = -1073741566;
goto LABEL_29;
}
LABEL_7:
if( !v8 )
goto LABEL_39;
v9 = (_DWORD *)(a1 + 24);
*(_OWORD *)a1 = 0i64;
*(_QWORD *)(a1 + 16) = 0i64;
*(_DWORD *)(a1 + 24) = 1;
ExAcquireFastMutex(FastMutex);
if( (*(_BYTE *)(v28 + 8) & 1) != 0 )
{
v11 = *(_QWORD *)v28;
if( !*(_QWORD *)v28 )
goto LABEL_33;
v10 = v28 ^ v11;
}
else
{
v10 = *(_QWORD *)v28;
v11 = *(_QWORD *)v28;
}
if( !v10 )
{
LABEL_33:
v11 = 0i64;
v12 = 0;
v13 = 0;
goto LABEL_34;
}
v12 = 0;
v13 = 0;
if( !v11 )
{
LABEL_19:
if( !v13 )
goto LABEL_34;
v9 = (_DWORD *)(v11 + 24);
v4 = v11;
++*(_DWORD *)(v11 + 24);
goto LABEL_21;
}
while( 1 )
{
v14 = TraitsCompare(a1, v11);
if( v14 > 0 )
break;
if( v14 >= 0 )
{
v13 = 1;
goto LABEL_19;
}
v15 = *(_QWORD *)v11;
if( !*(_QWORD *)v11 )
{
v12 = 0;
goto LABEL_34;
}
LABEL_14:
v11 = v15;
}
v15 = *(_QWORD *)(v11 + 8);
if( v15 )
goto LABEL_14;
v12 = 1;
LABEL_34:
RtlRbInsertNodeEx((unsigned __int64 *)v28, v11, v12, a1);
P = 0i64;
LABEL_21:
if( _InterlockedCompareExchange64((volatile signed __int64 *)&Tree[6].8, v4, 0i64) )
{
if( v13 )
{
--*v9;
}
else
{
RtlRbRemoveNode((unsigned __int64 *)v28, v4);
P = (PVOID)v4;
}
v16 = -1073741823;
}
else
{
v16 = 0;
}
KeReleaseGuardedMutex(FastMutex);
if( !v16 )
{
if( *(_WORD *)(v4 + 28) == 22 && *(_DWORD *)(v4 + 30) == 33559296 )
{
if( AddDecodeGuidToSessions((INT64)Tree) )
v6 = 1024;
LABEL_28:
_InterlockedOr16((volatile signed __int16 *)&Tree[6].Root + 1, v6 | 0x200);
}
else
{
if( Tree[2].Min )
goto LABEL_28;
ProviderGroupFromTraits = EtwpGetProviderGroupFromTraits((const VOID *)(v4 + 28));
if( !ProviderGroupFromTraits )
goto LABEL_28;
v24 = *ProviderGroupFromTraits;
v16 = EtwpAddRegEntryToGroup((__int64)Tree, &v24.Data1, (__int64)RegEntry, v20, (unsigned int *)Mutex);
if( !v16 )
goto LABEL_28;
EtwpReleaseProviderTraitsReference((INT64)Tree);
}
}
LABEL_29:
if( P )
ExFreePoolWithTag(P, 0);
return v16;
}Referenced by:
EtwpSetProviderTraitsKm
EtwpSetProviderTraitsUm