blob: 45b53be5e8b16cf377acaeb628831b43170ba904 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2019-2020 WireGuard LLC. All Rights Reserved.
*/
package updater
import (
"debug/pe"
"errors"
"golang.org/x/sys/windows"
)
func findArch() (string, error) {
var processMachine, nativeMachine uint16
err := windows.IsWow64Process2(windows.CurrentProcess(), &processMachine, &nativeMachine)
if err != nil {
return "", err
}
switch nativeMachine {
case pe.IMAGE_FILE_MACHINE_ARM64:
return "arm64", nil
case pe.IMAGE_FILE_MACHINE_ARMNT:
return "arm", nil
}
return "", errors.New("Invalid GOARCH")
}
|