PoFxRegisterDebugger

VOID __stdcall PoFxRegisterDebugger(){
  size_t v0; 
  VOID **PoolWithTag; 
  VOID **v2; 
  unsigned int v3; 
  _DWORD *v4; 
  unsigned int i; 
  WCHAR *v6; 
  _POP_FX_DEVICE *v7; 
  int v8; 
  __int64 v9; 
  UINT64 NumberOfBytes; 
  _POP_FX_DEVICE *a3; 
  _UNICODE_STRING DestinationString[2]; 
  INT64 a2[10]; 
  __int128 v14; 
  __int64 v15; 
  WCHAR pszDest[24]; 

  v15 = 0i64;
  v14 = 0i64;
  memset(a2, 0i64, sizeof(a2));
  a3 = 0i64;
  LODWORD(NumberOfBytes) = 0;
  *(_OWORD *)&DestinationString[0].Buffer = 0i64;
  if( ((unsigned int(__fastcall *)(__int64, _QWORD, _QWORD, UINT64 *))off_140C00A68[0])(
         33i64,
         0i64,
         0i64,
         &NumberOfBytes) == -2147483643 )
  {
    v0 = NumberOfBytes;
    PoolWithTag = ExAllocatePoolWithTag(0x200ui64, (unsigned int)NumberOfBytes, 1297630800i64);
    v2 = PoolWithTag;
    if( PoolWithTag )
    {
      memset(PoolWithTag, 0i64, v0);
      if( ((int(__fastcall *)(__int64, _QWORD, VOID **, UINT64 *))off_140C00A68[0])(33i64, v0, v2, &NumberOfBytes) >= 0
        && (unsigned int)NumberOfBytes <= v0 )
      {
        v3 = 0;
        v4 = (_DWORD *)v2 + 1;
        for( i = 0; i < *(_DWORD *)v2; ++i )
        {
          v4 = (_DWORD *)((char *)v4 + v3);
          v3 = v4[1];
          if( *v4 == 1 )
          {
            if( v4[2] )
            {
              v6 = (WCHAR *)(v4 + 3);
LABEL_12:
              RtlInitUnicodeString((PUNICODE_STRING)&DestinationString[0].Buffer, v6);
              v15 = 0i64;
              v14 = 0i64;
              memset(a2, 0i64, sizeof(a2));
              a2[0] = 0x100000001i64;
              a2[9] = (INT64)&v14;
              a2[3] = (INT64)PopFxDebuggerPowerCriticalTransitionCallback;
              LODWORD(a2[8]) = 1;
              if( PoFxRegisterCoreDevice((_UNICODE_STRING *)&DestinationString[0].Buffer, (INT64)a2, &a3) < 0 )
                break;
              v7 = a3;
              v8 = *((_DWORD *)a3 + 206) | 2;
              *(_QWORD *)&DestinationString[0].Length = 0i64;
              *((_DWORD *)a3 + 206) = v8;
              v9 = *((_QWORD *)v7 + 8);
              if( v9 )
              {
                *(_QWORD *)&DestinationString[0].Length = *((_QWORD *)v7 + 9);
                (*(void(__fastcall **)(__int64, _UNICODE_STRING *))(v9 + 96))(21i64, DestinationString);
              }
              PoFxActivateComponent((POHANDLE *)v7, 0i64, 1ui64);
              PoFxStartDevicePowerManagement((POHANDLE *)v7);
            }
          }
          else if( !*v4 )
          {
            RtlStringCbPrintfW(pszDest, 0x30ui64, (WCHAR *)L"PCI_DEBUG_%04X_%02X_%02X_%02X");
            v6 = pszDest;
            goto LABEL_12;
          }
        }
      }
      ExFreePoolWithTag(v2, 0x4D584650u);
    }
  }
}

Referenced by:

PoInitSystem