Commit bc244008 authored by Alex Brainman's avatar Alex Brainman

runtime: move SetErrorMode constants into function so they are not exported

Change-Id: Ib1a2adbcdbd7d96f9b4177abc3c9cf0ab09c1df4
Reviewed-on: https://go-review.googlesource.com/2716Reviewed-by: default avatarDave Cheney <dave@cheney.net>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent 242050d0
...@@ -105,12 +105,17 @@ const ( ...@@ -105,12 +105,17 @@ const (
currentThread = ^uintptr(1) // -2 = current thread currentThread = ^uintptr(1) // -2 = current thread
) )
const ( func disableWER() {
SEM_FAILCRITICALERRORS = 0x0001 // do not display Windows Error Reporting dialogue
SEM_NOGPFAULTERRORBOX = 0x0002 const (
SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 SEM_FAILCRITICALERRORS = 0x0001
SEM_NOOPENFILEERRORBOX = 0x8000 SEM_NOGPFAULTERRORBOX = 0x0002
) SEM_NOALIGNMENTFAULTEXCEPT = 0x0004
SEM_NOOPENFILEERRORBOX = 0x8000
)
errormode := uint32(stdcall1(_SetErrorMode, SEM_NOGPFAULTERRORBOX))
stdcall1(_SetErrorMode, uintptr(errormode)|SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX)
}
var ( var (
kernel32Name = []byte("kernel32.dll\x00") kernel32Name = []byte("kernel32.dll\x00")
...@@ -123,9 +128,7 @@ func osinit() { ...@@ -123,9 +128,7 @@ func osinit() {
kernel32 := stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&kernel32Name[0]))) kernel32 := stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&kernel32Name[0])))
// don't display the crash dialog disableWER()
errormode := uint32(stdcall1(_SetErrorMode, SEM_NOGPFAULTERRORBOX))
stdcall1(_SetErrorMode, uintptr(errormode)|SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX)
externalthreadhandlerp = funcPC(externalthreadhandler) externalthreadhandlerp = funcPC(externalthreadhandler)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment