CmGetInstallerClassMappedPropertyFromComposite

NTSTATUS __stdcall CmGetInstallerClassMappedPropertyFromComposite(
        HPNPCTX *hPnpCtx,
        WCHAR *ClassGuid,
        VOID *ObjectBaseKey,
        _DEVPROPKEY *PropertyKey,
        UINT64 *PropertyType,
        UINT8 *PropertyBuffer,
        UINT64 BufferSize,
        UINT64 *PropertySize){
  UINT8 *v9; 
  int v12; 
  unsigned int v13; 
  unsigned int pid; 
  __int64 v15; 
  __int64 v17; 
  __int64 v18; 
  NTSTATUS v19; 
  __int64 v20; 
  NTSTATUS ObjectProperty; 
  NTSTATUS v22; 
  INT64 v23; 
  ULONG Tag; 

  Tag = (unsigned int)hPnpCtx;
  v9 = PropertyBuffer;
  *(_DWORD *)PropertyType = 0;
  v12 = 0;
  *(_DWORD *)PropertySize = 0;
  if( PropertyBuffer )
  {
    v13 = BufferSize;
    v9 = (UINT8 *)(-(__int64)((_DWORD)BufferSize != 0) & (unsigned __int64)PropertyBuffer);
  }
  else
  {
    v13 = 0;
  }
  pid = PropertyKey->pid;
  if( pid < 2 )
    return -1073741264;
  if( pid == 10 )
  {
    v20 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&DEVPKEY_NAME.fmtid.Data1;
    if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&DEVPKEY_NAME.fmtid.Data1 )
      v20 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)DEVPKEY_NAME.fmtid.Data4;
    if( !v20 )
    {
      ObjectProperty = PnpGetObjectProperty(
                         (ULONG)hPnpCtx,
                         (INT64)ClassGuid,
                         2i64,
                         (INT64)ObjectBaseKey,
                         0i64,
                         (INT64)&DEVPKEY_DeviceClass_Name,
                         (INT64)PropertyType,
                         (INT64)v9);
      v12 = ObjectProperty;
      switch( ObjectProperty )
      {
        case 0:
          goto LABEL_30;
        case -1073741789:
          goto LABEL_30;
        case -1073741275:
          v22 = PnpGetObjectProperty(
                  Tag,
                  (INT64)ClassGuid,
                  2i64,
                  (INT64)ObjectBaseKey,
                  0i64,
                  (INT64)&DEVPKEY_DeviceClass_ClassName,
                  (INT64)PropertyType,
                  (INT64)v9);
          v12 = v22;
          if( !v22 || v22 == -1073741789 )
            goto LABEL_30;
          break;
      }
    }
  }
  else
  {
    if( pid != 4 )
    {
      if( pid == 20 )
      {
        v17 = *(_QWORD *)&PropertyKey->fmtid.Data1 - DEVPKEY_DeviceClass_CompoundUpperFilters;
        if( *(_QWORD *)&PropertyKey->fmtid.Data1 == DEVPKEY_DeviceClass_CompoundUpperFilters )
          v17 = *(_QWORD *)PropertyKey->fmtid.Data4 - 0x4B88D2ECD9DBB9A9i64;
        if( !v17 )
          goto LABEL_11;
      }
      if( pid == 21 )
      {
        v15 = *(_QWORD *)&PropertyKey->fmtid.Data1 - DEVPKEY_DeviceClass_CompoundLowerFilters;
        if( *(_QWORD *)&PropertyKey->fmtid.Data1 == DEVPKEY_DeviceClass_CompoundLowerFilters )
          v15 = *(_QWORD *)PropertyKey->fmtid.Data4 - 0x4B88D2ECD9DBB9A9i64;
        if( !v15 )
        {
LABEL_11:
          LODWORD(v23) = v13;
          return CmGetInstallerClassCompoundFilters(
                   (INT64)hPnpCtx,
                   ClassGuid,
                   ObjectBaseKey,
                   (INT64)PropertyKey,
                   PropertyType,
                   v9,
                   v23,
                   (INT64)PropertySize);
        }
      }
      return v12;
    }
    v18 = *(_QWORD *)&PropertyKey->fmtid.Data1 - DEVPKEY_DeviceClass_Configurable;
    if( *(_QWORD *)&PropertyKey->fmtid.Data1 == DEVPKEY_DeviceClass_Configurable )
      v18 = *(_QWORD *)PropertyKey->fmtid.Data4 - 0x4B88D2ECD9DBB9A9i64;
    if( !v18 )
    {
      v19 = PnpGetObjectProperty(
              (ULONG)hPnpCtx,
              (INT64)ClassGuid,
              2i64,
              (INT64)ObjectBaseKey,
              0i64,
              (INT64)&DEVPKEY_DeviceClass_ConfigurableOverride,
              (INT64)PropertyType,
              (INT64)v9);
      v12 = v19;
      if( v19 && v19 != -1073741789 )
      {
        if( v19 == -1073741275 )
        {
          v12 = PnpGetObjectProperty(
                  Tag,
                  (INT64)ClassGuid,
                  2i64,
                  (INT64)ObjectBaseKey,
                  0i64,
                  (INT64)&DEVPKEY_DeviceClass_ClassInstaller,
                  (INT64)PropertyType,
                  0i64);
          if( v12 == -1073741275 )
            v12 = PnpGetObjectProperty(
                    Tag,
                    (INT64)ClassGuid,
                    2i64,
                    (INT64)ObjectBaseKey,
                    0i64,
                    (INT64)&DEVPKEY_DeviceClass_ClassCoInstallers,
                    (INT64)PropertyType,
                    0i64);
          if( v12 >= 0 || v12 == -1073741275 || v12 == -1073741789 )
          {
            *(_DWORD *)PropertySize = 1;
            *(_DWORD *)PropertyType = 17;
            if( v13 < *(_DWORD *)PropertySize )
            {
              return -1073741789;
            }
            else
            {
              *v9 = (v12 != -1073741275) - 1;
              return 0;
            }
          }
        }
        return v12;
      }
LABEL_30:
      *(_DWORD *)PropertySize = 0;
    }
  }
  return v12;
}

Referenced by:

CmGetInstallerClassMappedProperty
CmGetInstallerClassMappedPropertyKeys