PiCMGetObjectProperty

NTSTATUS __stdcall PiCMGetObjectProperty(
        VOID *IoctlInputBuffer,
        UINT64 IoctlInputBufferSize,
        VOID *IoctlOutputBuffer,
        UINT64 IoctlOutputBufferSize,
        UINT64 *BytesUsed){
  UINT64 *v5; 
  unsigned int v6; 
  unsigned int v9; 
  VOID **PoolWithTag; 
  int v11; 
  INT64 v12; 
  unsigned int v13; 
  int v14; 
  NTSTATUS ObjectProperty; 
  NTSTATUS v16; 
  INT64 v18; 
  INT64 v19; 
  INT64 v20; 
  INT64 v21; 
  UINT64 *v22; 
  _CMAPI_INPUT_PROPERTY_DATA PropertyData[20]; 
  UINT64 *v24; 

  v5 = v24;
  v6 = IoctlInputBufferSize;
  v22 = v24;
  v9 = IoctlOutputBufferSize;
  memset(PropertyData, 0i64, 0x48u);
  *(_DWORD *)v24 = 0;
  PoolWithTag = 0i64;
  v21 = 0i64;
  v11 = PiCMCapturePropertyInputData(IoctlInputBuffer, v6, (_CMAPI_INPUT_PROPERTY_DATA *)(unsigned int)BytesUsed);
  if( v11 < 0 )
    goto LABEL_29;
  v12 = *(_QWORD *)&PropertyData[4];
  if( *(_QWORD *)&PropertyData[4]
    && !PropertyData[1]
    && !*(_QWORD *)&PropertyData[14]
    && !PropertyData[16]
    && !PropertyData[12] )
  {
    if( !IoctlOutputBuffer || v9 < 0x14 )
    {
      v11 = -1073741811;
      goto LABEL_34;
    }
    v13 = 0;
    if( PropertyData[2] <= 6 )
    {
      switch( PropertyData[2] )
      {
        case 6:
          v13 = 6;
LABEL_19:
          if( v11 < 0 )
            goto LABEL_34;
          if( v9 != 20 )
          {
            PoolWithTag = ExAllocatePoolWithTag(1ui64, v9 - 20, 879783504i64);
            if( !PoolWithTag )
              v11 = -1073741670;
          }
          if( v11 < 0 )
            goto LABEL_34;
          ObjectProperty = PnpGetObjectProperty(
                             *(&stru_140CF2E80 + 1214),
                             v12,
                             v13,
                             0i64,
                             0i64,
                             (INT64)&PropertyData[7],
                             (INT64)&v21,
                             (INT64)PoolWithTag);
          v5 = v22;
          v11 = ObjectProperty;
          goto LABEL_25;
        case 1:
          v13 = 1;
          goto LABEL_19;
        case 2:
          v13 = 2;
          goto LABEL_19;
        case 3:
          v13 = 4;
          goto LABEL_19;
        case 4:
          v13 = 3;
          goto LABEL_19;
        case 5:
          v13 = 5;
          goto LABEL_19;
      }
LABEL_17:
      if( !v13 )
        v11 = -1073741811;
      goto LABEL_19;
    }
    switch( PropertyData[2] )
    {
      case 65537:
        v14 = 7;
        break;
      case 65538:
        v14 = 8;
        break;
      case 65539:
        v14 = 9;
        break;
      case 65540:
        v14 = 10;
        break;
      case 65541:
        v14 = 11;
        break;
      default:
        goto LABEL_17;
    }
    v13 = *(&stru_140CF2E80 + 608) != 0i64 ? v14 : 0;
    goto LABEL_17;
  }
  v11 = -1073741811;
LABEL_25:
  if( v11 >= 0 )
  {
    LODWORD(v20) = v9;
    LODWORD(v19) = PropertyData[17];
    LODWORD(v18) = HIDWORD(v21);
    v16 = PiCMReturnBufferResultData(
            (unsigned int)v11,
            HIDWORD(v21),
            (unsigned int)v21,
            PoolWithTag,
            v18,
            v19,
            IoctlOutputBuffer,
            v20,
            v5);
    goto LABEL_27;
  }
LABEL_34:
  LODWORD(v20) = v9;
  LODWORD(v19) = PropertyData[17];
  LODWORD(v18) = 0;
  v16 = PiCMReturnBufferResultData(
          (unsigned int)v11,
          HIDWORD(v21),
          (unsigned int)v21,
          0i64,
          v18,
          v19,
          IoctlOutputBuffer,
          v20,
          v22);
LABEL_27:
  v11 = v16;
  if( PoolWithTag )
    ExFreePoolWithTag(PoolWithTag, 0x34706E50u);
LABEL_29:
  PiCMReleasePropertyInputData(PropertyData);
  return v11;
}

Referenced by:

PiCMHandleIoctl