PiProcessSetDeviceProblem

VOID __fastcall PiProcessSetDeviceProblem(_PNP_DEVICE_ACTION_ENTRY *Request){
  _DEVICE_OBJECT *DeviceObject; 
  _DWORD *RequestArgument; 
  _DEVICE_NODE *DeviceNode; 
  unsigned int v4; 
  unsigned int v5; 
  unsigned int v6; 
  int v7; 
  unsigned int v8; 
  _PNP_DEVNODE_STATE State; 
  UINT64 v10; 
  PVOID P; 

  DeviceObject = Request->DeviceObject;
  RequestArgument = (_DWORD *)Request->RequestArgument;
  P = 0i64;
  DeviceNode = (_DEVICE_NODE *)DeviceObject->DeviceObjectExtension->DeviceNode;
  if( (unsigned int)(DeviceNode->State - 787) > 1 )
  {
    PiPnpRtlBeginOperation((HPNPOPCTX **)&P);
    v4 = RequestArgument[5];
    v5 = RequestArgument[6];
    v6 = (v4 >> 18) & 1 | 4;
    if( (v4 & 0x100) == 0 )
      v6 = (RequestArgument[5] >> 18) & 1;
    v7 = (RequestArgument[5] >> 1) & 0x4000 | 0x2000;
    if( (v4 & 0x400) == 0 )
      v7 = (RequestArgument[5] >> 1) & 0x4000;
    v8 = v7;
    if( v5 == 14 )
    {
      State = DeviceNode->State;
      if( State != DeviceNodeRemoved && State != DeviceNodeInitialized )
        v8 = v7 & 0xFFFFDFFF;
      v6 |= 4u;
    }
    if( !v8 )
    {
      v10 = 0i64;
      goto LABEL_15;
    }
    if( ((DeviceNode->State - 770) & 0xFFFFFFEF) == 0
      && ((v8 & 0x4000) != 0 || v5 < 0x3A && !(unsigned int)PipIsProblemReadonly(DeviceNode, v5)) )
    {
      PipSetDevNodeProblem(DeviceNode, v5, RequestArgument[8]);
      v10 = v8;
LABEL_15:
      PipSetDevNodeFlags(DeviceNode, v10);
      PipSetDevNodeUserFlags(DeviceNode, v6);
    }
  }
  if( (RequestArgument[7] & 1) != 0 )
    ExFreePoolWithTag(RequestArgument, 0x55706E50u);
  if( P )
    PiPnpRtlEndOperation(P);
}

Referenced by:

PnpDeviceActionWorker