PnpDisableDevice

void __fastcall PnpDisableDevice(_DEVICE_NODE *DeviceNode, UINT64 Problem){
  _PNP_DEVNODE_STATE State; 
  unsigned int v3; 

  State = DeviceNode->State;
  v3 = Problem;
  if( State >= DeviceNodeUninitialized )
  {
    if( State <= DeviceNodeInitialized )
    {
LABEL_7:
      IopRemoveDevice(DeviceNode->PhysicalDeviceObject, 2ui64);
      IopReleaseDeviceResources((PDEVICE_NODE)DeviceNode, 1u);
      goto LABEL_8;
    }
    if( State <= DeviceNodeStarted || State <= DeviceNodeEnumerateCompletion )
    {
      if( PiIrpQueryRemoveDevice(DeviceNode->PhysicalDeviceObject, 0i64) < 0 )
      {
        IopRemoveDevice(DeviceNode->PhysicalDeviceObject, 3ui64);
        goto LABEL_8;
      }
      goto LABEL_7;
    }
  }
LABEL_8:
  if( (DeviceNode->Flags & 0x6000) != 0 )
    PipClearDevNodeProblem(DeviceNode);
  PipSetDevNodeProblem(DeviceNode, v3, 0);
}

Referenced by:

PiProcessNewDeviceNode
PnpIsDeviceInstanceEnabled