aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-09-16 23:36:49 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2019-09-23 15:29:18 +0200
commit5878d9a6b2251e5a0c464cb427a5eac7d1ada6e5 (patch)
tree1f123998f801c375674326ba7946da568be32df0 /main.go
parentupdater: use correct length for security attributes (diff)
downloadwireguard-windows-5878d9a6b2251e5a0c464cb427a5eac7d1ada6e5.tar.xz
wireguard-windows-5878d9a6b2251e5a0c464cb427a5eac7d1ada6e5.zip
global: use SECURITY_DESCRIPTOR apis from x/sys/windows
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/main.go b/main.go
index 8d33b09f..d14b1cd5 100644
--- a/main.go
+++ b/main.go
@@ -57,11 +57,7 @@ func usage() {
func checkForWow64() {
var b bool
- p, err := windows.GetCurrentProcess()
- if err != nil {
- fatal(err)
- }
- err = windows.IsWow64Process(p, &b)
+ err := windows.IsWow64Process(windows.GetCurrentProcess(), &b)
if err != nil {
fatalf("Unable to determine whether the process is running under WOW64: %v", err)
}
@@ -72,7 +68,8 @@ func checkForWow64() {
func checkForAdminGroup() {
// This is not a security check, but rather a user-confusion one.
- processToken, err := windows.OpenCurrentProcessToken()
+ var processToken windows.Token
+ err := windows.OpenProcessToken(windows.GetCurrentProcess(), windows.TOKEN_QUERY|windows.TOKEN_DUPLICATE, &processToken)
if err != nil {
fatalf("Unable to open current process token: %v", err)
}