Add back LoadLibraryA fallback
This commit is contained in:
@@ -1166,7 +1166,10 @@ uintptr_t cfunc(void) {
|
||||
dll, err = syscall.LoadDLL(name)
|
||||
if err == nil {
|
||||
dll.Release()
|
||||
t.Fatalf("Bad: insecure load of DLL by base name %q before sysdll registration: %v", name, err)
|
||||
if wantLoadLibraryEx() {
|
||||
t.Fatalf("Bad: insecure load of DLL by base name %q before sysdll registration: %v", name, err)
|
||||
}
|
||||
t.Skip("insecure load of DLL, but expected")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1212,6 +1215,24 @@ func TestBigStackCallbackSyscall(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// wantLoadLibraryEx reports whether we expect LoadLibraryEx to work for tests.
|
||||
func wantLoadLibraryEx() bool {
|
||||
return testenv.Builder() != "" && (runtime.GOARCH == "amd64" || runtime.GOARCH == "386")
|
||||
}
|
||||
|
||||
func TestLoadLibraryEx(t *testing.T) {
|
||||
use, have, flags := runtime.LoadLibraryExStatus()
|
||||
if use {
|
||||
return // success.
|
||||
}
|
||||
if wantLoadLibraryEx() {
|
||||
t.Fatalf("Expected LoadLibraryEx+flags to be available. (LoadLibraryEx=%v; flags=%v)",
|
||||
have, flags)
|
||||
}
|
||||
t.Skipf("LoadLibraryEx not usable, but not expected. (LoadLibraryEx=%v; flags=%v)",
|
||||
have, flags)
|
||||
}
|
||||
|
||||
var (
|
||||
modwinmm = syscall.NewLazyDLL("winmm.dll")
|
||||
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||
|
||||
Reference in New Issue
Block a user