aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/updater/versions_arm.go
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2020-11-09 15:38:10 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-13 14:42:54 +0100
commit22647958aee9828ecdd16f09e3a1bdf6b606578f (patch)
tree40dea82c966d1e33fe35b57cf653bf2c66ece234 /updater/versions_arm.go
parentbuild: make arm64 binary by copying arm binary (diff)
downloadwireguard-windows-22647958aee9828ecdd16f09e3a1bdf6b606578f.tar.xz
wireguard-windows-22647958aee9828ecdd16f09e3a1bdf6b606578f.zip
installer: updater: introduce ARM64 MSI packages
Windows 10 ARM64 refuses to install ARM MSI. Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'updater/versions_arm.go')
-rw-r--r--updater/versions_arm.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/updater/versions_arm.go b/updater/versions_arm.go
new file mode 100644
index 00000000..2ffb4b74
--- /dev/null
+++ b/updater/versions_arm.go
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2019-2020 WireGuard LLC. All Rights Reserved.
+ */
+
+package updater
+
+import (
+ "errors"
+
+ "golang.org/x/sys/windows"
+)
+
+func findArch() (arch string, err error) {
+ process := windows.CurrentProcess()
+ _, nativeMachine, err2 := isWow64Process2(process)
+ if err2 != nil {
+ var isWow64 bool
+ if windows.IsWow64Process(process, &isWow64) != nil || !isWow64 {
+ nativeMachine = IMAGE_FILE_MACHINE_ARMNT
+ } else {
+ nativeMachine = IMAGE_FILE_MACHINE_ARM64
+ }
+ }
+ switch nativeMachine {
+ case IMAGE_FILE_MACHINE_ARM64:
+ arch = "arm64"
+ case IMAGE_FILE_MACHINE_ARMNT:
+ arch = "arm"
+ default:
+ err = errors.New("Invalid GOARCH")
+ }
+ return
+}