CmGetInstallerClassRegPropWorker

__int64 __fastcall CmGetInstallerClassRegPropWorker(
        __int64 a1,
        __int64 a2,
        char *a3,
        int a4,
        _DWORD *a5,
        __int64 a6,
        unsigned int *a7,
        __int16 a8){
  int v8; 
  unsigned int v11; 
  const WCHAR *v12; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  __int64 v16; 
  int ValueIndirect; 
  char *v19; 
  __int64 v20; 
  __int128 v21; 
  HANDLE Handle; 
  v8 = 0;
  Handle = 0i64;
  *((_QWORD *)&v21 + 1) = 0i64;
  if( a8 )
    return(unsigned int)-1073741811;
  if( !a7 || !a5 )
  {
    v8 = -1073741811;
    goto LABEL_18;
  }
  v11 = *a7;
  if( *a7 )
  {
    if( !a6 )
      return(unsigned int)-1073741811;
  }
  *a7 = 0;
  *a5 = 0;
  if( (unsigned int)(a4 - 1) > 0x24 || !CmClassPropertyRead(a4) )
    return(unsigned int)-1073741264;
  if( !a3 )
  {
    v8 = CmOpenInstallerClassRegKey(v16, v12, v14, v15, 33554433, 0, (__int64)&v21 + 8, 0i64);
    if( v8 < 0 )
      goto LABEL_18;
    v16 = a1;
  }
  if( a4 == 8 || a4 == 13 || a4 <= 19 && a4 > 17 )
  {
    if( !a3 )
      a3 = (char *)*((_QWORD *)&v21 + 1);
    goto LABEL_15;
  }
  v19 = (char *)*((_QWORD *)&v21 + 1);
  if( a3 )
    v19 = a3;
  v8 = PnpOpenPropertiesKey(v16, v19, 0i64, 1u, 0, v20, &Handle);
  if( v8 >= 0 )
  {
    a3 = (char *)Handle;
LABEL_15:
    if( !MapCmClassPropertyToRegValue(v13, a4) )
    {
      v8 = -1073741264;
      goto LABEL_18;
    }
    ValueIndirect = PnpCtxRegQueryValueIndirect(a1, (__int64)a3);
    if( ValueIndirect != -1073741772 && ValueIndirect != -1073741444 )
    {
      if( (int)(ValueIndirect + 0x80000000) < 0 || ValueIndirect == -1073741789 )
      {
        if( a4 == 8 && v11 > 0x40 )
        {
          v8 = -1073741595;
        }
        else
        {
          *a7 = v11;
          *a5 = 0;
          if( ValueIndirect || !v11 )
            v8 = -1073741789;
        }
      }
      else
      {
        v8 = ValueIndirect;
      }
      goto LABEL_18;
    }
  }
  v8 = -1073741275;
LABEL_18:
  if( Handle )
    ZwClose(Handle);
  if( *((_QWORD *)&v21 + 1) )
    ZwClose(*((HANDLE *)&v21 + 1));
  return(unsigned int)v8;
}

Referenced by:

CmGetInstallerClassRegProp