aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/syscall_windows_test.go
diff options
context:
space:
mode:
authorJordan Rhee <jordanrh@microsoft.com>2018-12-29 16:19:16 -0800
committerAlex Brainman <alex.brainman@gmail.com>2018-12-30 04:55:26 +0000
commit3e89272f9c87f69dc687b96687b1e3d29e9f5d84 (patch)
tree8dfc63c9947f7b39617275f48b2d1bc0a1a59515 /src/runtime/syscall_windows_test.go
parent58a17b43d14a1e31e5aa2738747157488168cd96 (diff)
downloadgo-3e89272f9c87f69dc687b96687b1e3d29e9f5d84.tar.gz
go-3e89272f9c87f69dc687b96687b1e3d29e9f5d84.zip
runtime: use EnumTimeFormatsEx instead of EnumWindows in callback tests
Use EnumTimeFormatsEx() to test panics across callback boundaries instead of EnumWindows(). EnumWindows() is incompatible with Go's panic unwinding mechanism. See the associated issue for more information. Updates #26148 Change-Id: If1dd70885d9c418b980b6827942cb1fd16c73803 Reviewed-on: https://go-review.googlesource.com/c/155923 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/runtime/syscall_windows_test.go')
-rw-r--r--src/runtime/syscall_windows_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/runtime/syscall_windows_test.go b/src/runtime/syscall_windows_test.go
index 0882e9cb73..3ad6512976 100644
--- a/src/runtime/syscall_windows_test.go
+++ b/src/runtime/syscall_windows_test.go
@@ -157,7 +157,7 @@ func TestEnumWindows(t *testing.T) {
}
}
-func callback(hwnd syscall.Handle, lparam uintptr) uintptr {
+func callback(timeFormatString unsafe.Pointer, lparam uintptr) uintptr {
(*(*func())(unsafe.Pointer(&lparam)))()
return 0 // stop enumeration
}
@@ -165,9 +165,10 @@ func callback(hwnd syscall.Handle, lparam uintptr) uintptr {
// nestedCall calls into Windows, back into Go, and finally to f.
func nestedCall(t *testing.T, f func()) {
c := syscall.NewCallback(callback)
- d := GetDLL(t, "user32.dll")
+ d := GetDLL(t, "kernel32.dll")
defer d.Release()
- d.Proc("EnumWindows").Call(c, uintptr(*(*unsafe.Pointer)(unsafe.Pointer(&f))))
+ const LOCALE_NAME_USER_DEFAULT = 0
+ d.Proc("EnumTimeFormatsEx").Call(c, LOCALE_NAME_USER_DEFAULT, 0, uintptr(*(*unsafe.Pointer)(unsafe.Pointer(&f))))
}
func TestCallback(t *testing.T) {