From e42c6c4bc2d0d1e6b4f247b98cf4ead8a1b08a2e Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Tue, 26 Oct 2021 14:51:44 +0200
Subject: [PATCH] wintun: align 64-bit argument on ARM32

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 tun/wintun/wintun_windows.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go
index b3aa6e9..2fe26a7 100644
--- a/tun/wintun/wintun_windows.go
+++ b/tun/wintun/wintun_windows.go
@@ -53,10 +53,14 @@ func logMessage(level loggerLevel, timestamp uint64, msg *uint16) int {
 
 func setupLogger(dll *lazyDLL) {
 	var callback uintptr
-	if runtime.GOARCH == "386" || runtime.GOARCH == "arm" {
+	if runtime.GOARCH == "386" {
 		callback = windows.NewCallback(func(level loggerLevel, timestampLow, timestampHigh uint32, msg *uint16) int {
 			return logMessage(level, uint64(timestampHigh)<<32|uint64(timestampLow), msg)
 		})
+	} else if runtime.GOARCH == "arm" {
+		callback = windows.NewCallback(func(level loggerLevel, _, timestampLow, timestampHigh uint32, msg *uint16) int {
+			return logMessage(level, uint64(timestampHigh)<<32|uint64(timestampLow), msg)
+		})
 	} else if runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64" {
 		callback = windows.NewCallback(logMessage)
 	}