diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-30 10:10:26 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-30 10:10:26 +0200 |
commit | 5dbb327ae9f0e85c45a4afa0c6c4348519f499c1 (patch) | |
tree | 9b9f1f2aa34f75a1213b4dc84a7554437ba2e2e5 /version/wintrust | |
parent | version: add beginnings of authenticode checking (diff) | |
download | wireguard-windows-5dbb327ae9f0e85c45a4afa0c6c4348519f499c1.tar.xz wireguard-windows-5dbb327ae9f0e85c45a4afa0c6c4348519f499c1.zip |
version: add missing zsyscall
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'version/wintrust')
-rw-r--r-- | version/wintrust/zsyscall_windows.go | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/version/wintrust/zsyscall_windows.go b/version/wintrust/zsyscall_windows.go new file mode 100644 index 00000000..775f38ba --- /dev/null +++ b/version/wintrust/zsyscall_windows.go @@ -0,0 +1,55 @@ +// Code generated by 'go generate'; DO NOT EDIT. + +package wintrust + +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 ( + modwintrust = windows.NewLazySystemDLL("wintrust.dll") + + procWinVerifyTrust = modwintrust.NewProc("WinVerifyTrust") +) + +func WinVerifyTrust(hWnd windows.Handle, actionId *windows.GUID, data *WinTrustData) (err error) { + r1, _, e1 := syscall.Syscall(procWinVerifyTrust.Addr(), 3, uintptr(hWnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) + if r1 != 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} |