PnpCtxRegisterMachineNode

__int64 __fastcall PnpCtxRegisterMachineNode(__int64 a1, const WCHAR *a2, int a3, __int64 a4, __int64 a5){
  INT64 v6; 
  __int64 v7; 
  __int64 v8; 
  int v9; 
  _QWORD *v10; 
  _QWORD *v11; 
  __int64 *v12; 
  __int64 v13; 
  __int64 **v14; 
  PVOID v15; 
  void *v17; 
  PVOID P; 
  P = 0i64;
  v6 = PiPnpRtlCtx;
  v7 = a3;
  if( a3 <= 0 )
    return(unsigned int)-1073741811;
  if( a3 > 2 )
  {
    if( a3 == 3 )
      goto LABEL_4;
    return(unsigned int)-1073741811;
  }
  if( *(_QWORD *)(PiPnpRtlCtx + 16i64 * a3 + 24) != PiPnpRtlCtx + 16i64 * a3 + 24 )
    return(unsigned int)-1073741298;
LABEL_4:
  if( (int)PnpCtxFindNode(PiPnpRtlCtx, a2, 0, (const UNICODE_STRING **)&P) < 0 )
  {
    v9 = PnpCtxCreateNode(
           (int *)v6,
           a2,
           v7,
           v8,
           a5,
           v17,
           -1i64,
           (HANDLE)(*(_QWORD *)(*(_QWORD *)(v6 + 224) + 8i64) & -(__int64)(*(_QWORD *)(*(_QWORD *)(v6 + 224) + 8i64) != 0i64)),
           &P);
    if( v9 < 0 )
    {
      v15 = P;
    }
    else
    {
      v10 = *(_QWORD **)(v6 + 16);
      if( *v10 != v6 + 8 )
        goto LABEL_12;
      v11 = P;
      *(_QWORD *)P = v6 + 8;
      v11[1] = v10;
      *v10 = v11;
      *(_QWORD *)(v6 + 16) = v11;
      v12 = v11 + 2;
      v13 = 16 * v7 + v6 + 24;
      v14 = *(__int64 ***)(v13 + 8);
      if( *v14 != (__int64 *)v13 )
LABEL_12:
        __fastfail(3u);
      *v12 = v13;
      v12[1] = (__int64)v14;
      *v14 = v12;
      *(_QWORD *)(v13 + 8) = v12;
      memset(v6 + 96, 0i64);
      v15 = 0i64;
      *(_BYTE *)(v6 + 4) = *(_QWORD *)(v6 + 56) != v6 + 56;
    }
    if( v15 )
      PnpCtxDestroyNode(v15);
  }
  else
  {
    return(unsigned int)-1073741771;
  }
  return(unsigned int)v9;
}

Referenced by:

PiPnpRtlInit
PiPnpRtlRegisterDriverMachineNodeCallback