Skip to content

Commit fd98538

Browse files
committed
main: re-introduce WoW64 check, but only for !arm
This reverts commit 3098562. Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent c49d86a commit fd98538

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

main.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"fmt"
1010
"log"
1111
"os"
12+
"runtime"
1213
"strconv"
1314
"strings"
1415
"time"
@@ -60,6 +61,20 @@ func usage() {
6061
os.Exit(1)
6162
}
6263

64+
func checkForWow64() {
65+
if runtime.GOARCH == "arm" { //TODO: remove this exception when Go supports arm64
66+
return
67+
}
68+
var b bool
69+
err := windows.IsWow64Process(windows.CurrentProcess(), &b)
70+
if err != nil {
71+
fatalf("Unable to determine whether the process is running under WOW64: %v", err)
72+
}
73+
if b {
74+
fatalf("You must use the 64-bit version of WireGuard on this computer.")
75+
}
76+
}
77+
6378
func checkForAdminGroup() {
6479
// This is not a security check, but rather a user-confusion one.
6580
var processToken windows.Token
@@ -102,6 +117,8 @@ func pipeFromHandleArgument(handleStr string) (*os.File, error) {
102117
}
103118

104119
func main() {
120+
checkForWow64()
121+
105122
if len(os.Args) <= 1 {
106123
checkForAdminGroup()
107124
if ui.RaiseUI() {

0 commit comments

Comments
 (0)