1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Windows environment variables.
14 func Getenv(key string) (value string, found bool) {
15 return syscall.Getenv(key)
18 func Setenv(key, value string) error {
19 return syscall.Setenv(key, value)
26 func Environ() []string {
27 return syscall.Environ()
30 // Returns a default environment associated with the token, rather than the current
31 // process. If inheritExisting is true, then this environment also inherits the
32 // environment of the current process.
33 func (token Token) Environ(inheritExisting bool) (env []string, err error) {
35 err = CreateEnvironmentBlock(&block, token, inheritExisting)
39 defer DestroyEnvironmentBlock(block)
40 blockp := uintptr(unsafe.Pointer(block))
42 entry := UTF16PtrToString((*uint16)(unsafe.Pointer(blockp)))
46 env = append(env, entry)
47 blockp += 2 * (uintptr(len(entry)) + 1)
52 func Unsetenv(key string) error {
53 return syscall.Unsetenv(key)