PpmApplyProfile

VOID __stdcall PpmApplyProfile(VOID *Context){
  __int64 v1; 
  __int64 v3; 
  _POP_PPM_PROFILE *v4; 
  _POP_PPM_PROFILE *v5; 
  _POP_PPM_PROFILE *v6; 
  _POP_PPM_PROFILE *v7; 
  __int64 v8; 
  __int64 v9; 
  unsigned __int64 v10; 
  _PPM_POLICY_SETTINGS_MASK UpdateMask; 

  v1 = *(&stru_140C23628 + 441);
  v3 = 0i64;
  PpmAcquireLock((_PPM_LOCK *)((char *)&stru_140C23628 + 1048));
  PopAcquireRwLockExclusive((_POP_RW_LOCK *)((char *)&stru_140C23628 + 984));
  v4 = (_POP_PPM_PROFILE *)*(&stru_140C00F40 + 365);
  v5 = &PpmDefaultProfile;
  if( Context )
    v5 = (_POP_PPM_PROFILE *)Context;
  if( v5 == (_POP_PPM_PROFILE *)PpmLowPowerProfile )
  {
    v6 = v5;
    v5 = &PpmDefaultProfile;
    if( !*(&stru_140C23628 + 3532) )
      v5 = v6;
  }
  if( (_POP_PPM_PROFILE *)*(&stru_140C00F40 + 365) == v5 )
  {
    PopReleaseRwLock((_POP_RW_LOCK *)((char *)&stru_140C23628 + 984));
    PpmReleaseLock((INT64 *)&stru_140C23628 + 131);
  }
  else
  {
    PpmEndProfileAccumulation(*(&stru_140C00F40 + 365), *(UINT64 *)&KUSER_SHARED_DATA.InterruptTime.LowPart);
    v8 = 2i64;
    v5->Flags |= 2u;
    v4->Flags &= ~2u;
    *(&stru_140C00F40 + 365) = v5;
    v9 = 0i64;
    v5->StartTime = v10;
    do
    {
      if( v5 != v7 )
        v3 |= v5->Settings[v1].ExplicitSetting[v9].Value;
      if( v4 != v7 )
        v3 |= v4->Settings[v1].ExplicitSetting[v9].Value;
      ++v9;
      --v8;
    }
    while( v8 );
    UpdateMask.Value = v3 & 0x1CFFFFD8030FC0i64;
    PpmCompareAndApplyPolicySettings(&UpdateMask, &v4->Settings[v1], &v5->Settings[v1]);
    PpmEventTraceProfileChange(v4, v5);
    if( PpmLowPowerProfile )
    {
      if( v4 == (_POP_PPM_PROFILE *)PpmLowPowerProfile )
      {
        PpmAcquireLock((_PPM_LOCK *)((char *)&stru_140C23628 + 1048));
        PpmPostProcessMediaBuffering();
      }
    }
  }
}

Referenced by:

PdcPoPpmApplyProfile