mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Setup] Always elevate bootstrapper to avoid multiple UAC prompts on upgrade
This commit is contained in:
committed by
Andrey Nekrasov
parent
092ee49139
commit
59108365f1
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
inline registry::Changeset getSvgPreviewHandlerChangset(const std::wstring installationDir, const bool perUser)
|
||||
inline registry::ChangeSet getSvgPreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
return generatePreviewHandler(PreviewHandlerType::preview,
|
||||
@@ -22,7 +22,7 @@ inline registry::Changeset getSvgPreviewHandlerChangset(const std::wstring insta
|
||||
L".svg");
|
||||
}
|
||||
|
||||
inline registry::Changeset getMdPreviewHandlerChangset(const std::wstring installationDir, const bool perUser)
|
||||
inline registry::ChangeSet getMdPreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
return generatePreviewHandler(PreviewHandlerType::preview,
|
||||
@@ -36,7 +36,7 @@ inline registry::Changeset getMdPreviewHandlerChangset(const std::wstring instal
|
||||
L".md");
|
||||
}
|
||||
|
||||
inline registry::Changeset getPdfPreviewHandlerChangset(const std::wstring installationDir, const bool perUser)
|
||||
inline registry::ChangeSet getPdfPreviewHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
return generatePreviewHandler(PreviewHandlerType::preview,
|
||||
@@ -50,7 +50,7 @@ inline registry::Changeset getPdfPreviewHandlerChangset(const std::wstring insta
|
||||
L".pdf");
|
||||
}
|
||||
|
||||
inline registry::Changeset getSvgThumbnailHandlerChangset(const std::wstring installationDir, const bool perUser)
|
||||
inline registry::ChangeSet getSvgThumbnailHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
return generatePreviewHandler(PreviewHandlerType::thumbnail,
|
||||
@@ -64,7 +64,7 @@ inline registry::Changeset getSvgThumbnailHandlerChangset(const std::wstring ins
|
||||
L".svg");
|
||||
}
|
||||
|
||||
inline registry::Changeset getPdfThumbnailHandlerChangset(const std::wstring installationDir, const bool perUser)
|
||||
inline registry::ChangeSet getPdfThumbnailHandlerChangeSet(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
using namespace registry::shellex;
|
||||
return generatePreviewHandler(PreviewHandlerType::thumbnail,
|
||||
@@ -78,11 +78,11 @@ inline registry::Changeset getPdfThumbnailHandlerChangset(const std::wstring ins
|
||||
L".pdf");
|
||||
}
|
||||
|
||||
inline std::vector<registry::Changeset> getAllModulesChangesets(const std::wstring installationDir, const bool perUser)
|
||||
inline std::vector<registry::ChangeSet> getAllModulesChangeSets(const std::wstring installationDir, const bool perUser)
|
||||
{
|
||||
return { getSvgPreviewHandlerChangset(installationDir, perUser),
|
||||
getMdPreviewHandlerChangset(installationDir, perUser),
|
||||
getPdfPreviewHandlerChangset(installationDir, perUser),
|
||||
getSvgThumbnailHandlerChangset(installationDir, perUser),
|
||||
getPdfThumbnailHandlerChangset(installationDir, perUser) };
|
||||
return { getSvgPreviewHandlerChangeSet(installationDir, perUser),
|
||||
getMdPreviewHandlerChangeSet(installationDir, perUser),
|
||||
getPdfPreviewHandlerChangeSet(installationDir, perUser),
|
||||
getSvgThumbnailHandlerChangeSet(installationDir, perUser),
|
||||
getPdfThumbnailHandlerChangeSet(installationDir, perUser) };
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace registry
|
||||
valueSize) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool unapply() const
|
||||
bool unApply() const
|
||||
{
|
||||
HKEY key{};
|
||||
if (RegOpenKeyExW(scope, path.c_str(), 0, KEY_ALL_ACCESS, &key) != ERROR_SUCCESS)
|
||||
@@ -207,7 +207,7 @@ namespace registry
|
||||
}
|
||||
};
|
||||
|
||||
struct Changeset
|
||||
struct ChangeSet
|
||||
{
|
||||
std::vector<ValueChange> changes;
|
||||
|
||||
@@ -233,12 +233,12 @@ namespace registry
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool unapply() const
|
||||
bool unApply() const
|
||||
{
|
||||
bool ok = true;
|
||||
for (const auto& c : changes)
|
||||
{
|
||||
ok = c.unapply() && ok;
|
||||
ok = c.unApply() && ok;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ namespace registry
|
||||
thumbnail
|
||||
};
|
||||
|
||||
inline registry::Changeset generatePreviewHandler(const PreviewHandlerType handlerType,
|
||||
inline registry::ChangeSet generatePreviewHandler(const PreviewHandlerType handlerType,
|
||||
const bool perUser,
|
||||
std::wstring handlerClsid,
|
||||
std::wstring powertoysVersion,
|
||||
@@ -323,7 +323,7 @@ namespace registry
|
||||
changes.push_back({ scope, previewHandlerListPath, handlerClsid, displayName });
|
||||
}
|
||||
|
||||
return registry::Changeset{ .changes = std::move(changes) };
|
||||
return registry::ChangeSet{ .changes = std::move(changes) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user