PiDcResetChildDeviceContainers

INT64 __stdcall PiDcResetChildDeviceContainers(const WCHAR *DeviceInstanceId, const WCHAR *PrevContainerId){
  int v3; 
  wchar_t *v4; 
  int DeviceRegProp; 
  int v6; 
  wchar_t *v7; 
  int v9; 
  int v10; 
  __int64 v11[2]; 
  PVOID P[3]; 
  char v13[80]; 
  v11[0] = (__int64)DeviceInstanceId;
  v11[1] = (__int64)PrevContainerId;
  P[1] = P;
  v3 = 0;
  v10 = 0;
  v9 = 0;
  P[0] = P;
  if( wcsicmp(PrevContainerId, L"{00000000-0000-0000-FFFF-FFFFFFFFFFFF}") )
  {
    CmEnumDevicesInContainerWithCallback(
      PiPnpRtlCtx,
      (__int64)PrevContainerId,
      0i64,
      (__int64)PiDcResetChildDeviceContainerCallback,
      (__int64)v11);
    v4 = (wchar_t *)P[0];
    if( P[0] == P )
      goto LABEL_14;
    do
    {
      v9 = 78;
      DeviceRegProp = CmGetDeviceRegProp(PiPnpRtlCtx, v4 + 8, 0i64, 37, (__int64)&v10, (__int64)v13, (__int64)&v9, 0);
      v3 = DeviceRegProp;
      if( DeviceRegProp == -1073741275 || v10 != 1 || v9 != 78 )
        goto LABEL_11;
      if( DeviceRegProp < 0 )
        break;
      v3 = CmRemoveDeviceFromContainer(PiPnpRtlCtx, PrevContainerId, (__int64)v13, (__int64)(v4 + 8));
      if( v3 < 0 )
        break;
      v6 = CmSetDeviceRegProp(PiPnpRtlCtx, v4 + 8, 0i64, 0x25u, 1u, 0i64, 0, 0);
      v3 = v6;
      if( v6 == -1073741275 )
      {
LABEL_11:
        v3 = 0;
      }
      else if( v6 < 0 )
      {
        break;
      }
      v4 = *(wchar_t **)v4;
    }
    while( v4 != (wchar_t *)P );
  }
  while( 1 )
  {
    v4 = (wchar_t *)P[0];
LABEL_14:
    if( v4 == (wchar_t *)P )
      break;
    if( *((PVOID **)v4 + 1) != P || (v7 = *(wchar_t **)v4, *(wchar_t **)(*(_QWORD *)v4 + 8i64) != v4) )
      __fastfail(3u);
    P[0] = *(PVOID *)v4;
    *((_QWORD *)v7 + 1) = P;
    ExFreePoolWithTag(v4, 0x47706E50u);
  }
  return(unsigned int)v3;
}

Referenced by:

PiDcUpdateDeviceContainerMembership