PiDcResetChildDeviceContainerCallback

NTSTATUS __stdcall PiDcResetChildDeviceContainerCallback(INT64 a1, const WCHAR *a2, INT64 a3){
  char v3; 
  VOID **PoolWithTag; 
  ULONG v7; 
  WCHAR *i; 
  _ADAPTER_OBJECT *v9; 
  VOID **v10; 
  VOID **v11; 
  VOID ***v12; 
  INT64 v14; 
  UINT64 CmRegPropType; 
  INT64 v16; 
  _UNICODE_STRING DestinationString; 
  UINT8 PropertyBuffer[80]; 

  v3 = 0;
  CmRegPropType = 0i64;
  DestinationString = 0i64;
  PoolWithTag = 0i64;
  v16 = 0i64;
  v7 = a1;
  for( i = (WCHAR *)a2; !CmIsRootDevice(i); i = (WCHAR *)PoolWithTag )
  {
    if( RtlInitUnicodeStringEx(&DestinationString, i) < 0 )
      goto LABEL_25;
    v9 = (_ADAPTER_OBJECT *)PnpDeviceObjectFromDeviceInstanceWithTag((__int64)&DestinationString, 0x746C6644u);
    if( v9 )
    {
      HalPutDmaAdapter(v9);
      break;
    }
    if( i != a2 )
    {
      LODWORD(v14) = 0;
      LODWORD(CmRegPropType) = 78;
      if( CmGetDeviceRegProp(
             *(&stru_140CF2E80 + 607),
             i,
             0i64,
             37i64,
             (UINT64 *)((char *)&CmRegPropType + 4),
             PropertyBuffer,
             &CmRegPropType,
             v14) < 0 )
        goto LABEL_25;
      if( CmRegPropType != 0x10000004Ei64 || wcsicmp((const wchar_t *)PropertyBuffer, *(const wchar_t **)(a3 + 8)) )
        break;
    }
    if( !PoolWithTag )
    {
      PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x190ui64, 1198550608i64);
      if( !PoolWithTag )
        return 0;
    }
    if( PnpGetObjectProperty(
           v7,
           (INT64)i,
           1i64,
           0i64,
           0i64,
           (INT64)&DEVPKEY_Device_LastKnownParent,
           (INT64)&v16,
           (INT64)PoolWithTag) < 0
      || (_DWORD)v16 != 18 )
    {
      goto LABEL_25;
    }
    *((_WORD *)PoolWithTag + 199) = 0;
    if( !wcsicmp((const wchar_t *)PoolWithTag, *(const wchar_t **)a3) )
    {
      v3 = 1;
      break;
    }
  }
  if( v3 )
  {
    v10 = ExAllocatePoolWithTag(1ui64, 0x1A0ui64, 1198550608i64);
    v11 = v10;
    if( v10 )
    {
      if( RtlStringCbCopyW((WCHAR *)v10 + 8, 0x190ui64, (WCHAR *)a2) >= 0 )
      {
        v12 = *(VOID ****)(a3 + 24);
        if( *v12 != (VOID **)(a3 + 16) )
          __fastfail(3u);
        *v11 = (VOID *)(a3 + 16);
        v11[1] = v12;
        *v12 = v11;
        *(_QWORD *)(a3 + 24) = v11;
        v11 = 0i64;
      }
      if( v11 )
        ExFreePoolWithTag(v11, 0x47706E50u);
    }
  }
LABEL_25:
  if( PoolWithTag )
    ExFreePoolWithTag(PoolWithTag, 0x47706E50u);
  return 0;
}

Referenced by:

No references.