PiDcResetChildDeviceContainerCallback

INT64 __fastcall PiDcResetChildDeviceContainerCallback(INT64 a1, const WCHAR *a2, INT64 a3){
  char v3; 
  WCHAR *PoolWithTag; 
  WCHAR *i; 
  struct _DMA_ADAPTER *v9; 
  VOID *v10; 
  _QWORD *v11; 
  _QWORD *v12; 
  int v14; 
  int v15; 
  int v16; 
  ULONG v17; 
  struct _UNICODE_STRING DestinationString; 
  wchar_t Str1[40]; 
  v15 = 0;
  v3 = 0;
  v14 = 0;
  DestinationString = 0i64;
  PoolWithTag = 0i64;
  v16 = 0;
  v17 = 0;
  for( i = (WCHAR *)a2; !CmIsRootDevice(i); i = PoolWithTag )
  {
    if( (int)RtlInitUnicodeStringEx(&DestinationString, i) < 0 )
      goto LABEL_26;
    v9 = (struct _DMA_ADAPTER *)PnpDeviceObjectFromDeviceInstanceWithTag((INT64)&DestinationString, 0x746C6644ui64);
    if( v9 )
    {
      HalPutDmaAdapter(v9);
      break;
    }
    if( i != a2 )
    {
      v14 = 78;
      if( (int)CmGetDeviceRegProp(PiPnpRtlCtx, i, 0i64, 37, (__int64)&v15, (__int64)Str1, (__int64)&v14, 0) < 0 )
        goto LABEL_26;
      if( v15 != 1 || v14 != 78 || wcsicmp(Str1, *(const wchar_t **)(a3 + 8)) )
        break;
    }
    if( !PoolWithTag )
    {
      PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, 0x190ui64, 0x47706E50ui64);
      if( !PoolWithTag )
        return 0i64;
    }
    if( (int)PnpGetObjectProperty(
                a1,
                (__int64)i,
                1i64,
                0i64,
                0i64,
                (__int64)DEVPKEY_Device_LastKnownParent,
                &v16,
                (unsigned __int64)PoolWithTag,
                400,
                &v17,
                0) < 0
      || v16 != 18 )
    {
      goto LABEL_26;
    }
    PoolWithTag[199] = 0;
    if( !wcsicmp(PoolWithTag, *(const wchar_t **)a3) )
    {
      v3 = 1;
      break;
    }
  }
  if( v3 )
  {
    v10 = ExAllocatePoolWithTag(PagedPool, 0x1A0ui64, 0x47706E50ui64);
    v11 = v10;
    if( v10 )
    {
      if( RtlStringCbCopyW((PWCHAR)v10 + 8, 0x190ui64, (PWCHAR)a2) >= 0 )
      {
        v12 = *(_QWORD **)(a3 + 24);
        if( *v12 != a3 + 16 )
          __fastfail(3u);
        *v11 = a3 + 16;
        v11[1] = v12;
        *v12 = v11;
        *(_QWORD *)(a3 + 24) = v11;
        v11 = 0i64;
      }
      if( v11 )
        ExFreePoolWithTag(v11, 0x47706E50u);
    }
  }
LABEL_26:
  if( PoolWithTag )
    ExFreePoolWithTag(PoolWithTag, 0x47706E50u);
  return 0i64;
}

Referenced by:

No references.