PiDcResetChildDeviceContainers

NTSTATUS __stdcall PiDcResetChildDeviceContainers(WCHAR *DeviceInstanceId, WCHAR *PrevContainerId){
  int v3; 
  WCHAR *v4; 
  NTSTATUS DeviceRegProp; 
  NTSTATUS v6; 
  WCHAR *v7; 
  UINT64 *CmRegPropType; 
  UINT64 *CmRegPropTypea; 
  UINT8 *PropertyBuffer; 
  UINT8 *PropertyBuffera; 
  UINT64 *PropertySize; 
  UINT64 *PropertySizea; 
  UINT64 *PropertySizeb; 
  VOID *v16; 
  UINT8 *v17; 
  VOID *v18; 
  UINT64 v19; 
  HPNPCTX v20[2]; 
  WCHAR *v21; 
  PVOID P[3]; 
  UINT8 v23[80]; 

  *(_QWORD *)v20 = DeviceInstanceId;
  v21 = PrevContainerId;
  P[1] = P;
  v3 = 0;
  v19 = 0i64;
  P[0] = P;
  if( wcsicmp(PrevContainerId, L"{00000000-0000-0000-FFFF-FFFFFFFFFFFF}") )
  {
    CmEnumDevicesInContainerWithCallback(
      *(&stru_140CF2E80 + 607),
      PrevContainerId,
      0i64,
      (PNPCTX_REG_ENUM_KEY_ACTION *)PiDcResetChildDeviceContainerCallback,
      v20,
      (const WCHAR *)PropertyBuffer,
      PropertySize,
      v16,
      v19,
      *(UINT64 **)v20,
      (INT64)v21);
    v4 = (WCHAR *)P[0];
    if( P[0] == P )
      goto LABEL_13;
    do
    {
      LODWORD(v17) = 0;
      LODWORD(v19) = 78;
      DeviceRegProp = CmGetDeviceRegProp(
                        *(&stru_140CF2E80 + 607),
                        v4 + 8,
                        0i64,
                        37i64,
                        (UINT64 *)((char *)&v19 + 4),
                        v23,
                        &v19,
                        (UINT64)v17);
      v3 = DeviceRegProp;
      if( DeviceRegProp == -1073741275 || v19 != 0x10000004Ei64 )
        goto LABEL_10;
      if( DeviceRegProp < 0 )
        break;
      v3 = CmRemoveDeviceFromContainer(
             *(&stru_140CF2E80 + 607),
             PrevContainerId,
             (WCHAR *)v23,
             v4 + 8,
             (WCHAR *)CmRegPropType,
             (WCHAR *)PropertyBuffera,
             (WCHAR *)PropertySizea,
             v17,
             v19,
             v20[0]);
      if( v3 < 0 )
        break;
      LODWORD(v18) = 0;
      LODWORD(PropertySizeb) = 0;
      LODWORD(CmRegPropTypea) = 1;
      v6 = CmSetDeviceRegProp(
             *(&stru_140CF2E80 + 607),
             v4 + 8,
             0i64,
             CM_REG_PROP_BASE_CONTAINERID,
             (UINT64)CmRegPropTypea,
             0i64,
             (UINT64)PropertySizeb,
             (UINT64)v18);
      v3 = v6;
      if( v6 == -1073741275 )
      {
LABEL_10:
        v3 = 0;
      }
      else if( v6 < 0 )
      {
        break;
      }
      v4 = *(WCHAR **)v4;
    }
    while( v4 != (WCHAR *)P );
  }
  while( 1 )
  {
    v4 = (WCHAR *)P[0];
LABEL_13:
    if( v4 == (WCHAR *)P )
      break;
    if( *((PVOID **)v4 + 1) != P || (v7 = *(WCHAR **)v4, *(WCHAR **)(*(_QWORD *)v4 + 8i64) != v4) )
      __fastfail(3u);
    P[0] = *(PVOID *)v4;
    *((_QWORD *)v7 + 1) = P;
    ExFreePoolWithTag(v4, 0x47706E50u);
  }
  return v3;
}

Referenced by:

PiDcUpdateDeviceContainerMembership