Documentation
¶
Index ¶
- Constants
- func CloseEventLog(handle syscall.Handle) error
- func CloseHandle(handle syscall.Handle) error
- func CreateEvent(eventAttributes *syscall.SecurityAttributes, manualReset, initialState uint32, ...) (syscall.Handle, error)
- func DeregisterEventSource(log syscall.Handle) error
- func EventLogRecordNumber(handle syscall.Handle) (uint32, error)
- func EvtClose(handle syscall.Handle) error
- func EvtNextChannelPath(handle syscall.Handle) ([]string, error)
- func EvtOpenChannelEnum(session syscall.Handle) (syscall.Handle, error)
- func FormatContent(buf []byte) string
- func FormatMessage(errorCode uint32) string
- func LookupAccountSid(buf []byte, sidlen, sidoffset uint32) (string, string, error)
- func NotifyChangeEventLog(handle, event syscall.Handle) error
- func OpenEventLog(name string) (syscall.Handle, error)
- func ReadEventLog(handle syscall.Handle, flags, offset uint32) ([]byte, error)
- func RegisterEventSource(uncServerName, sourceName *uint16) (handle syscall.Handle, err error)
- func ReportEvent(log syscall.Handle, etype uint16, category uint16, eventID uint32, ...) error
- func ResetEvent(handle syscall.Handle) error
- func SetEvent(handle syscall.Handle) error
- func WaitForMultipleObjects(handles []syscall.Handle, waitAll bool, waitMilliseconds uint32) (event uint32, err error)
- type EventEntry
- type EventLogRecord
- type EventNotifier
- type EventWatcher
- type SID_NAME_USE
Constants ¶
const ( InvalidHandle = syscall.Handle(0) ERROR_HANDLE_EOF syscall.Errno = 38 ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 ERROR_NO_MORE_ITEMS syscall.Errno = 259 NO_ERROR = 0 )
const ( EVENTLOG_SUCCESS = 0x0000 EVENTLOG_ERROR_TYPE = 0x0001 EVENTLOG_WARNING_TYPE = 0x0002 EVENTLOG_INFORMATION_TYPE = 0x0004 EVENTLOG_AUDIT_SUCCESS = 0x0008 EVENTLOG_AUDIT_FAILURE = 0x0010 )
const ( EVENTLOG_SEEK_READ = 0x0002 EVENTLOG_SEQUENTIAL_READ = 0x0001 EVENTLOG_FORWARDS_READ = 0x0004 EVENTLOG_BACKWARDS_READ = 0x0008 )
https://learn.microsoft.com/zh-cn/windows/win32/api/winbase/nf-winbase-readeventloga
Variables ¶
This section is empty.
Functions ¶
func CloseEventLog ¶
func CloseHandle ¶
func CreateEvent ¶
func DeregisterEventSource ¶
func FormatContent ¶ added in v0.1.1
func FormatMessage ¶
func LookupAccountSid ¶
LookupAccountSid retrieves the account name and domain name for the specified SID.
func NotifyChangeEventLog ¶
func RegisterEventSource ¶
func ReportEvent ¶
func ResetEvent ¶
Types ¶
type EventEntry ¶ added in v0.1.1
type EventLogRecord ¶
type EventLogRecord struct { Length uint32 Reserved uint32 RecordNumber uint32 TimeGenerated uint32 TimeWritten uint32 EventID uint32 EventType uint16 NumStrings uint16 EventCategory uint16 ReservedFlags uint16 ClosingRecordNumber uint32 StringOffset uint32 UserSidLength uint32 UserSidOffset uint32 DataLength uint32 DataOffset uint32 }
func ParseEventLogData ¶
func ParseEventLogData(buf []byte) *EventLogRecord
ParseEventLogData parses the event log data.
func ParserEventLogData ¶
func ParserEventLogData(buf []byte) (*EventLogRecord, error)
type EventNotifier ¶
type EventNotifier struct { EventLogChannel chan *EventEntry // contains filtered or unexported fields }
EventNotifier manages a collection of EventWatchers.
func NewEventNotifier ¶
func NewEventNotifier(ctx context.Context) *EventNotifier
NewEventNotifier creates a new EventNotifier instance.
func (*EventNotifier) AddWatcher ¶
func (en *EventNotifier) AddWatcher(name string) error
AddWatcher adds a new EventWatcher to the EventNotifier.
func (*EventNotifier) Close ¶
func (en *EventNotifier) Close()
Close shuts down all EventWatchers and waits for them to exit.
func (*EventNotifier) GetWatcher ¶
func (en *EventNotifier) GetWatcher(name string) (*EventWatcher, error)
GetWatcher retrieves an EventWatcher by name.
func (*EventNotifier) RemoveWatcher ¶
func (en *EventNotifier) RemoveWatcher(name string) error
RemoveWatcher removes an EventWatcher from the EventNotifier.
type EventWatcher ¶
type EventWatcher struct { Name string // contains filtered or unexported fields }
EventWatcher monitors an event log for changes.
func NewEventWatcher ¶
func NewEventWatcher(ctx context.Context, name string, eventChan chan *EventEntry) *EventWatcher
NewEventWatcher creates a new EventWatcher instance.
func (*EventWatcher) Close ¶
func (ew *EventWatcher) Close()
Close cancels the context and triggers the cancel event.
func (*EventWatcher) CloseHandles ¶
func (ew *EventWatcher) CloseHandles() error
CloseHandles closes all handles associated with the EventWatcher.
func (*EventWatcher) Init ¶
func (ew *EventWatcher) Init() error
Init initializes the EventWatcher instance.
func (*EventWatcher) Listen ¶
func (ew *EventWatcher) Listen()
Listen monitors the event log and processes changes.
type SID_NAME_USE ¶
type SID_NAME_USE uint32
const ( // https://learn.microsoft.com/zh-cn/windows/win32/api/winnt/ne-winnt-sid_name_use SidTypeUser SID_NAME_USE = iota + 1 SidTypeGroup SidTypeDomain SidTypeAlias SidTypeWellKnownGroup SidTypeDeletedAccount SidTypeInvalid SidTypeUnknown SidTypeComputer SidTypeLabel SidTypeLogonSession )