MCPcopy Create free account
hub / github.com/246859/AutoToolBox / OpenOrCreateKey

Function OpenOrCreateKey

toolbox/helper.go:59–68  ·  view source on GitHub ↗

OpenOrCreateKey open a registry key, create it if it doesn't exist.

(key registry.Key, path string, access uint32)

Source from the content-addressed store, hash-verified

57
58// OpenOrCreateKey open a registry key, create it if it doesn't exist.
59func OpenOrCreateKey(key registry.Key, path string, access uint32) (registry.Key, error) {
60 newk, existing, err := registry.CreateKey(key, path, access)
61 if err != nil {
62 return 0, err
63 }
64 if existing {
65 return registry.OpenKey(key, path, access)
66 }
67 return newk, nil
68}
69
70// DeleteKey delete a registry key and its sub keys.
71func DeleteKey(key registry.Key, path string) error {

Callers 2

SetMenuItemFunction · 0.85
SetItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected