Compare commits

...

2 Commits

Author SHA1 Message Date
Mike Griese
0d73747572 there's no way that just works, right? 2025-11-16 20:56:00 -06:00
Kai Tao
34c37f2d38 Add not signed dll (#43631)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

This dll is not signed, will fail the pipeline

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-11-17 09:48:32 +08:00
3 changed files with 33 additions and 0 deletions

View File

@@ -291,6 +291,7 @@
"Mono.Cecil.Rocks.dll",
"Newtonsoft.Json.dll",
"CommunityToolkit.WinUI.Controls.TitleBar.dll",
"CommunityToolkit.WinUI.Controls.OpacityMaskView.dll",
"NLog.dll",
"HtmlAgilityPack.dll",

View File

@@ -58,6 +58,7 @@
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

View File

@@ -14,6 +14,7 @@
#include <common/utils/winapi_error.h>
#include <common/interop/shared_constants.h>
#include <Psapi.h>
#include <Shlwapi.h>
#include <TlHelp32.h>
#include <thread>
@@ -49,6 +50,29 @@ private:
// Track if this is the first call to enable
bool firstEnableCall = true;
static bool IsUriProtocolRegistered(const std::wstring& protocol)
{
WCHAR executable[MAX_PATH] = { 0 };
DWORD buffer_length = MAX_PATH;
// Query if there's an executable associated with this URI protocol
HRESULT hr = AssocQueryString(ASSOCF_INIT_IGNOREUNKNOWN,
ASSOCSTR_EXECUTABLE,
protocol.c_str(),
nullptr,
executable,
&buffer_length);
if (SUCCEEDED(hr) && buffer_length > 0)
{
Logger::trace(L"URI protocol '{}' is registered with executable: {}", protocol, executable);
return true;
}
Logger::trace(L"URI protocol '{}' is not registered. HRESULT: 0x{:X}", protocol, static_cast<unsigned long>(hr));
return false;
}
static bool LaunchApp(const std::wstring& appPath, const std::wstring& commandLineArgs, bool elevated, bool silentFail)
{
std::wstring dir = std::filesystem::path(appPath).parent_path();
@@ -269,6 +293,13 @@ public:
return;
}
// Check if x-cmdpal URI protocol handler is registered
if (!IsUriProtocolRegistered(L"x-cmdpal"))
{
Logger::error("x-cmdpal URI protocol handler is not registered. Cannot launch CmdPal.");
return;
}
if (!firstEnableCall)
{
Logger::trace("Not first attempt, try to launch");