MCPcopy
hub / github.com/hardentools/hardentools / getRootKeyName

Function getRootKeyName

registry_utils.go:246–268  ·  view source on GitHub ↗

Helper methods. Get root key name (LOCAL_MACHINE vs. LOCAL_USER).

(rootKey registry.Key)

Source from the content-addressed store, hash-verified

244// Helper methods.
245// Get root key name (LOCAL_MACHINE vs. LOCAL_USER).
246func getRootKeyName(rootKey registry.Key) (rootKeyName string, err error) {
247 // this is kind of a hack, since registry.Key doesn't allow to get the
248 // name of the key itself
249 switch rootKey {
250 case registry.CLASSES_ROOT:
251 rootKeyName = "CLASSES_ROOT"
252 case registry.CURRENT_USER:
253 rootKeyName = "CURRENT_USER"
254 case registry.LOCAL_MACHINE:
255 rootKeyName = "LOCAL_MACHINE"
256 case registry.USERS:
257 rootKeyName = "USERS"
258 case registry.CURRENT_CONFIG:
259 rootKeyName = "CURRENT_CONFIG"
260 case registry.PERFORMANCE_DATA:
261 rootKeyName = "PERFORMANCE_DATA"
262 default:
263 // invalid rootKey?
264 Info.Println("Invalid rootKey provided to save registry function")
265 err = errors.New("Invalid rootKey provided to save registry function")
266 }
267 return
268}
269
270// Get root key from name (LOCAL_MACHINE vs. LOCAL_USER).
271func getRootKeyFromName(rootKeyName string) (rootKey registry.Key, err error) {

Callers 5

hardenKeyFunction · 0.85
hardenKeySZFunction · 0.85
saveOriginalRegistrySZFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected