PopDiagTraceActiveCooling

VOID __fastcall PopDiagTraceActiveCooling(
        _THERMAL_INFORMATION_EX *ThermalInfo,
        _DEVICE_OBJECT *DeviceObject,
        INT64 ActiveCoolingEngaged,
        _THERMAL_CHANNEL Channel){
  char v5; 
  bool v8; 
  _DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  _DEVICE_OBJECT *v10; 
  _WORD *DeviceNode; 
  char *v12; 
  unsigned int v13; 
  __int64 v14; 
  __int64 v15; 
  unsigned int v16; 
  unsigned int *v17; 
  unsigned int v18; 
  const _EVENT_DESCRIPTOR *v19; 
  unsigned __int16 v20; 
  __int16 v21; 
  unsigned int v22; 
  _LARGE_INTEGER LocalTime; 
  _LARGE_INTEGER SystemTime; 
  _EVENT_DATA_DESCRIPTOR UserData; 
  __int64 v26; 
  int v27; 
  int v28; 
  _LARGE_INTEGER *p_LocalTime; 
  __int64 v30; 
  __int16 *v31; 
  __int64 v32; 
  char v33; 
  int *v34; 
  __int64 v35; 
  _DWORD v36[10]; 

  v5 = ActiveCoolingEngaged;
  v21 = 0;
  v22 = 0;
  v20 = 0;
  LocalTime.QuadPart = 0i64;
  if( PopDiagHandleRegistered && (Channel || EtwEventEnabled(PopDiagHandle, &POP_ETW_EVENT_ACTIVE_COOLING_DIAGNOSTIC)) )
  {
    v8 = (unsigned int)Channel <= Operational;
    if( Channel == Operational )
    {
      if( !EtwEventEnabled(PopDiagHandle, &POP_ETW_EVENT_ACTIVE_COOLING_OPERATIONAL) )
        return;
      v8 = 1;
    }
    if( v8 )
    {
      DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(DeviceObject, 0x67446F50ui64);
      v10 = DeviceAttachmentBaseRefWithTag;
      if( DeviceAttachmentBaseRefWithTag )
        DeviceNode = DeviceAttachmentBaseRefWithTag->DeviceObjectExtension->DeviceNode;
      else
        DeviceNode = 0i64;
      if( DeviceNode )
      {
        v20 = DeviceNode[64] >> 1;
        UserData.Ptr = (unsigned __int64)&v20;
        *(_QWORD *)&UserData.Size = 2i64;
        v26 = *((_QWORD *)DeviceNode + 17);
        v27 = 2 * v20;
        v28 = 0;
        SystemTime = *(_LARGE_INTEGER *)&KUSER_SHARED_DATA.SystemTime.LowPart;
        ExSystemTimeToLocalTime(&SystemTime, &LocalTime);
        v30 = 8i64;
        p_LocalTime = &LocalTime;
        v12 = &v33;
        v32 = 2i64;
        v13 = 0;
        v14 = 10i64;
        v21 = v5 != 0;
        v31 = &v21;
        do
        {
          v15 = v13;
          *(_QWORD *)(v12 - 4) = 4i64;
          ++v13;
          v12 += 16;
          v16 = ThermalInfo->ActiveTripPoint[v15];
          v17 = &v36[v15];
          *(_QWORD *)(v12 - 28) = v17;
          *v17 = v16 / 0xA;
          --v14;
        }
        while( v14 );
        v35 = 4i64;
        v18 = ThermalInfo->CurrentTemperature / 0xA;
        v34 = (int *)&v22;
        v22 = v18;
        v19 = &POP_ETW_EVENT_ACTIVE_COOLING_DIAGNOSTIC;
        if( Channel )
          v19 = &POP_ETW_EVENT_ACTIVE_COOLING_OPERATIONAL;
        EtwWrite(PopDiagHandle, v19, 0, 0xFu, &UserData);
      }
      if( v10 )
        ObfDereferenceObjectWithTag(v10, 0x67446F50ui64);
    }
  }
}

Referenced by:

PopThermalWorker