HalpDispatchPnp

VOID __fastcall HalpDispatchPnp(SID_AND_ATTRIBUTES *a1, UINT64 a2, SID_AND_ATTRIBUTES *a3, UINT64 a4){
  _DWORD *Sid; 
  __int64 v7; 
  unsigned int v8; 
  unsigned int v9; 
  int DeviceRelations; 
  int v11; 
  unsigned int v12; 
  unsigned int v13; 
  unsigned int v14; 
  unsigned int v15; 
  unsigned int v16; 
  __int64 v17; 
  unsigned int v18; 
  int Interface; 
  unsigned int ActiveProcessorCount; 
  unsigned int i; 
  int v22; 
  unsigned int v23; 
  unsigned int v24; 
  unsigned int v25; 
  unsigned int v26; 
  unsigned int v27; 
  Sid = a1[4].Sid;
  v7 = *(_QWORD *)(a2 + 184);
  if( *Sid == 192 )
  {
    v8 = *(unsigned __int8 *)(v7 + 1);
    if( v8 <= 7 )
    {
      if( v8 == 7 )
      {
        DeviceRelations = HalpQueryDeviceRelations(
                            (DEVICE_OBJECT *)a1,
                            *(DEVICE_RELATION_TYPE *)(v7 + 8),
                            (DEVICE_RELATIONS **)(a2 + 56));
        goto LABEL_5;
      }
      v11 = 0;
      if( !*(_BYTE *)(v7 + 1) )
      {
        if( Sid[8] == 129 )
        {
          HalpInitializeLateSystemActions();
          ActiveProcessorCount = KeQueryActiveProcessorCountEx(0xFFFFu);
          for( i = 0; i < ActiveProcessorCount; ++i )
            HalpAllocateCR3Root(i);
          HalpInitSystemHelper(HalInitPhaseAcpiPdoStarted, HalInitPhaseAcpiPdoStartedEnd, 0i64);
        }
        goto LABEL_15;
      }
      v23 = v8 - 1;
      if( !v23 )
      {
        v11 = -1073741823;
        goto LABEL_15;
      }
      v24 = v23 - 1;
      if( !v24 )
        goto LABEL_15;
      v25 = v24 - 1;
      if( !v25 )
        goto LABEL_15;
      v26 = v25 - 1;
      if( !v26 )
        goto LABEL_15;
      v27 = v26 - 1;
      if( !v27 || v27 == 1 )
        goto LABEL_15;
    }
    else
    {
      v9 = v8 - 8;
      if( !v9 )
      {
        DeviceRelations = HalpQueryInterface(
                            (DEVICE_OBJECT *)a1,
                            *(GUID **)(v7 + 8),
                            (PVOID)*(unsigned __int16 *)(v7 + 18),
                            *(INTERFACE **)(v7 + 32));
LABEL_5:
        v11 = DeviceRelations;
        goto LABEL_6;
      }
      v12 = v9 - 1;
      if( !v12 )
      {
        v17 = *(_QWORD *)(v7 + 8);
        if( *(_WORD *)(v17 + 2) != 1 )
          goto LABEL_7;
        v18 = *(_DWORD *)(v17 + 4) & 0xFFFFFEC3;
        *(_DWORD *)(v17 + 20) = 1;
        *(_DWORD *)(v17 + 4) = v18 | 0xC0;
        v11 = 0;
        *(_DWORD *)(v17 + 8) = -1;
        *(_DWORD *)(v17 + 12) = -1;
        *(_DWORD *)(v17 + 36) = 4;
        *(_DWORD *)(v17 + 40) = 4;
        *(_QWORD *)(v17 + 52) = 0i64;
        *(_DWORD *)(v17 + 60) = 0;
        goto LABEL_15;
      }
      v13 = v12 - 1;
      if( !v13 )
      {
        DeviceRelations = HalpQueryResources((DEVICE_OBJECT *)a1, (CM_RESOURCE_LIST **)(a2 + 56));
        goto LABEL_5;
      }
      v14 = v13 - 1;
      if( v14 )
      {
        v15 = v14 - 8;
        if( !v15 )
        {
          DeviceRelations = HalpQueryIdPdo(
                              (DEVICE_OBJECT *)a1,
                              (BUS_QUERY_ID_TYPE)*(_DWORD *)(v7 + 8),
                              (WCHAR **)(a2 + 56));
          goto LABEL_5;
        }
        v16 = v15 - 1;
        if( !v16 || v16 == 2 )
        {
LABEL_14:
          v11 = 0;
          goto LABEL_15;
        }
      }
      else
      {
        v22 = Sid[8];
        if( v22 == 129 )
        {
          DeviceRelations = HalpQueryAcpiResourceRequirements((IO_RESOURCE_REQUIREMENTS_LIST **)(a2 + 56));
          goto LABEL_5;
        }
        if( (unsigned int)(v22 - 130) <= 1 )
          goto LABEL_14;
      }
    }
    v11 = -1073741637;
LABEL_6:
    if( v11 == -1073741637 )
    {
LABEL_7:
      IofCompleteRequest((_IRP *)a2, 0);
      return;
    }
LABEL_15:
    *(_DWORD *)(a2 + 48) = v11;
    goto LABEL_7;
  }
  if( *Sid != 193 )
  {
    v11 = -1073741808;
    goto LABEL_6;
  }
  switch( *(_BYTE *)(v7 + 1) )
  {
    case 7:
      Interface = HalpQueryDeviceRelations(
                    (DEVICE_OBJECT *)a1,
                    *(DEVICE_RELATION_TYPE *)(v7 + 8),
                    (DEVICE_RELATIONS **)(a2 + 56));
      break;
    case 8:
      Interface = HalpQueryInterface(
                    (DEVICE_OBJECT *)a1,
                    *(GUID **)(v7 + 8),
                    (PVOID)*(unsigned __int16 *)(v7 + 18),
                    *(INTERFACE **)(v7 + 32));
      break;
    case 0x13:
      Interface = HalpQueryIdFdo(
                    (DEVICE_OBJECT *)((unsigned int)*(unsigned __int8 *)(v7 + 1) - 8),
                    (BUS_QUERY_ID_TYPE)*(_DWORD *)(v7 + 8),
                    (WCHAR **)(a2 + 56));
      break;
    default:
      goto LABEL_25;
  }
  v11 = Interface;
  if( (int)(Interface + 0x80000000) >= 0 && Interface != -1073741637 )
    goto LABEL_15;
  if( Interface != -1073741637 )
    *(_DWORD *)(a2 + 48) = Interface;
LABEL_25:
  HalpPassIrpFromFdoToPdo((DEVICE_OBJECT *)a1, (IRP *)a2);
}

Referenced by:

No references.