MCPcopy Create free account
hub / github.com/codeyourweb/irma / EnumRegHivePersistence

Function EnumRegHivePersistence

windowsregistry.go:89–125  ·  view source on GitHub ↗

EnumRegHivePersistence parse the specified key and subkey and return all string key/value in a []RegistryValue

(key registry.Key, subkey string)

Source from the content-addressed store, hash-verified

87
88// EnumRegHivePersistence parse the specified key and subkey and return all string key/value in a []RegistryValue
89func EnumRegHivePersistence(key registry.Key, subkey string) (values []RegistryValue, err error) {
90 k, err := registry.OpenKey(key, "", registry.READ)
91 if err != nil {
92 return nil, err
93 }
94 defer k.Close()
95
96 subkeys, err := k.ReadSubKeyNames(0)
97 if err != nil {
98 return nil, err
99 }
100
101 if key == registry.USERS {
102 for _, s := range subkeys {
103 if len(s) > 10 && !strings.HasSuffix(s, "_Classes") {
104 v, err := enumRegSubKey(key, s+`\`+subkey)
105 if err != nil {
106 return nil, err
107 }
108 for _, item := range v {
109 values = append(values, item)
110 }
111
112 }
113 }
114 } else {
115 v, err := enumRegSubKey(key, subkey)
116 if err != nil {
117 return nil, err
118 }
119 for _, item := range v {
120 values = append(values, item)
121 }
122 }
123
124 return values, nil
125}
126
127// enumRegSubKey format subkey values in []RegistryValue
128func enumRegSubKey(key registry.Key, subkey string) (values []RegistryValue, err error) {

Callers 1

EnumRegistryPeristenceFunction · 0.85

Calls 1

enumRegSubKeyFunction · 0.85

Tested by

no test coverage detected