aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service/securityapi.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-13 09:01:49 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-13 13:28:00 +0200
commit11eca3ec39277009dd1d9730bc8c55c0cd77ba94 (patch)
tree710f0442ce9e89bc7832c9db56bfa8cdef00bb64 /service/securityapi.go
parentui: lock runtime thread as early as possible (diff)
downloadwireguard-windows-11eca3ec39277009dd1d9730bc8c55c0cd77ba94.tar.xz
wireguard-windows-11eca3ec39277009dd1d9730bc8c55c0cd77ba94.zip
service: allow go to create correct environment block
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--service/securityapi.go29
1 files changed, 0 insertions, 29 deletions
diff --git a/service/securityapi.go b/service/securityapi.go
index 37713b32..d89d9404 100644
--- a/service/securityapi.go
+++ b/service/securityapi.go
@@ -9,7 +9,6 @@ import (
"errors"
"golang.org/x/sys/windows"
"runtime"
- "unicode/utf16"
"unsafe"
)
@@ -53,34 +52,6 @@ const (
SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010
)
-//sys createEnvironmentBlock(block *uintptr, token windows.Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock
-//sys destroyEnvironmentBlock(block uintptr) (err error) = userenv.DestroyEnvironmentBlock
-
-func userEnviron(token windows.Token) (env []string, err error) {
- var block uintptr
- err = createEnvironmentBlock(&block, token, false)
- if err != nil {
- return
- }
- offset := uintptr(0)
- for {
- entry := (*[(1 << 30) - 1]uint16)(unsafe.Pointer(block + offset))[:]
- for i, v := range entry {
- if v == 0 {
- entry = entry[:i]
- break
- }
- }
- if len(entry) == 0 {
- break
- }
- env = append(env, string(utf16.Decode(entry)))
- offset += 2 * (uintptr(len(entry)) + 1)
- }
- destroyEnvironmentBlock(block)
- return
-}
-
func tokenIsElevated(token windows.Token) bool {
var isElevated uint32
var outLen uint32