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

[OLD BRANCH] [New PowerToy] File Locksmith #20863

Conversation

ivanstosic-janea
Copy link
Contributor

@ivanstosic-janea ivanstosic-janea commented Sep 26, 2022

Summary of the Pull Request

This PR adds a new PowerToy that can be used to check which processes are holding files open, thus preventing them from being deleted, for example. It does this by adding a context menu entry in the Windows Explorer, activated for all files and directories.

image

image

This PR is a draft, and most likely the UI needs some improvement.

Things that need to be done:

  • A few strings in the GUI should be localized. I think I did localize the strings in the context menu entry, but not sure if I did it correctly.
  • Consider adding some settings. I couldn't come up with anything.
  • Support Windows themes (Light/Dark)
  • Support GUI restarting itself as elevated. It's not possible to see handles held by elevated processes, so some results will be missing in that case, unless the GUI itself is elevated.

Development and testing

I modified the installer script to add registry entries, so this utility should work out of the box. If you plan to do development on it, there is a more convenient way to test it. Build the solution, run cmd and go to the directory with the output binaries, then run regsvr32 PowerToys.FileLocksmithExt.dll. This will call DllRegisterServer and that will add the necessary registry keys. If you want to remove these registry keys, run regsvr32 /u PowerToys.FileLocksmithExt.dll.

After opening the context menu in Windows Explorer, the dll will be loaded and Explorer will prevent you from overwriting it. In that case you can just kill explorer.exe and restart it. The dll will not be held until you open the context menu again, allowing you to recompile the dll.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@ivanstosic-janea
Copy link
Contributor Author

Now showing a list of files:
image

@htcfreek
Copy link
Collaborator

htcfreek commented Sep 27, 2022

Now showing a list of files:
image

Perfect.

As I said users should be able to search for files or we have a second tab that lists processes per file/folder.

@htcfreek
Copy link
Collaborator

htcfreek commented Sep 27, 2022

Two more ideas for the ui:

  • Show process icon like in task manager. (Can be in front of the process name.)
  • Show exe file description.

image

What does it show for universal apps? ApplicationFrameHost.exe?

@crutkas
Copy link
Member

crutkas commented Sep 27, 2022

@niels9001 / @cinnamon-msft I think this is a UX that should be pretty quick and easy to update.

I think

  1. "Show Files" is an expander.
  2. Use standard brushes / font sizes
  3. Kill -> Force Quit or End Task.
  4. How does a long paths look

@niels9001
Copy link
Contributor

@niels9001 / @cinnamon-msft I think this is a UX that should be pretty quick and easy to update.

I think

  1. "Show Files" is an expander.
  2. Use standard brushes / font sizes
  3. Kill -> Force Quit or End Task.
  4. How does a long paths look

@crutkas Rough mock-up.. are the number of blocked files something we want to show on the highest level or do we expect that to be secondary information (as shown below)?
TaskKiller

@crutkas
Copy link
Member

crutkas commented Sep 28, 2022

Love the adjustment.

  1. Expander needs to be moved away from the "end task" button :)
  2. Should we have an alternative view, pivot on what files are locked vs the exe doing the locking

@crutkas
Copy link
Member

crutkas commented Sep 28, 2022

Minus the location of the expander, i love this mock and would be happy to have it in a v1 FYI.

@htcfreek
Copy link
Collaborator

htcfreek commented Sep 28, 2022

@niels9001 , @crutkas

are the number of blocked files something we want to show on the highest level or do we expect that to be secondary information

I think secondary is good enough.

Should we have an alternative view, pivot on what files are locked vs the exe doing the locking

Definitely yes. Maybe you want to know it for a specific file in a folder and as @ivanstosic-janea mentioned you can open the utility with multiple files selected.

Alternatively we can allow searching/filtering the list by file like the search in PT Run's plugin manager.

@crutkas
Copy link
Member

crutkas commented Sep 28, 2022

my alt view comment is around when the scenario for actually running the utility. it is since a file is locked, not what exe are locking files. The pivot for information is "Here is the list of files that are locked by who", not "who has files locked and what they are are locking".

@htcfreek
Copy link
Collaborator

my alt view comment is around when the scenario for actually running the utility. it is since a file is locked, not what exe are locking files. The pivot for information is "Here is the list of files that are locked by who", not "who has files locked and what they are are locking".

You mean you want to know what files in a folder are locked and blocking the user from deleting the folder?

@Stanzilla
Copy link

LockHunter screenshot as comparison which is likely what this idea is based on:

image

@htcfreek
Copy link
Collaborator

htcfreek commented Sep 29, 2022

@crutkas Rough mock-up.. are the number of blocked files something we want to show on the highest level or do we expect that to be secondary information (as shown below)?
TaskKiller

@niels9001

  • For me it feels more clean if all the expanded information are in one area without the split lines. The are all belongs to the one process item. - The layout in your mock-up feels a bit space wasting.
  • I like the choosen wording "End task" because it is aligned with Task Manager.

@niels9001
Copy link
Contributor

@htcfreek @crutkas Great feedback - a more polished version:

FileLockSmith

Some UI tweaks, and making the files clickable so you can open its directory?

@crutkas The expander can be expanded clicking on the entire thing - and e.g. Settings use the same margin there so I'm assuming users won't miss click :)? For the list of blocking files I had this in mind:

image

@htcfreek
Copy link
Collaborator

@niels9001
Is there a branch I can clone for testing locally?

@Aaron-Junker
Copy link
Collaborator

@niels9001 what happens when you click on one of the file links in the expander?

@ivanstosic-janea
Copy link
Contributor Author

@niels9001
I'd also like to see a branch so I can integrate your ideas.

I can also give write access to my fork if anyone's interested.

@niels9001
Copy link
Contributor

@niels9001 Is there a branch I can clone for testing locally?

This was just mocked up in a sample project.

@niels9001 what happens when you click on one of the file links in the expander?

Idea was to open the folder containing the file - not sure if that's useful or not?

@niels9001 I'd also like to see a branch so I can integrate your ideas.

I can also give write access to my fork if anyone's interested.

I'm happy to pick up the XAML work for this one :).. could we have your fork as a feature branch on this repo like we do with the other features?

@ivanstosic-janea
Copy link
Contributor Author

Okay, I will create a feature branch

@ivanstosic-janea ivanstosic-janea changed the title [New PowerToy] File Locksmith [OLD BRANCH] [New PowerToy] File Locksmith Sep 29, 2022
@ivanstosic-janea
Copy link
Contributor Author

Closing in favor of #20930, since GitHub won't let me change the source branch.

Microsoft, please fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-New PowerToy Suggestion for a PowerToy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants