summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys/windows/syscall_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/windows/syscall_test.go')
-rw-r--r--vendor/golang.org/x/sys/windows/syscall_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/windows/syscall_test.go b/vendor/golang.org/x/sys/windows/syscall_test.go
index 62588b91b..d7009e44a 100644
--- a/vendor/golang.org/x/sys/windows/syscall_test.go
+++ b/vendor/golang.org/x/sys/windows/syscall_test.go
@@ -7,6 +7,7 @@
package windows_test
import (
+ "syscall"
"testing"
"golang.org/x/sys/windows"
@@ -31,3 +32,22 @@ func TestEnv(t *testing.T) {
// make sure TESTENV gets set to "", not deleted
testSetGetenv(t, "TESTENV", "")
}
+
+func TestGetProcAddressByOrdinal(t *testing.T) {
+ // Attempt calling shlwapi.dll:IsOS, resolving it by ordinal, as
+ // suggested in
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/bb773795.aspx
+ h, err := windows.LoadLibrary("shlwapi.dll")
+ if err != nil {
+ t.Fatalf("Failed to load shlwapi.dll: %s", err)
+ }
+ procIsOS, err := windows.GetProcAddressByOrdinal(h, 437)
+ if err != nil {
+ t.Fatalf("Could not find shlwapi.dll:IsOS by ordinal: %s", err)
+ }
+ const OS_NT = 1
+ r, _, _ := syscall.Syscall(procIsOS, 1, OS_NT, 0, 0)
+ if r == 0 {
+ t.Error("shlwapi.dll:IsOS(OS_NT) returned 0, expected non-zero value")
+ }
+}