Helper methods. Get root key name (LOCAL_MACHINE vs. LOCAL_USER).
(rootKey registry.Key)
| 244 | // Helper methods. |
| 245 | // Get root key name (LOCAL_MACHINE vs. LOCAL_USER). |
| 246 | func 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). |
| 271 | func getRootKeyFromName(rootKeyName string) (rootKey registry.Key, err error) { |
no outgoing calls
no test coverage detected