PiCMSetProblem

NTSTATUS __stdcall PiCMSetProblem(
        WCHAR *DeviceId,
        UINT64 ProblemToSet,
        _CMAPI_SET_DEVICE_PROBLEM_ACTION Flags,
        INT64 a4,
        INT64 a5,
        UINT64 a6,
        UINT64 a7){
  int v8; 
  NTSTATUS result; 
  int v11; 
  UINT64 v12; 
  INT64 v13; 
  _UNICODE_STRING DestinationString; 
  __int128 v15; 
  __int64 v16; 
  UINT64 v17; 
  UINT64 DeviceStatus; 

  LODWORD(v13) = 0;
  LODWORD(v17) = 0;
  LODWORD(DeviceStatus) = 0;
  v8 = ProblemToSet;
  if( (unsigned int)(Flags - 1) > 1 )
    return -1073741811;
  result = CmGetDeviceStatus(*(&stru_140CF2E80 + 607), DeviceId, 0i64, &DeviceStatus, &v17, &v13, v12);
  if( result >= 0 )
  {
    v11 = v17;
    if( v8 && (DeviceStatus & 0x400) != 0 && Flags != CMAPI_SET_DEVICE_PROBLEM_OVERRIDE && (_DWORD)v17 != v8 )
      return -1073741811;
    DestinationString = 0i64;
    v16 = 0i64;
    v15 = 0i64;
    RtlInitUnicodeString(&DestinationString, DeviceId);
    DWORD1(v15) = 1024;
    if( v8 )
    {
      LODWORD(v15) = 1;
      DWORD2(v15) = v8;
    }
    else
    {
      LODWORD(v15) = 2;
      DWORD2(v15) = v11;
    }
    return ZwPlugPlayControl(PlugPlayControlDeviceStatus, &DestinationString, 0x28ui64);
  }
  return result;
}

Referenced by:

PiCMDeviceAction
PiCMSetDeviceProblem