PopDiagTraceThermalZoneEnumeration

VOID __fastcall PopDiagTraceThermalZoneEnumeration(
        _THERMAL_INFORMATION_EX *ThermalInfo,
        _UNICODE_STRING *Description,
        _DEVICE_OBJECT *DeviceObject){
  DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  DEVICE_OBJECT *v5; 
  UNICODE_STRING *v6; 
  UNICODE_STRING *v7; 
  unsigned int v8; 
  unsigned int v9; 
  unsigned int v10; 
  unsigned int v11; 
  unsigned int v12; 
  unsigned int v13; 
  unsigned int *v14; 
  unsigned int v15; 
  unsigned int v16; 
  __int64 v17; 
  __int64 v18; 
  UNICODE_STRING *v19; 
  __int64 v20; 
  unsigned int Length; 
  __int64 v22; 
  unsigned int v23; 
  __int64 v24; 
  __int64 v25; 
  __int64 v26; 
  __int64 v27; 
  __int64 v28; 
  __int64 v29; 
  PEVENT_DATA_DESCRIPTOR UserData; 
  UINT64 SamplingPeriod; 
  UINT64 ActiveTripPoint0; 
  UINT64 ActiveTripPoint1; 
  UINT64 CriticalTripPoint; 
  UINT64 S4TransitionTripPoint; 
  UINT64 ThermalStandbyTripPoint; 
  unsigned __int16 v37; 
  __int16 v38; 
  unsigned int v39; 
  unsigned int v40; 
  unsigned int v41; 
  UNICODE_STRING *Descriptiona; 
  unsigned __int16 v43; 
  EVENT_DATA_DESCRIPTOR v44; 
  wchar_t *Buffer; 
  int v46; 
  int v47; 
  int *v48; 
  __int64 v49; 
  unsigned int *p_ThermalConstant1; 
  __int64 v51; 
  unsigned int *p_ThermalConstant2; 
  __int64 v53; 
  unsigned int *p_SamplingPeriod; 
  __int64 v55; 
  _DWORD v56[10]; 
  Descriptiona = Description;
  v39 = 0;
  v38 = 0;
  v37 = 0;
  v40 = 0;
  v41 = 0;
  if( PopDiagHandleRegistered )
  {
    DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(DeviceObject, 0x67446F50ui64);
    v5 = DeviceAttachmentBaseRefWithTag;
    if( DeviceAttachmentBaseRefWithTag )
      v6 = *(UNICODE_STRING **)(*((_QWORD *)DeviceAttachmentBaseRefWithTag + 39) + 40i64);
    else
      v6 = 0i64;
    if( v6 )
    {
      v7 = v6 + 8;
      v43 = v6[8].Length >> 1;
      v37 = v43;
      v8 = ThermalInfo->PassiveTripPoint / 0xA;
      v9 = ThermalInfo->CriticalTripPoint;
      v40 = v8;
      v10 = v9 / 0xA;
      v11 = ThermalInfo->S4TransitionTripPoint;
      v39 = v9 / 0xA;
      v12 = v11 / 0xA;
      v13 = ThermalInfo->ThermalStandbyTripPoint;
      v41 = v11 / 0xA;
      if( EtwEventEnabled(
             PopDiagHandle,
             (EVENT_DESCRIPTOR *)&POP_ETW_EVENT_THERMAL_ZONE_ENUMERATED,
             (EVENT_DESCRIPTOR *)0xCCCCCCCDi64) )
      {
        *(_QWORD *)&v44.Size = 2i64;
        v44.Ptr = (unsigned __int64)&v37;
        v14 = v56;
        v15 = 0;
        Buffer = v7->Buffer;
        v16 = 6;
        v47 = 0;
        v46 = 2 * v43;
        v49 = 4i64;
        v48 = (int *)&v40;
        p_ThermalConstant1 = &ThermalInfo->ThermalConstant1;
        p_ThermalConstant2 = &ThermalInfo->ThermalConstant2;
        p_SamplingPeriod = &ThermalInfo->SamplingPeriod;
        v51 = 4i64;
        v53 = 4i64;
        v55 = 4i64;
        do
        {
          v17 = v15++;
          *v14 = *(unsigned int *)((char *)v14 + (char *)ThermalInfo - (char *)v56 + 36) / 0xA;
          ++v14;
          v18 = v16++;
          v18 *= 2i64;
          *(&v44.Ptr + v18) = (unsigned __int64)&v56[v17];
          *((_QWORD *)&v44.Size + v18) = 4i64;
        }
        while( v15 < 0xA );
        v19 = Descriptiona;
        v20 = 2i64 * v16;
        Length = Descriptiona->Length;
        *(&v44.Ptr + v20) = (unsigned __int64)&v39;
        *((_QWORD *)&v44.Size + v20) = 4i64;
        v22 = v16 + 1;
        v23 = v16 + 2;
        v22 *= 2i64;
        *(&v44.Ptr + v22) = (unsigned __int64)&v41;
        *((_QWORD *)&v44.Size + v22) = 4i64;
        v24 = 2i64 * v23;
        *(&v44.Ptr + v24) = (unsigned __int64)&ThermalInfo->MinimumThrottle;
        *((_QWORD *)&v44.Size + v24) = 4i64;
        v25 = v23 + 1;
        v23 += 2;
        v25 *= 2i64;
        *(&v44.Ptr + v25) = (unsigned __int64)&ThermalInfo->ThermalStandbyTripPoint;
        *((_QWORD *)&v44.Size + v25) = 4i64;
        v26 = 2i64 * v23;
        *(&v44.Ptr + v26) = (unsigned __int64)&ThermalInfo->OverThrottleThreshold;
        *((_QWORD *)&v44.Size + v26) = 4i64;
        v38 = (unsigned __int16)Length >> 1;
        v27 = v23 + 1;
        v23 += 2;
        v27 *= 2i64;
        *(&v44.Ptr + v27) = (unsigned __int64)&v38;
        *((_QWORD *)&v44.Size + v27) = 2i64;
        v28 = 2i64 * v23;
        *(&v44.Ptr + v28) = (unsigned __int64)v19->Buffer;
        *(&v44.Size + 2 * v28) = Length;
        *(&v44.Reserved + 2 * v28) = 0;
        v29 = 2i64 * (v23 + 1);
        *(&v44.Ptr + v29) = (unsigned __int64)&ThermalInfo->PollingPeriod;
        *((_QWORD *)&v44.Size + v29) = 4i64;
        EtwWrite(PopDiagHandle, (EVENT_DESCRIPTOR *)&POP_ETW_EVENT_THERMAL_ZONE_ENUMERATED, 0i64, 0x18ui64, &v44);
        v10 = v39;
        v8 = v40;
        v12 = v41;
      }
      LODWORD(ThermalStandbyTripPoint) = v13 / 0xA;
      LODWORD(S4TransitionTripPoint) = v12;
      LODWORD(CriticalTripPoint) = v10;
      LODWORD(ActiveTripPoint1) = ThermalInfo->ActiveTripPoint[1] / 0xA;
      LODWORD(ActiveTripPoint0) = ThermalInfo->ActiveTripPoint[0] / 0xA;
      LODWORD(SamplingPeriod) = ThermalInfo->SamplingPeriod;
      LODWORD(UserData) = ThermalInfo->ThermalConstant2;
      PopSqmThermalZoneEnumeration(
        v7,
        Descriptiona,
        v8,
        ThermalInfo->ThermalConstant1,
        (UINT64)UserData,
        SamplingPeriod,
        ActiveTripPoint0,
        ActiveTripPoint1,
        CriticalTripPoint,
        S4TransitionTripPoint,
        ThermalStandbyTripPoint);
    }
    if( v5 )
      ObfDereferenceObjectWithTag(v5, 0x67446F50ui64);
  }
}

Referenced by:

PopThermalWorker