diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-10 13:09:07 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-10 17:35:01 +0100 |
commit | fd98538d797cb0db75bb75da3f8a77ea0905d697 (patch) | |
tree | 7e05dde7768e13e968c2a65063b474d5177e6260 | |
parent | installer: suppress ice03 errors (diff) | |
download | wireguard-windows-fd98538d797cb0db75bb75da3f8a77ea0905d697.tar.xz wireguard-windows-fd98538d797cb0db75bb75da3f8a77ea0905d697.zip |
main: re-introduce WoW64 check, but only for !arm
This reverts commit 3098562a6b62d039acd5999a5af29e2b5472dded.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | main.go | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -9,6 +9,7 @@ import ( "fmt" "log" "os" + "runtime" "strconv" "strings" "time" @@ -60,6 +61,20 @@ func usage() { os.Exit(1) } +func checkForWow64() { + if runtime.GOARCH == "arm" { //TODO: remove this exception when Go supports arm64 + return + } + var b bool + err := windows.IsWow64Process(windows.CurrentProcess(), &b) + if err != nil { + fatalf("Unable to determine whether the process is running under WOW64: %v", err) + } + if b { + fatalf("You must use the 64-bit version of WireGuard on this computer.") + } +} + func checkForAdminGroup() { // This is not a security check, but rather a user-confusion one. var processToken windows.Token @@ -102,6 +117,8 @@ func pipeFromHandleArgument(handleStr string) (*os.File, error) { } func main() { + checkForWow64() + if len(os.Args) <= 1 { checkForAdminGroup() if ui.RaiseUI() { |