PopDirectedDripsDiagRundownDevices

VOID __fastcall PopDirectedDripsDiagRundownDevices(UINT64 a1, INT64 a2, UINT64 a3){
  unsigned int *v3; 
  __int64 v4; 
  unsigned int v5; 
  unsigned int v6; 
  EVENT_DESCRIPTOR *v7; 
  unsigned int *v8; 
  unsigned int v9; 
  unsigned int v10; 
  struct _UNICODE_STRING *v11; 
  struct _UNICODE_STRING *v12; 
  char v13; 
  struct _UNICODE_STRING *v14; 
  struct _UNICODE_STRING *v15; 
  UINT16 *v16; 
  __int64 v17; 
  struct _UNICODE_STRING *v18; 
  UINT64 v19; 
  int Length; 
  int v21; 
  int v22; 
  int v23; 
  unsigned int v24; 
  INT64 *v25; 
  int v26; 
  _DWORD *v27; 
  __int64 v28; 
  __int64 v29; 
  unsigned __int64 v30; 
  __int64 v31; 
  unsigned __int64 v32; 
  __int64 v33; 
  __int64 v34; 
  __int64 v35; 
  __int64 v36; 
  char v37[4]; 
  unsigned int v38; 
  int v39; 
  int v40; 
  int v41; 
  int v42; 
  __int64 v43; 
  struct _UNICODE_STRING *v44; 
  struct _UNICODE_STRING *v45; 
  unsigned int v46; 
  unsigned int v47; 
  unsigned int v48; 
  unsigned int v49; 
  struct _UNICODE_STRING *v50; 
  UINT64 v51; 
  UINT64 v52; 
  struct _EVENT_DATA_DESCRIPTOR v53; 
  int *v54; 
  __int64 v55; 
  int *v56; 
  __int64 v57; 
  wchar_t *Buffer; 
  int v59[2]; 
  int *v60; 
  __int64 v61; 
  __int64 v62; 
  int v63[2]; 
  int *v64; 
  __int64 v65; 
  wchar_t *v66; 
  int v67[2]; 
  int *v68; 
  __int64 v69; 
  wchar_t *v70; 
  int v71[2]; 
  int *v72; 
  __int64 v73; 
  int *v74; 
  __int64 v75; 
  unsigned int *v76; 
  __int64 v77; 
  unsigned int *v78; 
  __int64 v79; 
  int *v80; 
  __int64 v81; 
  wchar_t *v82; 
  int v83[2]; 
  UINT64 *v84; 
  __int64 v85; 
  struct _UNICODE_STRING **v86; 
  __int64 v87; 
  int *v88; 
  __int64 v89; 
  wchar_t *v90; 
  int v91[2]; 
  __int64 *v92; 
  __int64 v93; 
  INT64 a1a[28]; 
  v38 = 0;
  v42 = 0;
  LODWORD(v43) = 0;
  v40 = 0;
  v41 = 0;
  v37[0] = PopWnfCsEnterScenarioId;
  v51 = PopWnfCsEnterScenarioId;
  while( 1 )
  {
    v3 = (unsigned int *)qword_140C1E990;
    if( qword_140C1E990 == &qword_140C1E990 )
      break;
    if( *((PVOID **)qword_140C1E990 + 1) != &qword_140C1E990
      || (v4 = *(_QWORD *)qword_140C1E990, *(PVOID *)(*(_QWORD *)qword_140C1E990 + 8i64) != qword_140C1E990) )
    {
      __fastfail(3u);
    }
    qword_140C1E990 = *(PVOID *)qword_140C1E990;
    v5 = 0;
    *(_QWORD *)(v4 + 8) = &qword_140C1E990;
    v6 = 0;
    v38 = 0;
    if( v3[39] )
    {
      PopDirectedDripsDiagCreateBlockerEntryULong((INT64)a1a, (INT64)L"DFX Transition Count");
      v5 = v38 + 1;
      v38 = v5;
      v6 = v5;
    }
    v7 = (EVENT_DESCRIPTOR *)v3[40];
    if( (_DWORD)v7 )
    {
      PopDirectedDripsDiagCreateBlockerEntryULong((INT64)&a1a[7 * v6], (INT64)L"PS4 Transition Count");
      v5 = v38 + 1;
      v38 = v5;
      v6 = v5;
    }
    v8 = v3 + 38;
    v9 = v3[38];
    v10 = v9;
    if( (_WORD)v9 )
    {
      PopDirectedDripsDiagCreateBlockerEntryBoolean((INT64)&a1a[7 * v6], (INT64)L"Problem Device");
      v5 = v38 + 1;
      v38 = v5;
      v6 = v5;
      v9 = *v8;
      v10 = *v8;
    }
    if( (v10 & 0x10000) != 0 )
    {
      PopDirectedDripsDiagCreateBlockerEntryBoolean((INT64)&a1a[7 * v6], (INT64)L"Initiated PS4 Transition");
      v5 = ++v38;
      v9 = *v8;
      v10 = *v8;
    }
    if( (v10 & 0x40000) != 0 )
    {
      v11 = &PopDirectedDripsDiagEmptyString;
      v12 = &PopDirectedDripsDiagEmptyString;
      if( *((_QWORD *)v3 + 7) )
        v12 = (struct _UNICODE_STRING *)(v3 + 12);
      v13 = 0;
      if( *((_QWORD *)v3 + 9) )
      {
        v50 = (struct _UNICODE_STRING *)(v3 + 16);
        v11 = &PopDirectedDripsDiagEmptyString;
      }
      else
      {
        v50 = &PopDirectedDripsDiagEmptyString;
      }
      v14 = &PopDirectedDripsDiagEmptyString;
      if( *((_QWORD *)v3 + 11) )
        v14 = (struct _UNICODE_STRING *)(v3 + 20);
      v15 = &PopDirectedDripsDiagEmptyString;
      if( *((_QWORD *)v3 + 13) )
        v15 = (struct _UNICODE_STRING *)(v3 + 24);
      if( *((_QWORD *)v3 + 15) )
      {
        v44 = (struct _UNICODE_STRING *)(v3 + 28);
        v11 = &PopDirectedDripsDiagEmptyString;
      }
      else
      {
        v44 = &PopDirectedDripsDiagEmptyString;
      }
      if( *((_QWORD *)v3 + 17) )
        v11 = (struct _UNICODE_STRING *)(v3 + 32);
      v45 = v11;
      if( (unsigned int)dword_140D2C920 > 5 && tlgKeywordOn((__int64)&dword_140D2C920, 0x400000000000i64) )
      {
        LOBYTE(v39) = v37[0];
        v55 = 1i64;
        v54 = &v39;
        v56 = v59;
        Buffer = v12->Buffer;
        v59[0] = v12->Length;
        v57 = 2i64;
        v59[1] = 0;
        v16 = PopDirectedDripsDiagSanitizeHardwareId((UINT16 *)v3 + 32);
        v61 = 2i64;
        v60 = v63;
        v63[1] = 0;
        v17 = *((_QWORD *)v16 + 1);
        v63[0] = *v16;
        v64 = v67;
        v66 = v14->Buffer;
        v67[0] = v14->Length;
        v68 = v71;
        v70 = v15->Buffer;
        v71[0] = v15->Length;
        v46 = v3[37];
        v72 = (int *)&v46;
        v47 = v3[39];
        v74 = (int *)&v47;
        v48 = v3[40];
        v76 = &v48;
        v78 = &v49;
        v80 = v83;
        v62 = v17;
        v65 = 2i64;
        v67[1] = 0;
        v69 = 2i64;
        v82 = v44->Buffer;
        v83[0] = v44->Length;
        v52 = v51;
        v84 = &v52;
        LODWORD(v44) = v3[6];
        v86 = &v44;
        v88 = v91;
        v71[1] = 0;
        v73 = 4i64;
        v75 = 4i64;
        v77 = 4i64;
        v49 = v9;
        v79 = 4i64;
        v81 = 2i64;
        v83[1] = 0;
        v85 = 8i64;
        v87 = 4i64;
        v89 = 2i64;
        v18 = v45;
        v91[1] = 0;
        v45 = (struct _UNICODE_STRING *)0x1000000;
        v93 = 8i64;
        v90 = v18->Buffer;
        v91[0] = v18->Length;
        v92 = (__int64 *)&v45;
        tlgWriteTransfer_EtwWriteTransfer(
          (__int64)&dword_140D2C920,
          (unsigned __int8 *)byte_140028E21,
          0i64,
          0i64,
          0x16u,
          &v53);
        v5 = v38;
        v13 = 0;
      }
      if( PopDiagHandleRegistered != v13 )
      {
        v19 = PopDiagHandle;
        if( EtwEventEnabled(PopDiagHandle, (EVENT_DESCRIPTOR *)&POP_ETW_EVENT_DIRECTED_DRIPS_DEVICE_STATS, v7) )
        {
          PopDirectedDripsDiagEventData.Ptr = (unsigned __int64)v37;
          *(_QWORD *)&PopDirectedDripsDiagEventData.Size = 1i64;
          qword_140C1E830 = (__int64)(v3 + 4);
          qword_140C1E838 = 8i64;
          v40 = v12->Length >> 1;
          qword_140C1E840 = (__int64)&v40;
          qword_140C1E848 = 4i64;
          Length = v12->Length;
          qword_140C1E850 = (__int64)v12->Buffer;
          dword_140C1E858 = Length;
          dword_140C1E85C = 0;
          v41 = v50->Length >> 1;
          qword_140C1E860 = (__int64)&v41;
          qword_140C1E868 = 4i64;
          v21 = v50->Length;
          qword_140C1E870 = (__int64)v50->Buffer;
          dword_140C1E878 = v21;
          dword_140C1E87C = 0;
          v42 = v14->Length >> 1;
          qword_140C1E880 = (__int64)&v42;
          qword_140C1E888 = 4i64;
          v22 = v14->Length;
          qword_140C1E890 = (__int64)v14->Buffer;
          dword_140C1E898 = v22;
          dword_140C1E89C = 0;
          LODWORD(v43) = v15->Length >> 1;
          qword_140C1E8A0 = (__int64)&v43;
          qword_140C1E8A8 = 4i64;
          v23 = v15->Length;
          qword_140C1E8B0 = (__int64)v15->Buffer;
          qword_140C1E8C0 = (__int64)(v3 + 37);
          qword_140C1E8D0 = (__int64)(v3 + 39);
          qword_140C1E8F0 = (__int64)(v3 + 38);
          dword_140C1E8B8 = v23;
          qword_140C1E8E0 = (__int64)(v3 + 40);
          dword_140C1E8BC = 0;
          qword_140C1E8C8 = 4i64;
          qword_140C1E8D8 = 4i64;
          qword_140C1E8E8 = 4i64;
          qword_140C1E8F8 = 4i64;
          EtwWrite(
            v19,
            (EVENT_DESCRIPTOR *)&POP_ETW_EVENT_DIRECTED_DRIPS_DEVICE_STATS,
            0i64,
            0xEui64,
            &PopDirectedDripsDiagEventData);
          v5 = v38;
        }
      }
    }
    if( PopDiagSleepStudyHandleRegistered && v5 )
    {
      v24 = 0;
      v25 = a1a;
      do
      {
        v26 = 5 * v24++;
        v27 = v25 + 2;
        v28 = 2i64 * (unsigned int)(v26 + 2);
        v29 = 2i64 * (unsigned int)(v26 + 3);
        *(&PopDirectedDripsDiagEventData.Ptr + v28) = (unsigned __int64)(v3 + 8);
        *((_QWORD *)&PopDirectedDripsDiagEventData.Size + v28) = 16i64;
        v30 = v25[1];
        *(&PopDirectedDripsDiagEventData.Ptr + v29) = (unsigned __int64)v25;
        *((_QWORD *)&PopDirectedDripsDiagEventData.Size + v29) = 4i64;
        v31 = 2i64 * (unsigned int)(v26 + 4);
        *(&PopDirectedDripsDiagEventData.Ptr + v31) = v30;
        LODWORD(v30) = *(_DWORD *)v25;
        *(&PopDirectedDripsDiagEventData.Reserved + 2 * v31) = 0;
        *(&PopDirectedDripsDiagEventData.Size + 2 * v31) = 2 * v30;
        v32 = (unsigned __int64)v25 + 20;
        v25 += 7;
        v33 = 2i64 * (unsigned int)(v26 + 5);
        *(&PopDirectedDripsDiagEventData.Ptr + v33) = (unsigned __int64)v27;
        *((_QWORD *)&PopDirectedDripsDiagEventData.Size + v33) = 4i64;
        v34 = 2i64 * (unsigned int)(v26 + 6);
        *(&PopDirectedDripsDiagEventData.Ptr + v34) = v32;
        *((_QWORD *)&PopDirectedDripsDiagEventData.Size + v34) = (unsigned int)(2 * *v27);
      }
      while( v24 < v5 );
      *(_QWORD *)&PopDirectedDripsDiagEventData.Size = 1i64;
      PopDirectedDripsDiagEventData.Ptr = (unsigned __int64)v37;
      v35 = 2i64 * (unsigned int)(v26 + 7);
      qword_140C1E838 = 4i64;
      qword_140C1E830 = (__int64)&v38;
      *(&PopDirectedDripsDiagEventData.Ptr + v35) = (unsigned __int64)&v51;
      *((_QWORD *)&PopDirectedDripsDiagEventData.Size + v35) = 8i64;
      EtwWrite(
        PopDiagSleepStudyHandle,
        (EVENT_DESCRIPTOR *)&SLEEPSTUDY_EVT_SCENARIO_BLOCKER_DATA,
        0i64,
        v5 + 4 * v5 + 3,
        &PopDirectedDripsDiagEventData);
    }
    v36 = *((_QWORD *)v3 + 2);
    if( v36 )
    {
      *(_QWORD *)(v36 + 776) = 0i64;
      *((_QWORD *)v3 + 2) = 0i64;
    }
    PopDirectedDripsDiagFreeDeviceDiagnostic(v3);
  }
}

Referenced by:

PopDirectedDripsDiagNotifySessionStop