PipProcessStartPhase2

NTSTATUS __stdcall PipProcessStartPhase2(_DEVICE_NODE *DeviceNode){
  __int64 v1; 
  __int64 v2; 
  int CompletionStatus; 
  __int64 v5; 
  _INTERFACE_TYPE InterfaceType; 
  int v8; 

  if( (byte_140C130BB & 0x10) != 0 )
    McTemplateK0dz_EtwWriteTransfer(
      (__int64)DeviceNode,
      (const _EVENT_DESCRIPTOR *)KMPnPEvt_ProcessDeviceStart_Start,
      v2,
      2,
      DeviceNode->InstancePath.Buffer);
  CompletionStatus = DeviceNode->CompletionStatus;
  if( DeviceNode->DockInfo.DockStatus )
  {
    if( CompletionStatus < 0 )
      PpProfileCancelHardwareProfileTransition();
    else
      PpProfileCommitTransitioningDock(DeviceNode, DOCK_ARRIVING);
  }
  if( CompletionStatus < 0 )
  {
    if( CompletionStatus == -1073741102 )
    {
      v8 = 14;
      PnpUpdateRebootRequiredReason((INT64)DeviceNode->InstancePath.Buffer, v1, 0x40000000i64);
    }
    else
    {
      v8 = 10;
    }
    PnpRequestDeviceRemoval((__int64)DeviceNode, 0, v8, CompletionStatus);
    if( DeviceNode->DockInfo.DockStatus )
      IoRequestDeviceEject((UINT64)DeviceNode->PhysicalDeviceObject);
  }
  else
  {
    IopDoDeferredSetInterfaceState(DeviceNode);
    if( !*(&PnpReplaceEvent + 6680) )
    {
      InterfaceType = DeviceNode->InterfaceType;
      if( InterfaceType != InterfaceTypeUndefined )
      {
        if( InterfaceType == Isa )
        {
          IopAllocateLegacyBootResources(Eisa, DeviceNode->BusNumber);
          InterfaceType = DeviceNode->InterfaceType;
        }
        IopAllocateLegacyBootResources(InterfaceType, DeviceNode->BusNumber);
      }
    }
    PipSetDevNodeState(DeviceNode, DeviceNodeStartPostWork);
  }
  if( (byte_140C130BB & 0x10) != 0 )
    McTemplateK0dz_EtwWriteTransfer(
      (__int64)DeviceNode->InstancePath.Buffer,
      (const _EVENT_DESCRIPTOR *)KMPnPEvt_ProcessDeviceStart_Stop,
      v5,
      2,
      DeviceNode->InstancePath.Buffer);
  return CompletionStatus;
}

Referenced by:

PipProcessDevNodeTree