Skip to content

Commit 1089dc7

Browse files
committed
feat: improve WER report details
1 parent 29f4580 commit 1089dc7

2 files changed

Lines changed: 50 additions & 9 deletions

File tree

thorlog/v3/file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ type File struct {
5555
// RecycleBinInfo contains information about the file if it was in the recycle bin
5656
RecycleBinInfo *RecycleBinIndexFile `json:"recycle_bin_info,omitempty" textlog:",expand,omitempty"`
5757

58-
// WerInfo contains information about the file if it was a Windows Error Reporting crash report
59-
WerInfo *WerCrashReport `json:"wer_info,omitempty" textlog:",expand,omitempty"`
58+
// WERInfo contains information about the file if it was a Windows Error Reporting crash report
59+
WERInfo *WERCrashReport `json:"wer_info,omitempty" textlog:",expand,omitempty"`
6060

6161
// Content contains extracts from the content of the file, typically focusing on any matched patterns.
6262
Content *SparseData `json:"content,omitempty" textlog:"content,expand,omitempty"`

thorlog/v3/wer.go

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,54 @@ import (
44
"time"
55
)
66

7-
type WerCrashReport struct {
8-
Type string `json:"-" textlog:"-"`
9-
Exe string `json:"exe" textlog:"exe"`
10-
Date time.Time `json:"date" textlog:"date"`
11-
AppPath string `json:"app_path" textlog:"apppath"`
12-
Error string `json:"error" textlog:"error"`
13-
FaultModule string `json:"fault_in_module" textlog:"fault_in_module"`
7+
// WERCrashReport represents a crash report generated by Windows Error Reporting (WER).
8+
//
9+
// For details consult the official documentation at https://learn.microsoft.com/en-us/windows/win32/api/werapi/ns-werapi-wer_report_information and in particular the werapi.h reference at https://learn.microsoft.com/en-us/windows/win32/api/werapi/ .
10+
//
11+
// There are plenty of fields to consider in the WER report, but the focus is on the WER_REPORT_INFORMATION structure required to create a report (WerReportCreate()) and the WER_REPORT_UI enumeration that holds additional error details if present.
12+
type WERCrashReport struct {
13+
ReportType WERReportType `json:"type" textlog:"reporttype"`
14+
// Event name as used in the file name of the WER report (which seems to be deduced from Sig[0].Value), e.g., "evilservice.exe", "Update;", "10.0.19041.1371_", etc.
15+
EventName string `json:"event_name" textlog:"eventname"`
16+
// Event type, e.g., "WindowsWcpOtherFailure3", "StoreAgentScanForUpdatesFailure0", etc.
17+
EventType string `json:"event_type" textlog:"eventtype"`
18+
Date time.Time `json:"date" textlog:"date"`
19+
AppPath string `json:"app_path" textlog:"apppath"`
20+
AppName string `json:"app_name" textlog:"appname"`
21+
// Name of executable from field OriginalFilename
22+
Exe string `json:"exe,omitempty" textlog:"exe,omitempty"`
23+
// Specific error details from UI block: "UI[2] / UI[8]" or "UI[8]" if present.
24+
Error string `json:"error,omitempty" textlog:"error,omitempty"`
25+
// Fault module name from Sig block if present.
26+
FaultModule string `json:"fault_in_module,omitempty" textlog:"fault_in_module,omitempty"`
27+
}
28+
29+
// WERReportType represents the type of a WER report.
30+
//
31+
// From WerApi.h:
32+
// typedef enum _WER_REPORT_TYPE
33+
//
34+
// {
35+
// WerReportNonCritical = 0,
36+
// WerReportCritical = 1,
37+
// WerReportApplicationCrash = 2,
38+
// WerReportApplicationHang = 3,
39+
// WerReportKernel = 4,
40+
// WerReportInvalid
41+
// } WER_REPORT_TYPE;
42+
type WERReportType string
43+
44+
const (
45+
WERReportNonCritical WERReportType = "NonCritical"
46+
WERReportCritical WERReportType = "Critical"
47+
WERReportApplicationCrash WERReportType = "AppCrash"
48+
WERReportApplicationHang WERReportType = "AppHang"
49+
WERReportKernel WERReportType = "Kernel"
50+
WERReportInvalid WERReportType = "Invalid"
51+
)
52+
53+
func (r WERReportType) String() string {
54+
return string(r)
1455
}
1556

1657
type AnalysisResult struct {

0 commit comments

Comments
 (0)