Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't open exclusive handles when reading shortcuts #37635

Closed
wants to merge 1 commit into from

Conversation

OneBlue
Copy link

@OneBlue OneBlue commented Feb 25, 2025

This updates the ShellLinkHelper logic to pass the STGM_SHARE_DENY_NONE when reading desktop shortcuts to make sure that powertoys doesn't interfere with other programs.

See: microsoft/WSL#11276 (comment)

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@htcfreek
Copy link
Collaborator

cc @zadjii-msft

@crutkas
Copy link
Member

crutkas commented Feb 26, 2025

We should be sure this fix is in cmdpal

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/modules/launcher/Wox.Infrastructure/ShellLinkHelper.cs:141

  • [nitpick] Consider centralizing the STGM_* constants into a shared utility or header if they are used elsewhere, which would improve maintainability and clarity.
const int STGM_SHARE_DENY_NONE = 0x00000040;

src/modules/launcher/Wox.Infrastructure/ShellLinkHelper.cs:145

  • Ensure that unit tests are updated or added to cover scenarios where the shortcut file is accessed concurrently so that the change in sharing mode does not introduce regressions.
((IPersistFile)link).Load(path, STGM_READ | STGM_SHARE_DENY_NONE);
@yeelam-gordon yeelam-gordon requested a review from moooyo February 26, 2025 02:30
Copy link
Contributor

@yeelam-gordon yeelam-gordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yu will help on try out the fix

@moooyo
Copy link
Contributor

moooyo commented Feb 26, 2025

I'm not sure, but seems I can still repo this issues with your fix.
image

Repo steps:

  1. follow up this repo to get three msi for testing. https://github.com/avjts/powerlauncher-bug
  2. Install the specific powertoys version (with this fix)
  3. Install the first msi.
  4. Disable and re-enable PowerToys Run
  5. Install the second and third msi.

@OneBlue
Copy link
Author

OneBlue commented Feb 26, 2025

Thank you for trying this out @moooyo. I couldn't build an installer locally so I was planning to use the CI to get it and validate the change. If that doesn't solve it, it might mean that the exclusive handle is coming from another place. Does powertoys open desktop shortcuts from somewhere else ?

@htcfreek
Copy link
Collaborator

Does powertoys open desktop shortcuts from somewhere else ?

Did you check the program plugin? It scans the desktop shortcuts.

@jaimecbernardo
Copy link
Collaborator

@OneBlue , please check #37654 . That fix seems to be working for us. Can you please verify?

@jaimecbernardo
Copy link
Collaborator

Closing in favor of #37654

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants