MCPcopy Create free account
hub / github.com/chrxh/alien / getOrCreateAlienRegKey

Function getOrCreateAlienRegKey

source/Base/GlobalSettings.cpp:36–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 }
35
36 winreg::RegKey getOrCreateAlienRegKey()
37 {
38 const std::wstring testSubKey = L"SOFTWARE\\alien";
39 winreg::RegKey key{HKEY_CURRENT_USER, testSubKey};
40 if (key.TryOpen(HKEY_CURRENT_USER, testSubKey)) {
41 return key;
42 } else {
43 auto result = key.TryCreate(HKEY_CURRENT_USER, testSubKey);
44 if (result.IsOk()) {
45 if (key.TryOpen(HKEY_CURRENT_USER, testSubKey)) {
46 return key;
47 }
48 }
49 }
50 throw std::runtime_error("Could not open a registry key.");
51 }
52
53 std::string getStringFromWinReg(std::string const& name, std::string const& defaultValue)
54 {

Callers 4

getStringFromWinRegFunction · 0.85
setStringToWinRegFunction · 0.85
getIntFromWinRegFunction · 0.85
setIntToWinRegFunction · 0.85

Calls 3

TryOpenMethod · 0.80
TryCreateMethod · 0.80
IsOkMethod · 0.80

Tested by

no test coverage detected