* #2780277 - "add <ENTER> to shortcut list for default action"

* Thread termination now prompts
* Handle filter took a while to start up

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1136 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2009-04-24 09:59:21 +00:00
parent 55dac38b45
commit dcbb60871d
9 changed files with 74 additions and 27 deletions
+4 -1
View File
@@ -1,11 +1,14 @@
Process Hacker
1.3.7.2
* NEW:
* NEW/IMPROVED:
* #2780260 - "add <Enter> key to open Proc Properties"
* #2780277 - "add <ENTER> to shortcut list for default action"
* Thread termination now prompts
* FIXED:
* Unhandled exception when process properties is closed within 100ms of
being opened
* Handle filter took a while to start up
1.3.7.1
* NEW:
@@ -102,6 +102,11 @@ namespace ProcessHacker.Components
set { buttonApply.Text = value; }
}
public Button ApplyButton
{
get { return buttonApply; }
}
public void SaveSettings()
{
Properties.Settings.Default.ServiceMiniListColumns = ColumnSettings.SaveSettings(listServices);
+23 -11
View File
@@ -180,6 +180,18 @@ namespace ProcessHacker.Components
{
if (this.KeyDown != null)
this.KeyDown(sender, e);
if (!e.Handled)
{
if (e.KeyCode == Keys.Enter)
{
inspectThreadMenuItem_Click(null, null);
}
else if (e.KeyCode == Keys.Delete)
{
terminateThreadMenuItem_Click(null, null);
}
}
}
#region Properties
@@ -496,6 +508,9 @@ namespace ProcessHacker.Components
private void inspectThreadMenuItem_Click(object sender, EventArgs e)
{
if (listThreads.SelectedItems.Count != 1)
return;
if (_pid == 4)
{
MessageBox.Show(
@@ -508,7 +523,7 @@ namespace ProcessHacker.Components
if (_pid == Win32.GetCurrentProcessId())
{
if (MessageBox.Show(
"Inspecting Process Hacker's threads will lead to instability. Are you sure you want to continue?",
"Inspecting Process Hacker's threads may lead to instability. Are you sure you want to continue?",
"Process Hacker", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2)
== DialogResult.No)
return;
@@ -517,7 +532,7 @@ namespace ProcessHacker.Components
if (Misc.IsDangerousPid(_pid))
{
if (MessageBox.Show(
"Inspecting a system process' threads will lead to instability. Are you sure you want to continue?",
"Inspecting a system process' threads may lead to instability. Are you sure you want to continue?",
"Process Hacker", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2)
== DialogResult.No)
return;
@@ -538,16 +553,13 @@ namespace ProcessHacker.Components
}
private void terminateThreadMenuItem_Click(object sender, EventArgs e)
{
if (Properties.Settings.Default.WarnDangerous && Misc.IsDangerousPid(_pid))
{
DialogResult result = MessageBox.Show("The process with PID " + _pid + " is a system process. Are you" +
" sure you want to terminate the selected thread(s)?", "Process Hacker", MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
{
if (listThreads.SelectedItems.Count == 0)
return;
if (result == DialogResult.No)
return;
}
if (MessageBox.Show("Are you sure you want to terminate the selected thread(s)?",
"Process Hacker", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
return;
if (Program.ElevationType == TokenElevationType.Limited &&
KProcessHacker.Instance == null)
+1
View File
@@ -774,6 +774,7 @@
this.listServices.Size = new System.Drawing.Size(784, 344);
this.listServices.TabIndex = 0;
this.listServices.DoubleClick += new System.EventHandler(this.listServices_DoubleClick);
this.listServices.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listServices_KeyDown);
//
// tabNetwork
//
+18
View File
@@ -153,6 +153,18 @@ namespace ProcessHacker
propertiesServiceMenuItem_Click(null, null);
}
private void listServices_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
{
deleteServiceMenuItem_Click(null, null);
}
else if (e.KeyCode == Keys.Enter)
{
propertiesServiceMenuItem_Click(null, null);
}
}
#endregion
#region Main Menu
@@ -1570,11 +1582,17 @@ namespace ProcessHacker
private void deleteServiceMenuItem_Click(object sender, EventArgs e)
{
if (listServices.SelectedItems.Count != 1)
return;
ServiceActions.Delete(this, listServices.SelectedItems[0].Name, true);
}
private void propertiesServiceMenuItem_Click(object sender, EventArgs e)
{
if (listServices.SelectedItems.Count == 0)
return;
List<string> selected = new List<string>();
ServiceWindow sw;
@@ -43,6 +43,7 @@ namespace ProcessHacker
_serviceProps.NeedsClose += new EventHandler(_serviceProps_NeedsClose);
this.Controls.Add(_serviceProps);
this.Text = _serviceProps.Text;
this.AcceptButton = _serviceProps.ApplyButton;
if (services.Length == 1)
_serviceProps.ApplyButtonText = "&OK";
+1
View File
@@ -142,6 +142,7 @@
//
// buttonToken
//
this.buttonToken.Enabled = false;
this.buttonToken.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonToken.Location = new System.Drawing.Point(12, 12);
this.buttonToken.Name = "buttonToken";
+8 -3
View File
@@ -79,14 +79,16 @@ namespace ProcessHacker
using (TokenHandle token = thandle.GetToken(TokenAccess.Query))
{
labelThreadUser.Text = "Username: " + token.GetUser().GetName(true);
buttonToken.Enabled = true;
}
}
catch (Exception ex)
{
buttonToken.Enabled = false;
if (ex.Message.StartsWith("An attempt was made"))
{
labelThreadUser.Text = "Username: (Not Impersonating)";
buttonToken.Enabled = false;
}
else
{
@@ -95,8 +97,11 @@ namespace ProcessHacker
}
}
}
catch
{ }
catch (Exception ex)
{
labelThreadUser.Text = "Username: (" + ex.Message + ")";
buttonToken.Enabled = false;
}
try
{
+13 -12
View File
@@ -29,8 +29,7 @@ using System.ComponentModel;
namespace ProcessHacker.FormHelper
{
/// <summary>
/// Exception thrown when an
/// operation is already in progress.
/// Exception thrown when an operation is already in progress.
/// </summary>
public class AlreadyRunningException : System.ApplicationException
{
@@ -40,6 +39,7 @@ namespace ProcessHacker.FormHelper
public abstract class AsyncOperation
{
private Thread _asyncThread;
private object _asyncLock = new object();
public AsyncOperation(ISynchronizeInvoke target)
@@ -47,7 +47,7 @@ namespace ProcessHacker.FormHelper
isiTarget = target;
isRunning = false;
}
public void Start()
{
lock (_asyncLock)
@@ -59,8 +59,9 @@ namespace ProcessHacker.FormHelper
isRunning = true;
}
new MethodInvoker(InternalStart).BeginInvoke(null, null);
}
_asyncThread = new Thread(InternalStart);
_asyncThread.Start();
}
public void Cancel()
{
@@ -111,7 +112,8 @@ namespace ProcessHacker.FormHelper
return completeFlag || cancelAcknowledgedFlag || failedFlag;
}
}
}
}
public event EventHandler Completed;
public event EventHandler Cancelled;
public event System.Threading.ThreadExceptionEventHandler Failed;
@@ -135,7 +137,7 @@ namespace ProcessHacker.FormHelper
lock (_asyncLock) { return cancelledFlag; }
}
}
private bool completeFlag;
protected bool HasCompleted
{
@@ -144,8 +146,7 @@ namespace ProcessHacker.FormHelper
lock (_asyncLock) { return completeFlag; }
}
}
protected void AcknowledgeCancel()
{
lock (_asyncLock)
@@ -158,11 +159,11 @@ namespace ProcessHacker.FormHelper
}
private bool cancelAcknowledgedFlag;
// if the operation fails with an exception,set to true
// if the operation fails with an exception, set to true
private bool failedFlag;
// if the operation is running,set to true
// if the operation is running, set to true
private bool isRunning;
private void InternalStart()
{
cancelledFlag = false;