mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[RAPPS] Hide packages not compatible with the current NT version (#8398)
- Add NTVersion to filter app packages and hide incompatible packages. The format is: "Max-", "Min-Max", "Min" or "Min+". --------- Co-authored-by: Carl J. Bialorucki <[email protected]>
This commit is contained in:
co-authored by
Carl J. Bialorucki
parent
2be203234c
commit
c356035860
@@ -295,10 +295,37 @@ CAvailableApplicationInfo::RetrieveLanguages()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CAvailableApplicationInfo::IsCompatible() const
|
||||
{
|
||||
CStringW szBuffer;
|
||||
if (m_Parser->GetString(DB_NTVER, szBuffer))
|
||||
{
|
||||
LPWSTR start = szBuffer.GetString();
|
||||
LPWSTR p;
|
||||
ULONG MinNTVer = wcstoul(start, &p, 0);
|
||||
if (p > start)
|
||||
{
|
||||
ULONG NTVersion = GetNTVersion();
|
||||
// Treat as range if we have '-', otherwise treat it as XXX+
|
||||
ULONG MaxNTVer = (*p == '-') ? wcstoul(++p, NULL, 0) : UINT_MAX;
|
||||
// Handle the XXX- case (That version or lower)
|
||||
if (MaxNTVer == 0)
|
||||
{
|
||||
MaxNTVer = MinNTVer;
|
||||
MinNTVer = 0;
|
||||
}
|
||||
|
||||
return NTVersion >= MinNTVer && NTVersion <= MaxNTVer;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL
|
||||
CAvailableApplicationInfo::Valid() const
|
||||
{
|
||||
return !szDisplayName.IsEmpty() && !m_szUrlDownload.IsEmpty();
|
||||
return !szDisplayName.IsEmpty() && !m_szUrlDownload.IsEmpty() && IsCompatible();
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
||||
@@ -98,6 +98,7 @@ enum InstallerType
|
||||
#define DB_SCOPE L"Scope" // User or Machine
|
||||
#define DB_SAVEAS L"SaveAs"
|
||||
#define DB_SILENTARGS L"SilentParameters"
|
||||
#define DB_NTVER L"NTVersion" // "Max-" || "Min-Max" || "Min" || "Min+"
|
||||
|
||||
#define DB_GENINSTSECTION L"Generate"
|
||||
#define GENERATE_ARPSUBKEY L"RApps" // Our uninstall data is stored here
|
||||
@@ -175,6 +176,9 @@ class CAvailableApplicationInfo : public CAppInfo
|
||||
CConfigParser *
|
||||
GetConfigParser() const { return m_Parser; }
|
||||
|
||||
bool
|
||||
IsCompatible() const;
|
||||
|
||||
virtual BOOL
|
||||
Valid() const override;
|
||||
virtual BOOL
|
||||
|
||||
@@ -85,6 +85,8 @@ ExtractFilesFromCab(LPCWSTR FullCabPath, const CStringW &szOutputDir,
|
||||
|
||||
BOOL
|
||||
IsSystem64Bit();
|
||||
ULONG
|
||||
GetNTVersion();
|
||||
|
||||
INT
|
||||
GetSystemColorDepth();
|
||||
|
||||
@@ -391,6 +391,16 @@ IsSystem64Bit()
|
||||
#endif
|
||||
}
|
||||
|
||||
ULONG
|
||||
GetNTVersion()
|
||||
{
|
||||
RTL_OSVERSIONINFOW osvi = {0};
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
RtlGetVersion(&osvi);
|
||||
|
||||
return (osvi.dwMajorVersion << 8) | (osvi.dwMinorVersion);
|
||||
}
|
||||
|
||||
INT
|
||||
GetSystemColorDepth()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user