Skip to content

Commit 8ce870d

Browse files
authored
[RAPPS] Added /S switch for silent installs (reactos#8241)
MSI, Inno and NSIS installers are automatically detected (also if they are nested by ExeInZip). Others can specify command line switches in the rapps-db package.
1 parent 47d6b3a commit 8ce870d

36 files changed

+301
-65
lines changed

base/applications/rapps/appinfo.cpp

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,18 +375,48 @@ CAvailableApplicationInfo::GetDisplayInfo(CStringW &License, CStringW &Size, CSt
375375
UrlDownload = m_szUrlDownload;
376376
}
377377

378+
static InstallerType
379+
GetInstallerTypeFromString(const CStringW &Installer)
380+
{
381+
if (Installer.CompareNoCase(L"Inno") == 0)
382+
return INSTALLER_INNO;
383+
if (Installer.CompareNoCase(L"NSIS") == 0)
384+
return INSTALLER_NSIS;
385+
return INSTALLER_UNKNOWN;
386+
}
387+
378388
InstallerType
379-
CAvailableApplicationInfo::GetInstallerType() const
389+
CAvailableApplicationInfo::GetInstallerType(bool NestedType) const
380390
{
381391
CStringW str;
382392
m_Parser->GetString(DB_INSTALLER, str);
383393
if (str.CompareNoCase(DB_INSTALLER_GENERATE) == 0)
394+
{
384395
return INSTALLER_GENERATE;
385-
if (str.CompareNoCase(DB_INSTALLER_EXEINZIP) == 0)
396+
}
397+
else if (str.CompareNoCase(DB_INSTALLER_EXEINZIP) == 0)
398+
{
399+
if (NestedType)
400+
{
401+
CStringW nested;
402+
m_Parser->GetSectionString(DB_EXEINZIPSECTION, DB_INSTALLER, nested);
403+
InstallerType it = GetInstallerTypeFromString(nested);
404+
if (it != INSTALLER_UNKNOWN)
405+
return it;
406+
}
386407
return INSTALLER_EXEINZIP;
408+
}
387409
return INSTALLER_UNKNOWN;
388410
}
389411

412+
InstallerType
413+
CAvailableApplicationInfo::GetInstallerInfo(CStringW &SilentParameters) const
414+
{
415+
InstallerType it = GetInstallerType(true);
416+
m_Parser->GetString(DB_SILENTARGS, SilentParameters);
417+
return it;
418+
}
419+
390420
BOOL
391421
CAvailableApplicationInfo::UninstallApplication(UninstallCommandFlags Flags)
392422
{
@@ -584,7 +614,7 @@ CInstalledApplicationInfo::GetDisplayInfo(CStringW &License, CStringW &Size, CSt
584614
}
585615

586616
InstallerType
587-
CInstalledApplicationInfo::GetInstallerType() const
617+
CInstalledApplicationInfo::GetInstallerType(bool NestedType) const
588618
{
589619
CRegKey reg;
590620
if (reg.Open(m_hKey, GENERATE_ARPSUBKEY, KEY_READ) == ERROR_SUCCESS)

base/applications/rapps/geninst.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,10 @@ CreateUI(BOOL Silent, LPTHREAD_START_ROUTINE ThreadProc)
678678
}
679679

680680
BOOL
681-
ExtractAndRunGeneratedInstaller(const CAvailableApplicationInfo &AppInfo, LPCWSTR Archive)
681+
ExtractAndRunGeneratedInstaller(const CAvailableApplicationInfo &AppInfo, LPCWSTR Archive, bool Silent)
682682
{
683683
InstallInfo Info(AppInfo.szDisplayName, *AppInfo.GetConfigParser(), Archive);
684+
Info.Silent = Silent;
684685
g_pInfo = &Info;
685686
return CreateUI(Info.Silent, ExtractAndInstallThread) ? !Info.Error : FALSE;
686687
}

base/applications/rapps/gui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ CMainWindow::OnCommand(WPARAM wParam, LPARAM lParam)
579579
{
580580
if (!m_Selected.IsEmpty())
581581
{
582-
if (DownloadListOfApplications(m_Selected, FALSE))
582+
if (DownloadListOfApplications(m_Selected))
583583
{
584584
m_Selected.RemoveAll();
585585
UpdateApplicationsList(SelectedEnumType);

base/applications/rapps/include/appinfo.h

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <atlpath.h>
55
#include <atlsimpcoll.h>
66

7-
87
enum LicenseType
98
{
109
LICENSE_NONE,
@@ -72,18 +71,21 @@ IsInstalledEnum(INT x)
7271

7372
enum UninstallCommandFlags
7473
{
75-
UCF_NONE = 0x00,
76-
UCF_MODIFY = 0x01,
77-
UCF_SILENT = 0x02,
74+
UCF_NONE = 0x00,
75+
UCF_SILENT = 0x01,
76+
UCF_MODIFY = 0x02,
7877
UCF_SAMEPROCESS = 0x04,
7978
};
8079
DEFINE_ENUM_FLAG_OPERATORS(UninstallCommandFlags);
8180

8281
enum InstallerType
8382
{
8483
INSTALLER_UNKNOWN,
84+
INSTALLER_EXEINZIP, // setup.exe we extract from a .zip file
8585
INSTALLER_GENERATE, // .zip file automatically converted to installer by rapps
86-
INSTALLER_EXEINZIP,
86+
INSTALLER_MSI,
87+
INSTALLER_INNO,
88+
INSTALLER_NSIS,
8789
};
8890

8991
#define DB_VERSION L"Version"
@@ -95,6 +97,7 @@ enum InstallerType
9597
#define DB_INSTALLER_EXEINZIP L"ExeInZip"
9698
#define DB_SCOPE L"Scope" // User or Machine
9799
#define DB_SAVEAS L"SaveAs"
100+
#define DB_SILENTARGS L"SilentParameters"
98101

99102
#define DB_GENINSTSECTION L"Generate"
100103
#define GENERATE_ARPSUBKEY L"RApps" // Our uninstall data is stored here
@@ -134,7 +137,9 @@ class CAppInfo
134137
virtual VOID
135138
GetDisplayInfo(CStringW &License, CStringW &Size, CStringW &UrlSite, CStringW &UrlDownload) = 0;
136139
virtual InstallerType
137-
GetInstallerType() const { return INSTALLER_UNKNOWN; }
140+
GetInstallerType(bool NestedType = false) const { return INSTALLER_UNKNOWN; }
141+
virtual InstallerType
142+
GetInstallerInfo(CStringW &SilentParameters) const { return GetInstallerType(); }
138143
virtual BOOL
139144
UninstallApplication(UninstallCommandFlags Flags) = 0;
140145
};
@@ -185,7 +190,9 @@ class CAvailableApplicationInfo : public CAppInfo
185190
virtual VOID
186191
GetDisplayInfo(CStringW &License, CStringW &Size, CStringW &UrlSite, CStringW &UrlDownload) override;
187192
virtual InstallerType
188-
GetInstallerType() const override;
193+
GetInstallerType(bool NestedType = false) const override;
194+
virtual InstallerType
195+
GetInstallerInfo(CStringW &SilentParameters) const override;
189196
virtual BOOL
190197
UninstallApplication(UninstallCommandFlags Flags) override;
191198
};
@@ -231,14 +238,14 @@ class CInstalledApplicationInfo : public CAppInfo
231238
virtual VOID
232239
GetDisplayInfo(CStringW &License, CStringW &Size, CStringW &UrlSite, CStringW &UrlDownload) override;
233240
virtual InstallerType
234-
GetInstallerType() const override;
241+
GetInstallerType(bool NestedType = false) const override;
235242
virtual BOOL
236243
UninstallApplication(UninstallCommandFlags Flags) override;
237244
};
238245

239246
BOOL
240247
UninstallGenerated(CInstalledApplicationInfo &AppInfo, UninstallCommandFlags Flags);
241248
BOOL
242-
ExtractAndRunGeneratedInstaller(const CAvailableApplicationInfo &AppInfo, LPCWSTR Archive);
249+
ExtractAndRunGeneratedInstaller(const CAvailableApplicationInfo &AppInfo, LPCWSTR Archive, bool Silent);
243250
HRESULT
244251
ExtractArchiveForExecution(PCWSTR pszArchive, const CStringW &PackageName, CStringW &TempDir, CStringW &App);

base/applications/rapps/include/dialogs.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ VOID
99
CreateSettingsDlg(HWND hwnd);
1010

1111
// Download dialogs
12+
enum DOWNLOADAPPFLAGS {
13+
DAF_SILENT = 0x01,
14+
DAF_MODAL = 0x02,
15+
};
1216
VOID
1317
DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial);
1418
BOOL
1519
DownloadApplication(CAppInfo *pAppInfo);
1620
BOOL
17-
DownloadListOfApplications(const CAtlList<CAppInfo *> &AppsList, BOOL bIsModal);
21+
DownloadListOfApplications(const CAtlList<CAppInfo *> &AppsList, UINT Flags = 0);

base/applications/rapps/include/misc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <atlstr.h>
4+
#include "appinfo.h"
45

56
#ifdef _M_IX86
67
#define CurrentArchitecture L"x86"
@@ -159,3 +160,9 @@ struct CScopedMutex
159160

160161
bool Acquired() const { return m_hMutex != NULL; }
161162
};
163+
164+
InstallerType
165+
GuessInstallerType(LPCWSTR Installer, UINT &ExtraInfo);
166+
167+
BOOL
168+
GetSilentInstallParameters(InstallerType InstallerType, UINT ExtraInfo, LPCWSTR Installer, CStringW &Parameters);

base/applications/rapps/include/unattended.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
const WCHAR UsageString[] = L"RAPPS \
1515
[/" CMD_KEY_HELP L"] \
16-
[/" CMD_KEY_INSTALL L" packagename] \
16+
[/" CMD_KEY_INSTALL L" [/S] packagename] \
1717
[/" CMD_KEY_UNINSTALL L" packagename|displayname] \
18-
[/" CMD_KEY_SETUP L" filename] \
18+
[/" CMD_KEY_SETUP L" [/S] filename] \
1919
[/" CMD_KEY_FIND L" string] \
2020
[/" CMD_KEY_INFO L" packagename]";
2121

base/applications/rapps/lang/bg-BG.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ BEGIN
8484
END
8585

8686
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 220
87-
STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE
87+
STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION
8888
CAPTION "Сваляне %ls…"
8989
FONT 8, "MS Shell Dlg"
9090
BEGIN

base/applications/rapps/lang/cs-CZ.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ BEGIN
8585
END
8686

8787
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 220
88-
STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE
88+
STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION
8989
CAPTION "Stahování %ls…"
9090
FONT 8, "MS Shell Dlg"
9191
BEGIN

base/applications/rapps/lang/de-DE.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ BEGIN
8787
END
8888

8989
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 220
90-
STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE
90+
STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION
9191
CAPTION "Download von %ls…"
9292
FONT 8, "MS Shell Dlg"
9393
BEGIN

0 commit comments

Comments
 (0)