mirror of
https://github.com/golang/go
synced 2024-11-24 08:20:03 -07:00
runtime: do not generate crash dump on Windows 7
It appears Windows 7 ignores WER_FAULT_REPORTING_NO_UI WerSetFlags API flag. And now after CL 307372, runtime will display WER GUI dialogue. We don't want to introduce random GUI dialogues during Go program execution. So disable dump crash creation on Windows 7 altogether. Updates #20498 Change-Id: Ie268a7d4609f8a0eba4fe9ecf250856b0a61b331 Reviewed-on: https://go-review.googlesource.com/c/go/+/360617 Trust: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Patrik Nyblom <pnyb@google.com>
This commit is contained in:
parent
2cf85b1fb8
commit
2622235a99
@ -22,8 +22,16 @@ func disableWER() {
|
||||
stdcall1(_SetErrorMode, uintptr(errormode)|SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX)
|
||||
}
|
||||
|
||||
// isWin7 returns true on Windows 7. Otherwise it returns false.
|
||||
//
|
||||
//go:nosplit
|
||||
func isWin7() bool {
|
||||
var maj, min, build uint32
|
||||
stdcall3(_RtlGetNtVersionNumbers, uintptr(unsafe.Pointer(&maj)), uintptr(unsafe.Pointer(&min)), uintptr(unsafe.Pointer(&build)))
|
||||
return maj < 6 || (maj == 6 && min <= 1)
|
||||
}
|
||||
|
||||
// enableWERNoUI re-enables Windows error reporting without fault reporting UI.
|
||||
// It returns false on older Windows versions (XP and earlier) where WerSetFlags() is not supported.
|
||||
//
|
||||
// This is marked nosplit since it is used during crash.
|
||||
//
|
||||
@ -224,11 +232,16 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 {
|
||||
|
||||
_, _, docrash := gotraceback()
|
||||
if docrash {
|
||||
// Windows 7 apears to ignore WER_FAULT_REPORTING_NO_UI
|
||||
// WerSetFlags API flag. So do not call enableWERNoUI
|
||||
// on Windows 7.
|
||||
if !isWin7() {
|
||||
// trigger crash dump creation
|
||||
if enableWERNoUI() {
|
||||
return _EXCEPTION_CONTINUE_SEARCH
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(2)
|
||||
return 0 // not reached
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user