Files
agent-lib/internal/client/programdata_windows.go
T

16 lines
521 B
Go
Raw Normal View History

//go:build windows
package client
import "golang.org/x/sys/windows"
// programDataDir resolves the ProgramData known folder through the shell
// API instead of the ProgramData environment variable: the variable is
// user-controlled, and the admin config pins labels — a user must not be
// able to point the admin lookup at a folder of their own.
func programDataDir() string {
if p, err := windows.KnownFolderPath(windows.FOLDERID_ProgramData, 0); err == nil && p != "" {
return p
}
return `C:\ProgramData`
}