From 7a2c1f7d0bdd93474ff1b57dd77c7277e6b8bba3 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Wed, 30 Sep 2020 19:24:52 +0200 Subject: [PATCH] [RAPPS] Re-add support for icons named after the ini file --- base/applications/rapps/available.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/base/applications/rapps/available.cpp b/base/applications/rapps/available.cpp index d32e5f8d74a..6de168024dd 100644 --- a/base/applications/rapps/available.cpp +++ b/base/applications/rapps/available.cpp @@ -92,18 +92,32 @@ VOID CAvailableApplicationInfo::RetrieveGeneralInfo(AvailableStrings& AvlbString } } + ATL::CStringW IconPath = AvlbStrings.szAppsPath; + PathAppendW(IconPath.GetBuffer(MAX_PATH), L"icons"); + // TODO: are we going to support specify an URL for an icon ? ATL::CStringW IconLocation; if (GetString(L"Icon", IconLocation)) { - // TODO: Does the filename contain anything stuff like ":" "<" ">" ? - // these stuff may lead to security issues - ATL::CStringW IconPath = AvlbStrings.szAppsPath; - PathAppendW(IconPath.GetBuffer(MAX_PATH), L"icons"); BOOL bSuccess = PathAppendNoDirEscapeW(IconPath.GetBuffer(), IconLocation.GetString()); IconPath.ReleaseBuffer(); - if (bSuccess) + if (!bSuccess) + { + IconPath.Empty(); + } + } + else + { + // inifile.ico + PathAppendW(IconPath.GetBuffer(), m_szPkgName); + IconPath.ReleaseBuffer(); + IconPath += L".ico"; + } + + if (!IconPath.IsEmpty()) + { + if (PathFileExistsW(IconPath)) { m_szIconLocation = IconPath; }