aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/version
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2020-11-09 09:06:02 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-13 14:42:54 +0100
commitfb16154211fe0de97f642da5ce68e783a4c046c1 (patch)
treedab127ed85ab34691b3ab3cf7057fb8f61dce186 /version
parentbuild: filter out .deps from recursive wildcard (diff)
downloadwireguard-windows-fb16154211fe0de97f642da5ce68e783a4c046c1.tar.xz
wireguard-windows-fb16154211fe0de97f642da5ce68e783a4c046c1.zip
global: go generate
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'version')
-rw-r--r--version/wintrust/zsyscall_windows.go31
1 files changed, 12 insertions, 19 deletions
diff --git a/version/wintrust/zsyscall_windows.go b/version/wintrust/zsyscall_windows.go
index 4d73cc5e..69d42775 100644
--- a/version/wintrust/zsyscall_windows.go
+++ b/version/wintrust/zsyscall_windows.go
@@ -19,6 +19,7 @@ const (
var (
errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
+ errERROR_EINVAL error = syscall.EINVAL
)
// errnoErr returns common boxed Errno values, to prevent
@@ -26,7 +27,7 @@ var (
func errnoErr(e syscall.Errno) error {
switch e {
case 0:
- return nil
+ return errERROR_EINVAL
case errnoERROR_IO_PENDING:
return errERROR_IO_PENDING
}
@@ -37,33 +38,25 @@ func errnoErr(e syscall.Errno) error {
}
var (
- modwintrust = windows.NewLazySystemDLL("wintrust.dll")
modcrypt32 = windows.NewLazySystemDLL("crypt32.dll")
+ modwintrust = windows.NewLazySystemDLL("wintrust.dll")
- procWinVerifyTrust = modwintrust.NewProc("WinVerifyTrust")
procCryptQueryObject = modcrypt32.NewProc("CryptQueryObject")
+ 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
- }
+func cryptQueryObject(objectType uint32, object uintptr, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *windows.Handle, msg *windows.Handle, context *uintptr) (err error) {
+ r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
}
return
}
-func cryptQueryObject(objectType uint32, object uintptr, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *windows.Handle, msg *windows.Handle, context *uintptr) (err error) {
- r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0)
- if r1 == 0 {
- if e1 != 0 {
- err = errnoErr(e1)
- } else {
- err = syscall.EINVAL
- }
+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 {
+ err = errnoErr(e1)
}
return
}