diff --git a/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest b/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest
index 59e6667daf7..f168dcbc11a 100644
--- a/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest
+++ b/src/cascadia/CascadiaPackage/Package-Dev.appxmanifest
@@ -136,5 +136,6 @@
+
diff --git a/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest b/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest
index 03d484c67d1..5ad64fd6a48 100644
--- a/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest
+++ b/src/cascadia/CascadiaPackage/Package-Pre.appxmanifest
@@ -225,6 +225,7 @@
+
diff --git a/src/cascadia/CascadiaPackage/Package.appxmanifest b/src/cascadia/CascadiaPackage/Package.appxmanifest
index 742e74c9d22..94a4600e74b 100644
--- a/src/cascadia/CascadiaPackage/Package.appxmanifest
+++ b/src/cascadia/CascadiaPackage/Package.appxmanifest
@@ -225,6 +225,7 @@
+
diff --git a/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp b/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp
index 0ce17eb725d..7ab0a0b15dc 100644
--- a/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp
+++ b/src/cascadia/TerminalSettingsModel/DefaultTerminal.cpp
@@ -99,7 +99,7 @@ bool DefaultTerminal::HasCurrent()
void DefaultTerminal::Current(const Model::DefaultTerminal& term)
{
- THROW_IF_FAILED(DelegationConfig::s_SetDefaultByPackage(winrt::get_self(term)->_pkg, true));
+ THROW_IF_FAILED(DelegationConfig::s_SetDefaultByPackage(winrt::get_self(term)->_pkg));
TraceLoggingWrite(g_hSettingsModelProvider,
"DefaultTerminalChanged",
diff --git a/src/propslib/DelegationConfig.cpp b/src/propslib/DelegationConfig.cpp
index fe4bbfa15d9..263d090b3a9 100644
--- a/src/propslib/DelegationConfig.cpp
+++ b/src/propslib/DelegationConfig.cpp
@@ -213,20 +213,20 @@ try
}
CATCH_RETURN()
-[[nodiscard]] HRESULT DelegationConfig::s_SetDefaultConsoleById(const IID& iid, const bool useRegExe) noexcept
+[[nodiscard]] HRESULT DelegationConfig::s_SetDefaultConsoleById(const IID& iid) noexcept
{
- return s_Set(DELEGATION_CONSOLE_KEY_NAME, iid, useRegExe);
+ return s_Set(DELEGATION_CONSOLE_KEY_NAME, iid);
}
-[[nodiscard]] HRESULT DelegationConfig::s_SetDefaultTerminalById(const IID& iid, const bool useRegExe) noexcept
+[[nodiscard]] HRESULT DelegationConfig::s_SetDefaultTerminalById(const IID& iid) noexcept
{
- return s_Set(DELEGATION_TERMINAL_KEY_NAME, iid, useRegExe);
+ return s_Set(DELEGATION_TERMINAL_KEY_NAME, iid);
}
-[[nodiscard]] HRESULT DelegationConfig::s_SetDefaultByPackage(const DelegationPackage& package, const bool useRegExe) noexcept
+[[nodiscard]] HRESULT DelegationConfig::s_SetDefaultByPackage(const DelegationPackage& package) noexcept
{
- RETURN_IF_FAILED(s_SetDefaultConsoleById(package.pair.console, useRegExe));
- RETURN_IF_FAILED(s_SetDefaultTerminalById(package.pair.terminal, useRegExe));
+ RETURN_IF_FAILED(s_SetDefaultConsoleById(package.pair.console));
+ RETURN_IF_FAILED(s_SetDefaultTerminalById(package.pair.terminal));
return S_OK;
}
@@ -285,64 +285,23 @@ CATCH_RETURN()
return { DelegationPairKind::Custom, values[0], values[1] };
}
-[[nodiscard]] HRESULT DelegationConfig::s_Set(PCWSTR value, const CLSID clsid, const bool useRegExe) noexcept
+[[nodiscard]] HRESULT DelegationConfig::s_Set(PCWSTR value, const CLSID clsid) noexcept
try
{
- // BODGY
- // A Centennial application is not allowed to write the system registry and is redirected
- // to a per-package copy-on-write hive.
- // The restricted capability "unvirtualizedResources" can be combined with
- // desktop6:RegistryWriteVirtualization to opt-out... but...
- // - It will no longer be possible to double-click install through the App Installer
- // - It requires a special exception to submit to the store
- // - There MAY be some cleanup logic where the app catalog may try to undo
- // whatever the package did.
- // This works around it by shelling out to reg.exe because somehow that's just peachy.
- if (useRegExe)
- {
- wil::unique_cotaskmem_string str;
- RETURN_IF_FAILED(StringFromCLSID(clsid, &str));
-
- auto regExePath = wil::ExpandEnvironmentStringsW(L"%WINDIR%\\System32\\reg.exe");
-
- auto command = wil::str_printf(L"%s ADD HKCU\\Console\\%%%%Startup /v %s /t REG_SZ /d %s /f", regExePath.c_str(), value, str.get());
-
- wil::unique_process_information pi;
- STARTUPINFOEX siEx{ 0 };
- siEx.StartupInfo.cb = sizeof(siEx);
-
- RETURN_IF_WIN32_BOOL_FALSE(CreateProcessW(
- nullptr,
- command.data(),
- nullptr, // lpProcessAttributes
- nullptr, // lpThreadAttributes
- false, // bInheritHandles
- EXTENDED_STARTUPINFO_PRESENT | CREATE_UNICODE_ENVIRONMENT | CREATE_NO_WINDOW, // dwCreationFlags
- nullptr, // lpEnvironment
- nullptr,
- &siEx.StartupInfo, // lpStartupInfo
- &pi // lpProcessInformation
- ));
-
- return S_OK;
- }
- else
- {
- wil::unique_hkey currentUserKey;
- wil::unique_hkey consoleKey;
+ wil::unique_hkey currentUserKey;
+ wil::unique_hkey consoleKey;
- RETURN_IF_NTSTATUS_FAILED(RegistrySerialization::s_OpenConsoleKey(¤tUserKey, &consoleKey));
+ RETURN_IF_NTSTATUS_FAILED(RegistrySerialization::s_OpenConsoleKey(¤tUserKey, &consoleKey));
- // Create method for registry is a "create if not exists, otherwise open" function.
- wil::unique_hkey startupKey;
- RETURN_IF_NTSTATUS_FAILED(RegistrySerialization::s_CreateKey(consoleKey.get(), L"%%Startup", &startupKey));
+ // Create method for registry is a "create if not exists, otherwise open" function.
+ wil::unique_hkey startupKey;
+ RETURN_IF_NTSTATUS_FAILED(RegistrySerialization::s_CreateKey(consoleKey.get(), L"%%Startup", &startupKey));
- wil::unique_cotaskmem_string str;
- RETURN_IF_FAILED(StringFromCLSID(clsid, &str));
+ wil::unique_cotaskmem_string str;
+ RETURN_IF_FAILED(StringFromCLSID(clsid, &str));
- RETURN_IF_NTSTATUS_FAILED(RegistrySerialization::s_SetValue(startupKey.get(), value, REG_SZ, reinterpret_cast(str.get()), gsl::narrow(wcslen(str.get()) * sizeof(wchar_t))));
+ RETURN_IF_NTSTATUS_FAILED(RegistrySerialization::s_SetValue(startupKey.get(), value, REG_SZ, reinterpret_cast(str.get()), gsl::narrow(wcslen(str.get()) * sizeof(wchar_t))));
- return S_OK;
- }
+ return S_OK;
}
CATCH_RETURN()
diff --git a/src/propslib/DelegationConfig.hpp b/src/propslib/DelegationConfig.hpp
index 70e3d6cb505..a6a5917bfea 100644
--- a/src/propslib/DelegationConfig.hpp
+++ b/src/propslib/DelegationConfig.hpp
@@ -99,7 +99,7 @@ class DelegationConfig
[[nodiscard]] static HRESULT s_GetAvailablePackages(std::vector& packages, DelegationPackage& def) noexcept;
- [[nodiscard]] static HRESULT s_SetDefaultByPackage(const DelegationPackage& pkg, const bool useRegExe = false) noexcept;
+ [[nodiscard]] static HRESULT s_SetDefaultByPackage(const DelegationPackage& pkg) noexcept;
static constexpr CLSID CLSID_Default{};
static constexpr CLSID CLSID_Conhost{ 0xb23d10c0, 0xe52e, 0x411e, { 0x9d, 0x5b, 0xc0, 0x9f, 0xdf, 0x70, 0x9c, 0x7d } };
@@ -114,8 +114,8 @@ class DelegationConfig
[[nodiscard]] static DelegationPair s_GetDelegationPair() noexcept;
private:
- [[nodiscard]] static HRESULT s_SetDefaultConsoleById(const IID& iid, const bool useRegExe) noexcept;
- [[nodiscard]] static HRESULT s_SetDefaultTerminalById(const IID& iid, const bool useRegExe) noexcept;
+ [[nodiscard]] static HRESULT s_SetDefaultConsoleById(const IID& iid) noexcept;
+ [[nodiscard]] static HRESULT s_SetDefaultTerminalById(const IID& iid) noexcept;
- [[nodiscard]] static HRESULT s_Set(PCWSTR value, const CLSID clsid, const bool useRegExe) noexcept;
+ [[nodiscard]] static HRESULT s_Set(PCWSTR value, const CLSID clsid) noexcept;
};