mirror of
https://github.com/golang/go
synced 2024-11-16 21:54:51 -07:00
runtime: unconditionally load AddVectoredContinueHandler on Windows
AddVectoredContinueHandler is available since Windows XP [1], there is no need to check if it is available. [1]: https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-addvectoredcontinuehandler Change-Id: I1ddc3d58b3294d9876620cd46159d9692694b475 Reviewed-on: https://go-review.googlesource.com/c/go/+/532817 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
ff7986d670
commit
a30967f4ce
@ -16,6 +16,7 @@ const (
|
|||||||
_NSIG = 65
|
_NSIG = 65
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic runtime._AddVectoredContinueHandler AddVectoredContinueHandler%2 "kernel32.dll"
|
||||||
//go:cgo_import_dynamic runtime._AddVectoredExceptionHandler AddVectoredExceptionHandler%2 "kernel32.dll"
|
//go:cgo_import_dynamic runtime._AddVectoredExceptionHandler AddVectoredExceptionHandler%2 "kernel32.dll"
|
||||||
//go:cgo_import_dynamic runtime._CloseHandle CloseHandle%1 "kernel32.dll"
|
//go:cgo_import_dynamic runtime._CloseHandle CloseHandle%1 "kernel32.dll"
|
||||||
//go:cgo_import_dynamic runtime._CreateEventA CreateEventA%4 "kernel32.dll"
|
//go:cgo_import_dynamic runtime._CreateEventA CreateEventA%4 "kernel32.dll"
|
||||||
@ -72,6 +73,7 @@ var (
|
|||||||
// Following syscalls are available on every Windows PC.
|
// Following syscalls are available on every Windows PC.
|
||||||
// All these variables are set by the Windows executable
|
// All these variables are set by the Windows executable
|
||||||
// loader before the Go program starts.
|
// loader before the Go program starts.
|
||||||
|
_AddVectoredContinueHandler,
|
||||||
_AddVectoredExceptionHandler,
|
_AddVectoredExceptionHandler,
|
||||||
_CloseHandle,
|
_CloseHandle,
|
||||||
_CreateEventA,
|
_CreateEventA,
|
||||||
@ -124,11 +126,6 @@ var (
|
|||||||
_WriteFile,
|
_WriteFile,
|
||||||
_ stdFunction
|
_ stdFunction
|
||||||
|
|
||||||
// Following syscalls are only available on some Windows PCs.
|
|
||||||
// We will load syscalls, if available, before using them.
|
|
||||||
_AddVectoredContinueHandler,
|
|
||||||
_ stdFunction
|
|
||||||
|
|
||||||
// Use RtlGenRandom to generate cryptographically random data.
|
// Use RtlGenRandom to generate cryptographically random data.
|
||||||
// This approach has been recommended by Microsoft (see issue
|
// This approach has been recommended by Microsoft (see issue
|
||||||
// 15589 for details).
|
// 15589 for details).
|
||||||
@ -260,7 +257,6 @@ func loadOptionalSyscalls() {
|
|||||||
if k32 == 0 {
|
if k32 == 0 {
|
||||||
throw("kernel32.dll not found")
|
throw("kernel32.dll not found")
|
||||||
}
|
}
|
||||||
_AddVectoredContinueHandler = windowsFindfunc(k32, []byte("AddVectoredContinueHandler\000"))
|
|
||||||
|
|
||||||
a32 := windowsLoadSystemLib(advapi32dll[:])
|
a32 := windowsLoadSystemLib(advapi32dll[:])
|
||||||
if a32 == 0 {
|
if a32 == 0 {
|
||||||
|
@ -49,9 +49,8 @@ func sigresume()
|
|||||||
|
|
||||||
func initExceptionHandler() {
|
func initExceptionHandler() {
|
||||||
stdcall2(_AddVectoredExceptionHandler, 1, abi.FuncPCABI0(exceptiontramp))
|
stdcall2(_AddVectoredExceptionHandler, 1, abi.FuncPCABI0(exceptiontramp))
|
||||||
if _AddVectoredContinueHandler == nil || GOARCH == "386" {
|
if GOARCH == "386" {
|
||||||
// use SetUnhandledExceptionFilter for windows-386 or
|
// use SetUnhandledExceptionFilter for windows-386.
|
||||||
// if VectoredContinueHandler is unavailable.
|
|
||||||
// note: SetUnhandledExceptionFilter handler won't be called, if debugging.
|
// note: SetUnhandledExceptionFilter handler won't be called, if debugging.
|
||||||
stdcall1(_SetUnhandledExceptionFilter, abi.FuncPCABI0(lastcontinuetramp))
|
stdcall1(_SetUnhandledExceptionFilter, abi.FuncPCABI0(lastcontinuetramp))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user