PopDripsWatchdogTakeAction

VOID __stdcall PopDripsWatchdogTakeAction(_POP_DRIPS_WATCHDOG_METRICS *const Metrics, INT16 Actions){
  int v2; 
  UINT8 ActionsTaken; 
  UINT64 v5; 
  unsigned int v6; 
  int v7; 
  INT64 v8; 
  INT64 v9; 
  INT64 v10; 
  INT64 v11; 
  bool v12; 
  _UNICODE_STRING *DeviceServiceName; 
  __int64 v14; 
  int v15; 
  UINT64 v16; 
  UINT64 v17; 
  UINT64 *v18; 
  UINT64 v19; 
  UINT8 v20; 
  UINT64 v21; 
  UINT64 EnergyDrain; 
  INT64 DeviceConstraint; 
  _UNICODE_STRING *ChildServiceName; 
  INT64 *v25; 
  VOID *v26; 
  const _GUID *v27; 
  INT64 v28[2]; 
  _BYTE savedregs[56]; 
  UINT64 VetoCode; 
  int v31; 
  WCHAR *VetoName; 

  v31 = v2;
  ActionsTaken = Actions;
  v5 = 10000 * Metrics->WatchdogPeriodMs;
  v6 = 0;
  VetoName = 0i64;
  v7 = v2;
  *(_OWORD *)v28 = 0i64;
  LODWORD(VetoCode) = 0;
  if( (int)PopFxBuildDripsBlockingDeviceList(v5, (_LIST_ENTRY *)v28) >= 0 )
  {
    v11 = v28[0];
    v12 = v28[0] != (_QWORD)v28;
    if( (INT64 *)v28[0] != v28 )
    {
      do
      {
        DeviceServiceName = (_UNICODE_STRING *)(*(_QWORD *)(v11 - 824) + 56i64);
        if( *(_DWORD *)(v11 + 32) )
        {
          v14 = 0i64;
          v15 = v31;
          do
          {
            LODWORD(v26) = v15;
            LODWORD(v25) = 0;
            LODWORD(EnergyDrain) = Metrics->EnergyDrain;
            PopDiagTraceCsDripsWatchdog(
              Metrics->NonDripsDurationMs,
              Metrics->NonActivatedCpuTimeMs,
              Metrics->WatchdogPeriodMs,
              Metrics->OnAc != 0,
              EnergyDrain,
              1u,
              ActionsTaken,
              DeviceServiceName,
              (_UNICODE_STRING *)(*(_QWORD *)(*(_QWORD *)(v11 + 24) + 8 * v14) + 56i64),
              (UINT64)v25);
            v14 = (unsigned int)(v14 + 1);
          }
          while( (unsigned int)v14 < *(_DWORD *)(v11 + 32) );
          v7 = v31;
        }
        else
        {
          LODWORD(v26) = v7;
          LODWORD(v25) = 0;
          LODWORD(EnergyDrain) = Metrics->EnergyDrain;
          PopDiagTraceCsDripsWatchdog(
            Metrics->NonDripsDurationMs,
            Metrics->NonActivatedCpuTimeMs,
            Metrics->WatchdogPeriodMs,
            Metrics->OnAc != 0,
            EnergyDrain,
            1u,
            ActionsTaken,
            DeviceServiceName,
            0i64,
            (UINT64)v25);
        }
        v11 = *(_QWORD *)v11;
      }
      while( (INT64 *)v11 != v28 );
      v11 = v28[0];
      v6 = VetoCode;
    }
    if( !v12 )
    {
      PpmIdlePrevetoWatchdog(10000 * Metrics->WatchdogPeriodMs, &VetoCode, &VetoName);
      v6 = VetoCode;
      LODWORD(v26) = v7;
      LODWORD(v25) = VetoCode;
      LODWORD(EnergyDrain) = Metrics->EnergyDrain;
      PopDiagTraceCsDripsWatchdog(
        Metrics->NonDripsDurationMs,
        Metrics->NonActivatedCpuTimeMs,
        Metrics->WatchdogPeriodMs,
        Metrics->OnAc != 0,
        EnergyDrain,
        0,
        ActionsTaken,
        0i64,
        0i64,
        (UINT64)v25);
      v11 = v28[0];
    }
    if( !Metrics->OnAc || (ActionsTaken & 1) != 0 )
    {
      if( (ActionsTaken & 2) != 0 )
      {
        LODWORD(EnergyDrain) = Metrics->EnergyDrain;
        PopDiagTraceCsDripsWatchdogPerfTrack(
          Metrics->NonDripsDurationMs,
          Metrics->NonActivatedCpuTimeMs,
          Metrics->WatchdogPeriodMs,
          Metrics->OnAc,
          EnergyDrain,
          v12,
          ActionsTaken);
        v11 = v28[0];
      }
      if( v12 )
      {
        v16 = v11 - 872;
        v17 = v16 + 872;
        v18 = (UINT64 *)(v16 + 48);
        if( *(_DWORD *)(v16 + 904) )
          v18 = *(UINT64 **)(v16 + 896);
        v19 = *v18;
      }
      else
      {
        v19 = 0i64;
        v16 = 0i64;
        v17 = 0i64;
      }
      if( !(_BYTE)KdDebuggerEnabled || (_BYTE)KdDebuggerNotPresent )
      {
        if( (VfIsVerifierEnabled() || PopCheckTestsigningEnabled()) && v12 && (ActionsTaken & 0x20) != 0 )
          PopFxBugCheck(0x619u, v16, *(_DWORD *)(v17 + 16), v19);
      }
      else if( (ActionsTaken & 8) != 0 )
      {
        if( Metrics->NonActivatedCpuTimeAsPercentage <= 0x64 )
          __debugbreak();
      }
      else if( v12 )
      {
        if( (ActionsTaken & 0x40) != 0 )
          NT_ASSERT(
            "*** DRIPS watchdog timeout
    This break point indicates that screen-off battery
    life is being compromi"
            "sed. This AOAC system broke
    into the debugger because a device has prevented
    the deepest runtime idl"
            "e platform state(DRIPS) for
    a certain period of time, despite being in the
    resiliency phase of conn"
            "ected standby without
    activators active.

    Run !platformidle to identify the device with an
    unsat"
            "isifed DRIPS constraint.
");
        if( (ActionsTaken & 0x20) != 0 )
          PopFxBugCheck(0x619u, v16, *(_DWORD *)(v17 + 16), v19);
      }
      v20 = PopDeviceConstraintsEnforced();
      v8 = 0i64;
      if( v20 && (ActionsTaken & 4) != 0 )
      {
        if( v12 )
        {
          LODWORD(ChildServiceName) = 0;
          DbgkWerCaptureLiveKernelDump(
            L"DripsWatchdog",
            0x15Fui64,
            2ui64,
            v16,
            *(unsigned int *)(v17 + 16),
            v19,
            0i64,
            0i64,
            ChildServiceName,
            v25,
            v26,
            v27,
            (VOID *)v28[0],
            v28[1],
            *(UINT64 *)savedregs,
            *(UINT64 *)&savedregs[8],
            *(UINT64 *)&savedregs[16],
            *(UINT64 *)&savedregs[24],
            *(UINT64 *)&savedregs[32],
            *(VOID **)&savedregs[40],
            *(DBGK_LIVEDUMP_FLAGS *)&savedregs[48]);
        }
        else if( v6 )
        {
          if( *(_QWORD *)&PopFxProcessorPlugin )
            v21 = *(_QWORD *)(*(_QWORD *)&PopFxProcessorPlugin + 104i64);
          else
            v21 = 0i64;
          LODWORD(ChildServiceName) = 0;
          DbgkWerCaptureLiveKernelDump(
            L"DripsWatchdog",
            0x15Fui64,
            3ui64,
            v6,
            (UINT64)VetoName,
            v21,
            0i64,
            0i64,
            ChildServiceName,
            v25,
            v26,
            v27,
            (VOID *)v28[0],
            v28[1],
            *(UINT64 *)savedregs,
            *(UINT64 *)&savedregs[8],
            *(UINT64 *)&savedregs[16],
            *(UINT64 *)&savedregs[24],
            *(UINT64 *)&savedregs[32],
            *(VOID **)&savedregs[40],
            *(DBGK_LIVEDUMP_FLAGS *)&savedregs[48]);
        }
      }
    }
    PopFxDestroyDripsBlockingDeviceList((INT64)v28, v8, v9, v10, EnergyDrain, DeviceConstraint);
  }
}

Referenced by:

PopDripsWatchdogDiagnosticWorker