markStatus sets hardentools status registry key (that tells if user environment is hardened / not hardened).
(hardened bool)
| 137 | // markStatus sets hardentools status registry key |
| 138 | // (that tells if user environment is hardened / not hardened). |
| 139 | func markStatus(hardened bool) { |
| 140 | |
| 141 | if hardened { |
| 142 | key, _, err := registry.CreateKey(registry.CURRENT_USER, |
| 143 | hardentoolsKeyPath, registry.ALL_ACCESS) |
| 144 | if err != nil { |
| 145 | Info.Println(err.Error()) |
| 146 | panic(err) |
| 147 | } |
| 148 | defer key.Close() |
| 149 | |
| 150 | // Set value that states that we have hardened the system. |
| 151 | err = key.SetDWordValue("Harden", 1) |
| 152 | if err != nil { |
| 153 | Info.Println(err.Error()) |
| 154 | showErrorDialog("Could not set hardentools registry keys - restore will not work!") |
| 155 | panic(err) |
| 156 | } |
| 157 | } else { |
| 158 | // On restore delete all hardentools registry keys afterwards. |
| 159 | err := registry.DeleteKey(registry.CURRENT_USER, hardentoolsKeyPath) |
| 160 | if err != nil { |
| 161 | Info.Println(err.Error()) |
| 162 | ShowFailure("Remove hardentools registry keys", "Could not remove") |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | // triggerAll is used for harden and restore, depending on the harden parameter. |
| 168 | // harden == true => harden |
no test coverage detected