RtlGetProductInfo

UINT8 __stdcall RtlGetProductInfo(
        UINT64 OSMajorVersion,
        UINT64 OSMinorVersion,
        UINT64 SpMajorVersion,
        UINT64 SpMinorVersion,
        UINT64 *ReturnedProductType){
  int v5; 
  UINT8 v6; 
  unsigned __int64 v8; 
  int v9; 
  unsigned __int64 v10; 
  __int64 v11; 
  UINT64 Type; 
  int Data; 
  _RTLP_VERSION_INFO v14; 
  _RTLP_VERSION_INFO v1; 
  _RTLP_VERSION_INFO v2; 
  _DWORD v17[52]; 

  v5 = 0;
  v6 = 1;
  Type = 0i64;
  Data = 0;
  v14.OSMajorVersion = OSMajorVersion;
  v14.OSMinorVersion = OSMinorVersion;
  v14.SpMajorVersion = SpMajorVersion;
  v14.SpMinorVersion = SpMinorVersion;
  if( !ReturnedProductType )
    return 0;
  *(_DWORD *)ReturnedProductType = 0;
  v1.OSMajorVersion = OSMajorVersion;
  v1.OSMinorVersion = OSMinorVersion;
  v2 = (_RTLP_VERSION_INFO)xmmword_140011510;
  v1.SpMajorVersion = SpMajorVersion;
  v1.SpMinorVersion = SpMinorVersion;
  if( CompareVersions(&v1, &v2) < 0 )
    return 0;
  if( ZwQueryLicenseValue((_UNICODE_STRING *)&stru_140001F68 + 1, (UINT64 *)((char *)&Type + 4), &Data, 4ui64, &Type) < 0
    || Type != 0x400000004i64 )
  {
    *(_DWORD *)ReturnedProductType = -1412584499;
    return v6;
  }
  if( ZwQueryLicenseValue((_UNICODE_STRING *)&stru_140001F68, (UINT64 *)((char *)&Type + 4), v17, 0xC8ui64, &Type) < 0 )
    goto LABEL_6;
  if( HIDWORD(Type) != 3 || (unsigned int)Type < 0x14 || (unsigned int)Type != 20 * ((unsigned int)Type / 0x14ui64) )
    return 0;
  if( (unsigned int)Type / 0x14ui64 )
  {
    v8 = 0i64;
    do
    {
      v2 = *(_RTLP_VERSION_INFO *)&v17[5 * v8];
      if( CompareVersions(&v14, &v2) < 0 )
        v5 = v17[v11 + 4];
      v8 = (unsigned int)(v9 + 1);
    }
    while( v8 < v10 );
    if( v5 )
    {
      *(_DWORD *)ReturnedProductType = v5;
      return v6;
    }
  }
LABEL_6:
  *(_DWORD *)ReturnedProductType = Data;
  return v6;
}

Referenced by:

ExGetSuiteMask
ExpInitSystemPhase1