https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1f5f614c7abafd5a2a0a4…
commit 1f5f614c7abafd5a2a0a41480e596f7497c4a32d
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Fri Jun 4 15:20:21 2021 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Jun 5 19:17:05 2021 +0200
[RAPPS] Implement support for architecture specific sections
See CORE-17616
---
base/applications/rapps/available.cpp | 9 +++++++++
base/applications/rapps/include/misc.h | 14 ++++++++++++++
base/applications/rapps/misc.cpp | 28 ++++++++++++++++++++++++----
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/base/applications/rapps/available.cpp
b/base/applications/rapps/available.cpp
index 075afd7063a..01f8fe5facf 100644
--- a/base/applications/rapps/available.cpp
+++ b/base/applications/rapps/available.cpp
@@ -516,6 +516,15 @@ BOOL CAvailableApps::Enum(INT EnumType, AVAILENUMPROC lpEnumProc,
PVOID param)
// set a timestamp for the next time
Info->SetLastWriteTime(&FindFileData.ftLastWriteTime);
+
+ /* Check if we have the download URL */
+ if (Info->m_szUrlDownload.IsEmpty())
+ {
+ /* Can't use it, delete it */
+ delete Info;
+ continue;
+ }
+
m_InfoList.AddTail(Info);
skip_if_cached:
diff --git a/base/applications/rapps/include/misc.h
b/base/applications/rapps/include/misc.h
index 86456b0871b..7bb6afcecb5 100644
--- a/base/applications/rapps/include/misc.h
+++ b/base/applications/rapps/include/misc.h
@@ -6,6 +6,19 @@
#define EPOCH_DIFF 116444736000000000 //FILETIME starts from 1601-01-01 UTC, UnixTime
starts from 1970-01-01
#define RATE_DIFF 10000000
+#ifdef _M_IX86
+#define CurrentArchitecture L"x86"
+#elif defined(_M_AMD64)
+#define CurrentArchitecture L"amd64"
+#elif defined(_M_ARM)
+#define CurrentArchitecture L"arm"
+#elif defined(_M_ARM64)
+#define CurrentArchitecture L"arm64"
+#elif defined(_M_IA64)
+#define CurrentArchitecture L"ia64"
+#elif defined(_M_PPC)
+#define CurrentArchitecture L"ppc"
+#endif
INT GetWindowWidth(HWND hwnd);
INT GetWindowHeight(HWND hwnd);
@@ -41,6 +54,7 @@ class CConfigParser
ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName);
VOID CacheINILocale();
+ BOOL GetStringWorker(const ATL::CStringW& KeyName, PCWSTR Suffix,
ATL::CStringW& ResultString);
public:
CConfigParser(const ATL::CStringW& FileName = "");
diff --git a/base/applications/rapps/misc.cpp b/base/applications/rapps/misc.cpp
index 54a965bce13..8f1310d2320 100644
--- a/base/applications/rapps/misc.cpp
+++ b/base/applications/rapps/misc.cpp
@@ -351,13 +351,13 @@ VOID CConfigParser::CacheINILocale()
m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale;
}
-BOOL CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW&
ResultString)
+BOOL CConfigParser::GetStringWorker(const ATL::CStringW& KeyName, PCWSTR Suffix,
ATL::CStringW& ResultString)
{
DWORD dwResult;
LPWSTR ResultStringBuffer = ResultString.GetBuffer(MAX_PATH);
// 1st - find localized strings (e.g. "Section.0c0a")
- dwResult = GetPrivateProfileStringW(m_szCachedINISectionLocale.GetString(),
+ dwResult = GetPrivateProfileStringW((m_szCachedINISectionLocale +
Suffix).GetString(),
KeyName.GetString(),
NULL,
ResultStringBuffer,
@@ -367,7 +367,7 @@ BOOL CConfigParser::GetString(const ATL::CStringW& KeyName,
ATL::CStringW& Resul
if (!dwResult)
{
// 2nd - if they weren't present check for neutral sub-langs/ generic
translations (e.g. "Section.0a")
- dwResult =
GetPrivateProfileStringW(m_szCachedINISectionLocaleNeutral.GetString(),
+ dwResult = GetPrivateProfileStringW((m_szCachedINISectionLocaleNeutral +
Suffix).GetString(),
KeyName.GetString(),
NULL,
ResultStringBuffer,
@@ -376,7 +376,7 @@ BOOL CConfigParser::GetString(const ATL::CStringW& KeyName,
ATL::CStringW& Resul
if (!dwResult)
{
// 3rd - if they weren't present fallback to standard english strings
(just "Section")
- dwResult = GetPrivateProfileStringW(L"Section",
+ dwResult = GetPrivateProfileStringW((ATL::CStringW(L"Section") +
Suffix).GetString(),
KeyName.GetString(),
NULL,
ResultStringBuffer,
@@ -389,6 +389,26 @@ BOOL CConfigParser::GetString(const ATL::CStringW& KeyName,
ATL::CStringW& Resul
return (dwResult != 0 ? TRUE : FALSE);
}
+BOOL CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW&
ResultString)
+{
+ /* First try */
+ if (GetStringWorker(KeyName, L"." CurrentArchitecture, ResultString))
+ {
+ return TRUE;
+ }
+
+#ifndef _M_IX86
+ /* On non-x86 architecture we need the architecture specific URL */
+ if (KeyName == L"URLDownload")
+ {
+ return FALSE;
+ }
+#endif
+
+ /* Fall back to default */
+ return GetStringWorker(KeyName, L"", ResultString);
+}
+
BOOL CConfigParser::GetInt(const ATL::CStringW& KeyName, INT& iResult)
{
ATL::CStringW Buffer;