PpmRegisterProfiles
NTSTATUS __stdcall PpmRegisterProfiles(UINT8 ProfileCount, PDC_PPM_PROFILE_REGISTRATION *ProfileInformation){
__int64 v3;
__int64 v4;
int v5;
unsigned __int8 v6;
ULONGLONG v7;
UINT64 v8;
size_t v9;
char v10;
VOID **PoolWithTag;
_POP_PPM_PROFILE *v12;
unsigned __int8 v13;
unsigned __int8 *p_Priority;
char *v15;
PDC_PPM_PROFILE_REGISTRATION *v16;
unsigned __int8 v17;
UINT64 v18;
_POP_PPM_PROFILE *v20;
UINT64 pcbLength;
ULONGLONG v22;
pcbLength = 0i64;
v22 = 0i64;
v3 = ProfileCount;
if( ProfileCount > 0x1Fu )
return -1073741811;
v4 = ProfileCount;
v5 = RtlULongLongMult(ProfileCount, 0x15B0ui64, &v22);
if( v5 >= 0 )
{
v6 = 0;
v7 = (v22 + 1) & 0xFFFFFFFFFFFFFFFEui64;
v8 = v7;
v9 = (v22 + 1) & 0xFFFFFFFE;
if( (_BYTE)v3 )
{
while( 1 )
{
v5 = RtlStringCbLengthW(*(WCHAR **)&ProfileInformation[8 * v6 + 2], 0x7FFFFFFFui64, &pcbLength);
if( v5 < 0 )
break;
v6 = v10 + 1;
v8 += pcbLength + 2;
v9 = v8;
if( v6 >= (unsigned __int8)v3 )
goto LABEL_6;
}
}
else
{
LABEL_6:
PoolWithTag = ExAllocatePoolWithTag(0x200ui64, v8, 1716342864i64);
v20 = (_POP_PPM_PROFILE *)PoolWithTag;
v12 = (_POP_PPM_PROFILE *)PoolWithTag;
if( PoolWithTag )
{
memset(PoolWithTag, 0i64, v9);
if( (_BYTE)v3 )
{
v13 = 0;
p_Priority = &v12->Priority;
v15 = (char *)v12 + v7;
v16 = ProfileInformation + 2;
do
{
++v13;
*(_OWORD *)(p_Priority - 20) = *(_OWORD *)*((_QWORD *)v16 - 1);
v17 = *((_BYTE *)v16 + 8);
*((_QWORD *)p_Priority + 688) = -1i64;
*p_Priority = v17;
*((_QWORD *)p_Priority - 4) = v15;
*(p_Priority - 24) = v13;
RtlStringCchLengthW(*(WCHAR **)v16, 0x7FFFFFFFui64, &pcbLength);
v18 = pcbLength;
RtlStringCchCopyW(*((WCHAR **)p_Priority - 4), pcbLength + 1, *(WCHAR **)v16);
*((_QWORD *)v16 + 2) = p_Priority - 32;
v15 += 2 * v18 + 2;
p_Priority += 5552;
v16 += 8;
}
while( v13 < (unsigned __int8)v3 );
v12 = v20;
v4 = v3;
}
PpmAcquireLock((_PPM_LOCK *)((char *)&stru_140C23628 + 1048));
PopAcquireRwLockExclusive((_POP_RW_LOCK *)((char *)&stru_140C23628 + 984));
PpmProfiles = (__int64)v12;
PpmProfileCount = v3;
if( (_BYTE)v3 )
{
do
{
PpmResetProfileSettings(v12++);
--v4;
}
while( v4 );
}
PpmEventTraceProfiles(0);
PopReleaseRwLock((_POP_RW_LOCK *)((char *)&stru_140C23628 + 984));
PpmReleaseLock((INT64 *)&stru_140C23628 + 131);
PpmProfileStatus |= 1u;
}
else
{
return -1073741670;
}
}
}
return v5;
}Referenced by:
PdcPoPpmRegisterProfiles