PnprCollectResources

INT64 __fastcall PnprCollectResources(INT64 *a1, INT64 *a2){
  _OWORD *PoolWithTag; 
  int v5; 
  UINT64 v6; 
  int v7; 
  int v8; 
  int v9; 
  int v10; 
  _OWORD *v11; 
  INT64 v12; 
  VOID *v13; 
  VOID *v14; 
  __int64 v15; 
  INT64 v16; 
  __int64 v17; 
  int v18; 
  __int64 v19; 
  UINT64 v20; 
  int v21; 
  int v22; 
  INT64 v23; 
  __int64 v24; 
  int v25; 
  UINT64 v26; 
  int v27; 
  int v28; 
  unsigned int v29; 
  unsigned __int64 v30; 
  int v31; 
  PVOID *v32; 
  void *v33; 
  void *v34; 
  void *v35; 
  __int128 v37; 
  _OWORD v38[2]; 
  v38[0] = 0i64;
  v37 = 0i64;
  PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x24ui64, 0x51706E50ui64);
  a1[2] = (INT64)PoolWithTag;
  if( PoolWithTag )
  {
    *PoolWithTag = 0i64;
    PoolWithTag[1] = 0i64;
    *((_DWORD *)PoolWithTag + 8) = 0;
    *(_DWORD *)(a1[2] + 12) = 4;
    v11 = ExAllocatePoolWithTag(NonPagedPoolNx, 0x24ui64, 0x51706E50ui64);
    a2[2] = (INT64)v11;
    if( !v11 )
    {
      v5 = 1037;
      goto LABEL_3;
    }
    *v11 = 0i64;
    v11[1] = 0i64;
    *((_DWORD *)v11 + 8) = 0;
    *(_DWORD *)(a2[2] + 12) = 4;
    *(_QWORD *)a1[2] = ExAllocatePoolWithTag(NonPagedPoolNx, 0xA0ui64, 0x51706E50ui64);
    v12 = *(_QWORD *)a1[2];
    if( !v12 )
    {
      v5 = 1057;
      goto LABEL_3;
    }
    memset(v12, 0i64);
    *(_DWORD *)(a1[2] + 8) = 20;
    v13 = ExAllocatePoolWithTag(NonPagedPoolNx, 0x50ui64, 0x51706E50ui64);
    a1[3] = (INT64)v13;
    if( !v13 )
    {
      v5 = 1076;
      goto LABEL_3;
    }
    v14 = ExAllocatePoolWithTag(NonPagedPoolNx, 0x50ui64, 0x51706E50ui64);
    a2[3] = (INT64)v14;
    if( !v14 )
    {
      v5 = 1087;
      goto LABEL_3;
    }
    memset(a1[3], 0i64);
    memset(a2[3], 0i64);
    *(_DWORD *)a1[3] = 4;
    *(_DWORD *)a2[3] = 4;
    *(_QWORD *)&v38[0] = PnprAddDeviceResources;
    *((_QWORD *)&v38[0] + 1) = &v37;
    v16 = *a1;
    *((_QWORD *)&v37 + 1) = a1;
    LOBYTE(v37) = 1;
    if( v16 )
      v17 = *(_QWORD *)(*(_QWORD *)(v16 + 312) + 40i64);
    else
      v17 = 0i64;
    LOBYTE(v18) = PipForAllChildDeviceNodes(v17, v15, (__int64)v38);
    v7 = v18;
    if( v18 < 0 )
    {
      v20 = PnprContext;
      v21 = *(_DWORD *)(PnprContext + 20984);
      if( !v21 )
        v21 = 1110;
      *(_DWORD *)(PnprContext + 20984) = v21;
      v22 = *(_DWORD *)(v20 + 20988);
      if( !v22 )
        v22 = 1;
      *(_DWORD *)(v20 + 20988) = v22;
      goto LABEL_48;
    }
    v23 = *a2;
    *((_QWORD *)&v37 + 1) = a2;
    LOBYTE(v37) = 0;
    if( v23 )
      v24 = *(_QWORD *)(*(_QWORD *)(v23 + 312) + 40i64);
    else
      v24 = 0i64;
    LOBYTE(v25) = PipForAllChildDeviceNodes(v24, v19, (__int64)v38);
    v7 = v25;
    if( v25 >= 0 )
    {
      v29 = *(_DWORD *)(a1[2] + 16);
      if( !v29 && !*(_DWORD *)(a1[3] + 4) )
      {
        v6 = PnprContext;
        v7 = -1073741811;
        v8 = *(_DWORD *)(PnprContext + 20984);
        if( !v8 )
          v8 = 1133;
        v9 = 5;
        goto LABEL_6;
      }
      v30 = *(_QWORD *)(a2[3] + 8);
      if( (!v30 || *(_QWORD *)(a1[3] + 8) <= v30) && v29 <= *(_DWORD *)(a2[2] + 16) )
      {
LABEL_48:
        if( v7 >= 0 )
          return(unsigned int)v7;
        goto LABEL_49;
      }
      v26 = PnprContext;
      v7 = -1073741811;
      v31 = *(_DWORD *)(PnprContext + 20984);
      if( !v31 )
        v31 = 1142;
      *(_DWORD *)(PnprContext + 20984) = v31;
      v28 = *(_DWORD *)(v26 + 20988);
      if( !v28 )
        v28 = 4;
    }
    else
    {
      v26 = PnprContext;
      v27 = *(_DWORD *)(PnprContext + 20984);
      if( !v27 )
        v27 = 1121;
      *(_DWORD *)(PnprContext + 20984) = v27;
      v28 = *(_DWORD *)(v26 + 20988);
      if( !v28 )
        v28 = 1;
    }
    *(_DWORD *)(v26 + 20988) = v28;
    goto LABEL_48;
  }
  v5 = 1024;
LABEL_3:
  v6 = PnprContext;
  v7 = -1073741670;
  v8 = *(_DWORD *)(PnprContext + 20984);
  if( !v8 )
    v8 = v5;
  v9 = 10;
LABEL_6:
  *(_DWORD *)(v6 + 20984) = v8;
  v10 = *(_DWORD *)(v6 + 20988);
  if( !v10 )
    v10 = v9;
  *(_DWORD *)(v6 + 20988) = v10;
LABEL_49:
  v32 = (PVOID *)a1[2];
  if( v32 )
  {
    if( *v32 )
    {
      ExFreePoolWithTag(*v32, 0x51706E50u);
      v32 = (PVOID *)a1[2];
    }
    ExFreePoolWithTag(v32, 0x51706E50u);
    a1[2] = 0i64;
  }
  v33 = (void *)a1[3];
  if( v33 )
  {
    ExFreePoolWithTag(v33, 0x51706E50u);
    a1[3] = 0i64;
  }
  v34 = (void *)a2[2];
  if( v34 )
  {
    ExFreePoolWithTag(v34, 0x51706E50u);
    a2[2] = 0i64;
  }
  v35 = (void *)a2[3];
  if( v35 )
  {
    ExFreePoolWithTag(v35, 0x51706E50u);
    a2[3] = 0i64;
  }
  return(unsigned int)v7;
}

Referenced by:

No references.