mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
b02427417c
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
77 lines
2.1 KiB
C#
77 lines
2.1 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using ProcessHacker.Common;
|
|
using ProcessHacker.Native.Objects;
|
|
using ProcessHacker.Native.Security;
|
|
|
|
namespace ProcessHacker.Components
|
|
{
|
|
public partial class EventProperties : UserControl
|
|
{
|
|
private EventHandle _eventHandle;
|
|
|
|
public EventProperties(EventHandle eventHandle)
|
|
{
|
|
InitializeComponent();
|
|
|
|
_eventHandle = eventHandle;
|
|
_eventHandle.Reference();
|
|
this.UpdateInfo();
|
|
}
|
|
|
|
private void UpdateInfo()
|
|
{
|
|
var basicInfo = _eventHandle.GetBasicInformation();
|
|
|
|
labelType.Text = basicInfo.EventType.ToString();
|
|
labelSignaled.Text = (basicInfo.EventState != 0).ToString();
|
|
}
|
|
|
|
private void TryExecute(MethodInvoker action)
|
|
{
|
|
try
|
|
{
|
|
action();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PhUtils.ShowException("Unable to perform the operation", ex);
|
|
}
|
|
}
|
|
|
|
private void UpgradeExecute(MethodInvoker action)
|
|
{
|
|
this.TryExecute(() =>
|
|
{
|
|
_eventHandle.ChangeAccess(EventAccess.QueryState | EventAccess.ModifyState);
|
|
|
|
action();
|
|
});
|
|
}
|
|
|
|
private void buttonSet_Click(object sender, EventArgs e)
|
|
{
|
|
this.UpgradeExecute(() => _eventHandle.Set());
|
|
this.UpdateInfo();
|
|
}
|
|
|
|
private void buttonPulse_Click(object sender, EventArgs e)
|
|
{
|
|
this.UpgradeExecute(() => _eventHandle.Pulse());
|
|
this.UpdateInfo();
|
|
}
|
|
|
|
private void buttonClear_Click(object sender, EventArgs e)
|
|
{
|
|
this.UpgradeExecute(() => _eventHandle.Clear());
|
|
this.UpdateInfo();
|
|
}
|
|
|
|
private void buttonReset_Click(object sender, EventArgs e)
|
|
{
|
|
this.UpgradeExecute(() => _eventHandle.Reset());
|
|
this.UpdateInfo();
|
|
}
|
|
}
|
|
}
|