PopDiagTraceThermalCoolingMode

CHAR __stdcall PopDiagTraceThermalCoolingMode(_DEVICE_OBJECT *DeviceObject, INT16 a2){
  _DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  _DEVICE_OBJECT *v5; 
  void *DeviceNode; 
  __int64 v7; 
  const wchar_t *v8; 
  unsigned __int16 v10; 
  __int16 v11; 
  _UNICODE_STRING DestinationString; 
  _EVENT_DATA_DESCRIPTOR UserData; 
  __int64 v14; 
  int v15; 
  int v16; 
  __int16 *v17; 
  __int64 v18; 
  wchar_t *Buffer; 
  int v20; 
  int v21; 
  void *retaddr; 

  DeviceAttachmentBaseRefWithTag = (_DEVICE_OBJECT *)&retaddr;
  v11 = 0;
  DestinationString = 0i64;
  v10 = 0;
  if( PopDiagHandleRegistered )
  {
    LOBYTE(DeviceAttachmentBaseRefWithTag) = EtwEventEnabled(PopDiagHandle, &POP_ETW_EVENT_COOLING_MODE);
    if( (_BYTE)DeviceAttachmentBaseRefWithTag )
    {
      DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(DeviceObject, 0x67446F50ui64);
      v5 = DeviceAttachmentBaseRefWithTag;
      if( DeviceAttachmentBaseRefWithTag )
        DeviceNode = DeviceAttachmentBaseRefWithTag->DeviceObjectExtension->DeviceNode;
      else
        DeviceNode = 0i64;
      if( DeviceNode )
      {
        v10 = *((_WORD *)DeviceNode + 64) >> 1;
        UserData.Ptr = (unsigned __int64)&v10;
        *(_QWORD *)&UserData.Size = 2i64;
        v7 = *((_QWORD *)DeviceNode + 17);
        v8 = L"active";
        v15 = 2 * v10;
        v14 = v7;
        v16 = 0;
        if( a2 )
          v8 = L"passive";
        RtlInitUnicodeString(&DestinationString, v8);
        v11 = DestinationString.Length >> 1;
        v17 = &v11;
        Buffer = DestinationString.Buffer;
        v20 = 2 * (DestinationString.Length >> 1);
        v18 = 2i64;
        v21 = 0;
        LOBYTE(DeviceAttachmentBaseRefWithTag) = EtwWrite(PopDiagHandle, &POP_ETW_EVENT_COOLING_MODE, 0, 4u, &UserData);
      }
      if( v5 )
        LOBYTE(DeviceAttachmentBaseRefWithTag) = ObfDereferenceObjectWithTag(v5, 0x67446F50ui64);
    }
  }
  return(char)DeviceAttachmentBaseRefWithTag;
}

Referenced by:

PopThermalWorker