mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[RAPPS] Implement support for architecture specific sections
See CORE-17616
This commit is contained in:
parent
20c1da7963
commit
1f5f614c7a
3 changed files with 47 additions and 4 deletions
|
@ -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:
|
||||
|
|
|
@ -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 = "");
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue