winutil: refactor methods to get values from registry to also return (#9536)

errors
Updates tailscale/corp#14879

Signed-off-by: Claire Wang <claire@tailscale.com>
This commit is contained in:
Claire Wang
2023-09-26 13:15:11 -04:00
committed by GitHub
parent c608660d12
commit e3d6236606
9 changed files with 80 additions and 58 deletions

View File

@@ -6,6 +6,7 @@
package winutil
import (
"errors"
"fmt"
"os/user"
"runtime"
@@ -13,13 +14,15 @@ import (
const regBase = ``
func getPolicyString(name, defval string) string { return defval }
var ErrNoValue = errors.New("no value because registry is unavailable on this OS")
func getPolicyInteger(name string, defval uint64) uint64 { return defval }
func getPolicyString(name string) (string, error) { return "", ErrNoValue }
func getRegString(name, defval string) string { return defval }
func getPolicyInteger(name string) (uint64, error) { return 0, ErrNoValue }
func getRegInteger(name string, defval uint64) uint64 { return defval }
func getRegString(name string) (string, error) { return "", ErrNoValue }
func getRegInteger(name string) (uint64, error) { return 0, ErrNoValue }
func isSIDValidPrincipal(uid string) bool { return false }