From 6f66c7697d3bb6a259bf8d0261490cdee0ef8986 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 16 Sep 2019 23:36:49 -0600 Subject: global: use SECURITY_DESCRIPTOR apis from x/sys/windows Signed-off-by: Jason A. Donenfeld --- main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'main.go') 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) } -- cgit v1.2.3-59-g8ed1b