PoFxRegisterDebugger

VOID __stdcall PoFxRegisterDebugger(){
  unsigned int v0; 
  unsigned int *PoolWithTag; 
  unsigned int *v2; 
  WCHAR v3; 
  unsigned int v4; 
  _DWORD *v5; 
  unsigned int i; 
  wchar_t *v7; 
  ULONG_PTR v8; 
  int v9; 
  __int64 v10; 
  SIZE_T NumberOfBytes; 
  ULONG_PTR BugCheckParameter2; 
  __int64 DestinationString; 
  struct _UNICODE_STRING DestinationString_8; 
  INT64 result[8]; 
  int v16; 
  __int128 *v17; 
  __int128 v18; 
  __int64 v19; 
  wchar_t pszDest[24]; 
  v19 = 0i64;
  v18 = 0i64;
  memset((INT64)result, 0i64);
  BugCheckParameter2 = 0i64;
  LODWORD(NumberOfBytes) = 0;
  DestinationString_8 = 0i64;
  if( ((unsigned int(__fastcall *)(__int64, _QWORD, _QWORD, SIZE_T *))off_140C00A68[0])(
         33i64,
         0i64,
         0i64,
         &NumberOfBytes) == -2147483643 )
  {
    v0 = NumberOfBytes;
    PoolWithTag = (unsigned int *)ExAllocatePoolWithTag(NonPagedPoolNx, (unsigned int)NumberOfBytes, 0x4D584650ui64);
    v2 = PoolWithTag;
    if( PoolWithTag )
    {
      memset((INT64)PoolWithTag, 0i64);
      if( ((int(__fastcall *)(__int64, _QWORD, unsigned int *, SIZE_T *))off_140C00A68[0])(
             33i64,
             v0,
             v2,
             &NumberOfBytes) >= 0
        && (unsigned int)NumberOfBytes <= v0 )
      {
        v4 = 0;
        v5 = v2 + 1;
        for( i = 0; i < *v2; ++i )
        {
          v5 = (_DWORD *)((char *)v5 + v4);
          v4 = v5[1];
          if( *v5 == 1 )
          {
            if( v5[2] )
            {
              v7 = (wchar_t *)(v5 + 3);
LABEL_12:
              RtlInitUnicodeString(&DestinationString_8, v7, v3);
              v19 = 0i64;
              v18 = 0i64;
              memset((INT64)result, 0i64);
              result[0] = 0x100000001i64;
              v17 = &v18;
              result[3] = (INT64)PopFxDebuggerPowerCriticalTransitionCallback;
              v16 = 1;
              if( (int)PoFxRegisterCoreDevice(&DestinationString_8, (__int64)result, &BugCheckParameter2) < 0 )
                break;
              v8 = BugCheckParameter2;
              v9 = *(_DWORD *)(BugCheckParameter2 + 824) | 2;
              DestinationString = 0i64;
              *(_DWORD *)(BugCheckParameter2 + 824) = v9;
              v10 = *(_QWORD *)(v8 + 64);
              if( v10 )
              {
                DestinationString = *(_QWORD *)(v8 + 72);
                (*(void(__fastcall **)(__int64, __int64 *))(v10 + 96))(21i64, &DestinationString);
              }
              PoFxActivateComponent((POHANDLE *)v8, 0i64, 1ui64);
              PoFxStartDevicePowerManagement((POHANDLE *)v8);
            }
          }
          else if( !*v5 )
          {
            RtlStringCbPrintfW(pszDest, 0x30ui64, (WCHAR *)L"PCI_DEBUG_%04X_%02X_%02X_%02X");
            v7 = pszDest;
            goto LABEL_12;
          }
        }
      }
      ExFreePoolWithTag(v2, 0x4D584650u);
    }
  }
}

Referenced by:

PoInitSystem