Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Sources/EventViewerX/Enums/NamedEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public enum NamedEvents {
/// </summary>
DeviceRecognized,

/// <summary>
/// Device was disabled
/// </summary>
DeviceDisabled,

/// <summary>
/// Object deleted
/// </summary>
Expand Down
38 changes: 38 additions & 0 deletions Sources/EventViewerX/Rules/Windows/DeviceDisabled.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace EventViewerX.Rules.Windows;

/// <summary>
/// Device was disabled
/// 6420: A device was disabled.
/// </summary>
public class DeviceDisabled : EventRuleBase {
public override List<int> EventIds => new() { 6420 };
public override string LogName => "Security";
public override NamedEvents NamedEvent => NamedEvents.DeviceDisabled;

public override bool CanHandle(EventObject eventObject) {
// Simple rule - always handle if event ID and log name match
return true;
}

public string Computer;
public string DeviceId;
public string DeviceName;
public string ClassId;
public string ClassName;
public string Reason;
public string Who;
public DateTime When;

public DeviceDisabled(EventObject eventObject) : base(eventObject) {
_eventObject = eventObject;
Type = "DeviceDisabled";
Computer = _eventObject.ComputerName;
DeviceId = _eventObject.GetValueFromDataDictionary("DeviceId");
DeviceName = _eventObject.GetValueFromDataDictionary("DeviceDescription", "DeviceName");
ClassId = _eventObject.GetValueFromDataDictionary("ClassId");
ClassName = _eventObject.GetValueFromDataDictionary("ClassName");
Reason = _eventObject.GetValueFromDataDictionary("Reason");
Who = _eventObject.GetValueFromDataDictionary("SubjectUserName", "SubjectDomainName", "\\", reverseOrder: true);
When = _eventObject.TimeCreated;
}
}
Loading