mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[Setup] Use WiX bootstrapper instead of a custom one (#15050)
@dhowett gave approval on teams. Squash merging
This commit is contained in:
@@ -148,22 +148,12 @@ bool InstallNewVersionStage2(std::wstring installer_path, std::wstring_view inst
|
||||
}
|
||||
else
|
||||
{
|
||||
// If it's not .msi, then it's our .exe installer
|
||||
// If it's not .msi, then it's a wix bootstrapper
|
||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE };
|
||||
sei.lpFile = installer_path.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
std::wstring parameters = L"--no_full_ui";
|
||||
if (launch_powertoys)
|
||||
{
|
||||
// .exe installer launches the main app by default
|
||||
launch_powertoys = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameters += L"--no_start_pt";
|
||||
}
|
||||
|
||||
std::wstring parameters = L"/passive";
|
||||
sei.lpParameters = parameters.c_str();
|
||||
|
||||
success = ShellExecuteExW(&sei) == TRUE;
|
||||
|
||||
@@ -106,13 +106,14 @@ inline registry::ChangeSet getGcodeThumbnailHandlerChangeSet(const std::wstring
|
||||
L".gcode");
|
||||
}
|
||||
|
||||
inline std::vector<registry::ChangeSet> getAllModulesChangeSets(const std::wstring installationDir, const bool perUser)
|
||||
inline std::vector<registry::ChangeSet> getAllModulesChangeSets(const std::wstring installationDir)
|
||||
{
|
||||
return { getSvgPreviewHandlerChangeSet(installationDir, perUser),
|
||||
getMdPreviewHandlerChangeSet(installationDir, perUser),
|
||||
getPdfPreviewHandlerChangeSet(installationDir, perUser),
|
||||
getGcodePreviewHandlerChangeSet(installationDir, perUser),
|
||||
getSvgThumbnailHandlerChangeSet(installationDir, perUser),
|
||||
getPdfThumbnailHandlerChangeSet(installationDir, perUser),
|
||||
getGcodeThumbnailHandlerChangeSet(installationDir, perUser) };
|
||||
constexpr bool PER_USER = true;
|
||||
return { getSvgPreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getMdPreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getPdfPreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getGcodePreviewHandlerChangeSet(installationDir, PER_USER),
|
||||
getSvgThumbnailHandlerChangeSet(installationDir, PER_USER),
|
||||
getPdfThumbnailHandlerChangeSet(installationDir, PER_USER),
|
||||
getGcodeThumbnailHandlerChangeSet(installationDir, PER_USER) };
|
||||
}
|
||||
@@ -25,7 +25,7 @@ PowerPreviewModule::PowerPreviewModule() :
|
||||
Logger::init(LogSettings::fileExplorerLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
|
||||
|
||||
Logger::info("Initializing PowerPreviewModule");
|
||||
const bool installPerUser = false;
|
||||
const bool installPerUser = true;
|
||||
m_fileExplorerModules.push_back({ .settingName = L"svg-previewer-toggle-setting",
|
||||
.settingDescription = GET_RESOURCE_STRING(IDS_PREVPANE_SVG_SETTINGS_DESCRIPTION),
|
||||
.registryChanges = getSvgPreviewHandlerChangeSet(installationDir, installPerUser) });
|
||||
@@ -49,7 +49,7 @@ PowerPreviewModule::PowerPreviewModule() :
|
||||
m_fileExplorerModules.push_back({ .settingName = L"pdf-thumbnail-toggle-setting",
|
||||
.settingDescription = GET_RESOURCE_STRING(IDS_PDF_THUMBNAIL_PROVIDER_SETTINGS_DESCRIPTION),
|
||||
.registryChanges = getPdfThumbnailHandlerChangeSet(installationDir, installPerUser) });
|
||||
|
||||
|
||||
m_fileExplorerModules.push_back({ .settingName = L"gcode-thumbnail-toggle-setting",
|
||||
.settingDescription = GET_RESOURCE_STRING(IDS_GCODE_THUMBNAIL_PROVIDER_SETTINGS_DESCRIPTION),
|
||||
.registryChanges = getGcodeThumbnailHandlerChangeSet(installationDir, installPerUser) });
|
||||
@@ -144,21 +144,13 @@ void PowerPreviewModule::enable()
|
||||
// Disable active preview handlers.
|
||||
void PowerPreviewModule::disable()
|
||||
{
|
||||
// Check if the process is elevated in order to have permissions to modify HKLM registry
|
||||
if (is_process_elevated(false))
|
||||
for (auto& fileExplorerModule : m_fileExplorerModules)
|
||||
{
|
||||
for (auto& fileExplorerModule : m_fileExplorerModules)
|
||||
if (!fileExplorerModule.registryChanges.unApply())
|
||||
{
|
||||
if (!fileExplorerModule.registryChanges.unApply())
|
||||
{
|
||||
Logger::error(L"Couldn't disable file explorer module {} during module disable() call", fileExplorerModule.settingName);
|
||||
}
|
||||
Logger::error(L"Couldn't disable file explorer module {} during module disable() call", fileExplorerModule.settingName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
show_update_warning_message();
|
||||
}
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
@@ -197,9 +189,7 @@ void PowerPreviewModule::show_update_warning_message()
|
||||
|
||||
void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues& settings)
|
||||
{
|
||||
const bool isElevated = is_process_elevated(false);
|
||||
bool notifyShell = false;
|
||||
bool updatesNeeded = false;
|
||||
|
||||
for (auto& fileExplorerModule : m_fileExplorerModules)
|
||||
{
|
||||
@@ -210,11 +200,6 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues&
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mark that updates were to the registry were needed
|
||||
updatesNeeded = true;
|
||||
}
|
||||
|
||||
// (Un)Apply registry changes depending on the new setting value
|
||||
const bool updated = *toggle ? fileExplorerModule.registryChanges.apply() : fileExplorerModule.registryChanges.unApply();
|
||||
@@ -230,10 +215,6 @@ void PowerPreviewModule::apply_settings(const PowerToysSettings::PowerToyValues&
|
||||
Trace::PowerPreviewSettingsUpdateFailed(fileExplorerModule.settingName.c_str(), !*toggle, *toggle, true);
|
||||
}
|
||||
}
|
||||
if (!isElevated && updatesNeeded)
|
||||
{
|
||||
show_update_warning_message();
|
||||
}
|
||||
if (notifyShell)
|
||||
{
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
|
||||
|
||||
@@ -1006,9 +1006,6 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
||||
<data name="FileExplorerPreview_RunAsAdminRequired.Title" xml:space="preserve">
|
||||
<value>You need to run as administrator to modify these settings.</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_AffectsAllUsers.Title" xml:space="preserve">
|
||||
<value>The settings on this page affect all users on the system</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_RebootRequired.Title" xml:space="preserve">
|
||||
<value>A reboot may be required for changes to these settings to take effect</value>
|
||||
</data>
|
||||
|
||||
@@ -20,25 +20,10 @@
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<muxc:InfoBar Severity="Warning"
|
||||
x:Uid="FileExplorerPreview_RunAsAdminRequired"
|
||||
IsOpen="True"
|
||||
IsTabStop="True"
|
||||
IsClosable="False"
|
||||
Visibility="{Binding Mode=OneWay, Path=IsElevated, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
|
||||
<muxc:InfoBar Severity="Informational"
|
||||
x:Uid="FileExplorerPreview_AffectsAllUsers"
|
||||
IsOpen="True"
|
||||
IsTabStop="True"
|
||||
IsClosable="False"
|
||||
/>
|
||||
|
||||
<controls:SettingsGroup x:Uid="FileExplorerPreview_PreviewPane">
|
||||
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_Preview_SVG" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SVGRenderIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"
|
||||
x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
@@ -46,7 +31,6 @@
|
||||
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_Preview_MD" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.MDRenderIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"
|
||||
x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
@@ -54,7 +38,6 @@
|
||||
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_Preview_PDF" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.PDFRenderIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"
|
||||
x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
@@ -62,7 +45,6 @@
|
||||
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_Preview_GCODE" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.GCODERenderIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"
|
||||
x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
@@ -78,7 +60,6 @@
|
||||
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_SVG_Thumbnail" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SVGThumbnailIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"
|
||||
x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
@@ -86,7 +67,6 @@
|
||||
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_PDF_Thumbnail" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.PDFThumbnailIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"
|
||||
x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
@@ -94,7 +74,6 @@
|
||||
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_GCODE_Thumbnail" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.GCODEThumbnailIsEnabled}"
|
||||
IsEnabled="{Binding Mode=OneWay, Path=IsElevated}"
|
||||
x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
@@ -107,4 +86,4 @@
|
||||
<controls:PageLink x:Uid="LearnMore_PowerPreview" Link="https://aka.ms/PowerToysOverview_FileExplorerAddOns"/>
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
</Page>
|
||||
|
||||
Reference in New Issue
Block a user