1
0
mirror of https://github.com/mastercodeon314/KsDumper-11.git synced 2024-11-30 17:24:32 +01:00

Fixed a bug that wouldn't allow the form to unload the driver on program exit.

This commit is contained in:
Mastercodeon 2023-01-24 19:24:48 -06:00
parent a165027b78
commit b7cc4a3dfc
5 changed files with 17 additions and 1 deletions

View File

@ -132,9 +132,16 @@ namespace KsDumper11.Driver
private readonly IntPtr driverHandle;
public void Dispose()
{
try
{
WinApi.CloseHandle(driverHandle);
}
catch (Exception ex)
{
return;
}
}
~DriverInterface()
{

View File

@ -105,6 +105,7 @@ namespace KsDumper11
this.InitializeComponent();
closeDriverOnExitBox.Checked = Properties.Settings.Default.closeDriverOnExitSettings;
this.FormClosing += Dumper_FormClosing;
this.Disposed += Dumper_Disposed;
this.appIcon1.DragForm = this;
base.FormBorderStyle = FormBorderStyle.None;
base.Region = Region.FromHrgn(Utils.CreateRoundRectRgn(0, 0, base.Width, base.Height, 10, 10));
@ -123,6 +124,14 @@ namespace KsDumper11
this.LoadProcessList();
}
private void Dumper_Disposed(object sender, EventArgs e)
{
if (Properties.Settings.Default.closeDriverOnExitSettings)
{
driver.UnloadDriver();
}
}
private void closeDriverOnExitBox_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.closeDriverOnExitSettings = closeDriverOnExitBox.Checked;