diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-28 12:27:06 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-29 08:41:30 +0200 |
commit | 51a410523acd4687a91ff6b48e05a4c7d711126a (patch) | |
tree | 1c3e6059569376c72336ba09f06e9a5ee5e1e833 /version/zsyscall_windows.go | |
parent | go.mod: use forked winio with no thirdparty deps (diff) | |
download | wireguard-windows-51a410523acd4687a91ff6b48e05a4c7d711126a.tar.xz wireguard-windows-51a410523acd4687a91ff6b48e05a4c7d711126a.zip |
updater: add initial skeleton
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'version/zsyscall_windows.go')
-rw-r--r-- | version/zsyscall_windows.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/version/zsyscall_windows.go b/version/zsyscall_windows.go new file mode 100644 index 00000000..9f11ce70 --- /dev/null +++ b/version/zsyscall_windows.go @@ -0,0 +1,49 @@ +// Code generated by 'go generate'; DO NOT EDIT. + +package version + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +var _ unsafe.Pointer + +// Do the interface allocations only once for common +// Errno values. +const ( + errnoERROR_IO_PENDING = 997 +) + +var ( + errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e syscall.Errno) error { + switch e { + case 0: + return nil + case errnoERROR_IO_PENDING: + return errERROR_IO_PENDING + } + // TODO: add more here, after collecting data on the common + // error values see on Windows. (perhaps when running + // all.bat?) + return e +} + +var ( + modntdll = windows.NewLazySystemDLL("ntdll.dll") + + procRtlGetVersion = modntdll.NewProc("RtlGetVersion") +) + +func rtlGetVersion(versionInfo *osVersionInfo) (nterr uint32) { + r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(versionInfo)), 0, 0) + nterr = uint32(r0) + return +} |