-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use Handle2 to get locking information
- Reduce amount of 3rd party dependencies - Simplify the code
- Loading branch information
1 parent
6018097
commit d025379
Showing
67 changed files
with
938 additions
and
1,095 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/Build | ||
.vs/ | ||
/Build/ | ||
/.vs/ | ||
/.idea/ | ||
launchSettings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
# ShowWhatProcessLocksFile | ||
An utility to discover what processes lock a specific file or folder.<br> | ||
A utility to discover what processes lock a specific file or folder. | ||
|
||
# Screenshots | ||
## Context menu | ||
![Screenshot](doc/ContextMenu.png) | ||
## The application | ||
![Screenshot](doc/Screenshot.png) | ||
<img src="doc/ContextMenu.png" width="70%" height="70%"/> | ||
|
||
## Application | ||
<img src="doc/Screenshot.png" width="70%" height="70%"/> | ||
|
||
# System requirements | ||
* .Net Framework 4.6.1 or higher (Windows 10 already has it) | ||
* Windows 10 or higher (it can also work on Windows 8 if you install [.Net Framework 4.6.2](https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net462-web-installer)) | ||
* The user should be allowed to run applications as an Administrator. | ||
|
||
# How it works | ||
The application uses [Handle by Mark Russinovich](https://docs.microsoft.com/en-us/sysinternals/downloads/handle) to get information about locking processes. The output of `handle.exe` is parsed and displayed in the GUI.<br> | ||
The application uses [Handle2](https://github.com/PolarGoose/Handle2) to get information about locking processes. | ||
|
||
# How to use | ||
* Download `ShowWhatProcessLocksFile.msi.zip` from the latest [release](https://github.com/PolarGoose/ShowWhatProcessLocksFile/releases). | ||
* Run the installer. The installer will install this programm to the `%AppData%\ShowWhatProcessLocksFile` folder and add a "Show what locks this file" Windows File Explorer context menu element. | ||
* Use "Show what locks this file" File Explorer's context menu to select a file or folder | ||
* To terminate selected processes, open a context menu by clicking mouse right button | ||
* Run the installer. The installer will install this programm to the `%AppData%\ShowWhatProcessLocksFile` folder and add a `Show what locks this file` Windows File Explorer context menu element. | ||
* Use `Show what locks this file` File Explorer's context menu to select a file or folder | ||
* To terminate a process, select it and open a context menu by clicking right mouse button | ||
* If you want to uninstall the program, use `Control Panel\Programs\Programs and Features`, uninstaller will remove an integration with the context menu and all files which were installed. | ||
|
||
# How to build | ||
* Use `Visual Studio 2019` with [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension) and [Wix Toolset](https://wixtoolset.org/releases/). | ||
* Run `.github\workflows\build.ps1` to build a release (`git.exe` should be in your PATH) | ||
|
||
# References | ||
* This tool is inspired by [LockHunter](https://lockhunter.com/) | ||
* Article about API used by `Handle.exe` with code samples: [Examine Information on Windows NT System Level Primitives](https://www.codeguru.com/cpp/w-p/system/processesmodules/article.php/c2827/Examine-Information-on-Windows-NT-System-Level-Primitives.htm) | ||
* To work with the codebase, use `Visual Studio 2022` with a plugin [HeatWave for VS2022](https://marketplace.visualstudio.com/items?itemName=FireGiant.FireGiantHeatWaveDev17). | ||
* To build a release, run `.github\workflows\build.ps1` (`git.exe` should be in your PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
<Application x:Class="ShowWhatProcessLocksFile.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="clr-namespace:ShowWhatProcessLocksFile.Gui.Controls" | ||
StartupUri="Gui/MainWindow.xaml"> | ||
<Application.Resources> | ||
<Style x:Key="ButtonStyle" TargetType="ButtonBase"> | ||
<Style.Setters> | ||
<Setter Property="Background" Value="White"/> | ||
</Style.Setters> | ||
</Style> | ||
<Style TargetType="Button" BasedOn="{StaticResource ButtonStyle}"/> | ||
<Style TargetType="ToggleButton" BasedOn="{StaticResource ButtonStyle}"/> | ||
<Style TargetType="controls:IconButton" BasedOn="{StaticResource ButtonStyle}"/> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="/Gui/Icons.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
<Style x:Key="ButtonStyle" TargetType="ButtonBase"> | ||
<Style.Setters> | ||
<Setter Property="Background" Value="White" /> | ||
</Style.Setters> | ||
</Style> | ||
<Style TargetType="Button" BasedOn="{StaticResource ButtonStyle}" /> | ||
<Style TargetType="ToggleButton" BasedOn="{StaticResource ButtonStyle}" /> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
using System.Windows; | ||
|
||
namespace ShowWhatProcessLocksFile | ||
namespace ShowWhatProcessLocksFile; | ||
|
||
public partial class App : Application | ||
{ | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
using System.Windows.Controls.Primitives; | ||
|
||
namespace ShowWhatProcessLocksFile.Gui.Controls | ||
namespace ShowWhatProcessLocksFile.Gui.Controls; | ||
|
||
public partial class ExpandToggleButton : ToggleButton | ||
{ | ||
public partial class ExpandToggleButton : ToggleButton | ||
public ExpandToggleButton() | ||
{ | ||
public ExpandToggleButton() | ||
{ | ||
InitializeComponent(); | ||
} | ||
InitializeComponent(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace ShowWhatProcessLocksFile.Gui.Controls | ||
namespace ShowWhatProcessLocksFile.Gui.Controls; | ||
|
||
public partial class ProcessInfoListView : UserControl | ||
{ | ||
public partial class ProcessInfoListView : UserControl | ||
public ProcessInfoListView() | ||
{ | ||
public ProcessInfoListView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,43 @@ | ||
using ShowWhatProcessLocksFile.Gui.Utils; | ||
using ShowWhatProcessLocksFile.LockFinding; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using ShowWhatProcessLocksFile.Gui.Utils; | ||
using ShowWhatProcessLocksFile.LockFinding; | ||
|
||
namespace ShowWhatProcessLocksFile.Gui.Controls; | ||
|
||
namespace ShowWhatProcessLocksFile.Gui.Controls | ||
internal class ProcessInfoListViewModel : ViewModelBase | ||
{ | ||
internal class ProcessInfoListViewModel : ViewModelBase | ||
public IEnumerable<ProcessInfoViewModel> ProcessInfoViewModels { get; } | ||
public RelayCommand ExpandAllCommand { get; } | ||
public RelayCommand CollapseAllCommand { get; } | ||
public RelayCommand<IEnumerable> KillSelected { get; } | ||
|
||
public ProcessInfoListViewModel(IEnumerable<ProcessInfo> processesInfoViewModels, | ||
Action<IEnumerable<ProcessInfo>> killProcessesRequested) | ||
{ | ||
public IEnumerable<ProcessInfoViewModel> ProcessInfoViewModels { get; } | ||
public RelayCommand ExpandAllCommand { get; } | ||
public RelayCommand CollapseAllCommand { get; } | ||
public RelayCommand KillAll { get; } | ||
public RelayCommand<System.Collections.IEnumerable> KillSelected { get; } | ||
ProcessInfoViewModels = processesInfoViewModels.Select(p => new ProcessInfoViewModel(p)).ToList(); | ||
|
||
public ProcessInfoListViewModel(IEnumerable<ProcessInfo> processesInfoViewModels, Action<IEnumerable<ProcessInfo>> killProcessesRequested) | ||
ExpandAllCommand = new RelayCommand(() => | ||
{ | ||
ProcessInfoViewModels = processesInfoViewModels.Select(p => new ProcessInfoViewModel(p)).ToList(); | ||
|
||
ExpandAllCommand = new RelayCommand(() => | ||
{ | ||
foreach (var p in ProcessInfoViewModels) | ||
{ | ||
p.IsExpanded = true; | ||
} | ||
}); | ||
|
||
CollapseAllCommand = new RelayCommand(() => | ||
foreach (var p in ProcessInfoViewModels) | ||
{ | ||
foreach (var p in ProcessInfoViewModels) | ||
{ | ||
p.IsExpanded = false; | ||
} | ||
}); | ||
p.IsExpanded = true; | ||
} | ||
}); | ||
|
||
KillAll = new RelayCommand(() => | ||
CollapseAllCommand = new RelayCommand(() => | ||
{ | ||
foreach (var p in ProcessInfoViewModels) | ||
{ | ||
killProcessesRequested(ProcessInfoViewModels.Select(p => p.Process)); | ||
}); | ||
p.IsExpanded = false; | ||
} | ||
}); | ||
|
||
KillSelected = new RelayCommand<System.Collections.IEnumerable>(processes => | ||
{ | ||
killProcessesRequested(processes.OfType<ProcessInfoViewModel>().Select(p => p.Process)); | ||
}); | ||
} | ||
KillSelected = new RelayCommand<IEnumerable>(processes => | ||
{ | ||
killProcessesRequested(processes.OfType<ProcessInfoViewModel>().Select(p => p.Process)); | ||
}); | ||
} | ||
} |
Oops, something went wrong.