MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / finalConstruct

Method finalConstruct

edrav2/iprj/libsysmon/src/controller.cpp:42–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40//
41//
42void SystemMonitorController::finalConstruct(Variant vConfig)
43{
44 CHECK_IN_SOURCE_LOCATION();
45 m_fStopDriverOnShutdown = vConfig.get("stopDriverOnShutdown", m_fStopDriverOnShutdown);
46 m_nThreadsCount = vConfig.get("threadsCount", c_nTreadsCount);
47 m_eInjection = vConfig.get("injectNewProcesses", InjectionMode::None);
48 m_vDefaultDriverConfig = vConfig.get("driverConfig", Dictionary());
49 m_vSelfProtectConfig = vConfig.get("selfprotectConfig", Variant());
50 m_sStartMode = vConfig.get("startMode", m_sStartMode);
51 m_pReceiver = queryInterfaceSafe<IDataReceiver>(vConfig.get("receiver", nullptr));
52
53 CHECK_IN_SOURCE_LOCATION();
54 if (m_eInjection == InjectionMode::Driver)
55 {
56 m_vDefaultDriverConfig.put("enableDllInject", true);
57 Sequence sqDllName;
58#ifdef _WIN64
59 std::wstring sSystemDir(getCatalogData("os.systemDir"));
60 std::wstring sSyswowDir(getCatalogData("os.syswowDir"));
61 if (std::filesystem::exists(sSystemDir + L"\\" + c_sInjDll64) &&
62 std::filesystem::exists(sSyswowDir + L"\\" + c_sInjDll32))
63 {
64 sqDllName.push_back(sSystemDir + L"\\" + c_sInjDll64);
65 sqDllName.push_back(sSyswowDir + L"\\" + c_sInjDll32);
66 }
67 else
68 {
69#if defined(FEATURE_ENABLE_MADCHOOK)
70 LOGWRN("Injection DLLs not found in system directory. Use default directory.");
71 std::wstring sImageDir(getCatalogData("app.imagePath"));
72 sqDllName.push_back(sImageDir + L"\\" + c_sInjDll64);
73 sqDllName.push_back(sImageDir + L"\\" + c_sInjDll32);
74#else
75 LOGWRN("Injection DLLs not found in system directory.");
76#endif
77 }
78#else
79 std::wstring sSystemDir(getCatalogData("os.systemDir"));
80 if (std::filesystem::exists(sSystemDir + L"\\" + c_sInjDll32))
81 {
82 sqDllName.push_back(sSystemDir + L"\\" + c_sInjDll32);
83 }
84 else
85 {
86 LOGWRN("Injection DLLs not found in system directory. Use default directory.");
87 std::wstring sImageDir(getCatalogData("app.imagePath"));
88 sqDllName.push_back(sImageDir + L"\\" + c_sInjDll32);
89 }
90#endif
91 m_vDefaultDriverConfig.put("injectedDll", sqDllName);
92 }
93 else
94 m_vDefaultDriverConfig.put("enableDllInject", false);
95
96 CHECK_IN_SOURCE_LOCATION();
97
98 TRACE_BEGIN
99 m_vEventSchema = variant::deserializeFromJson(edrdrv::c_sEventSchema);

Callers

nothing calls this directly

Calls 8

getCatalogDataFunction · 0.85
existsFunction · 0.85
deserializeFromJsonFunction · 0.85
DictionaryClass · 0.50
VariantClass · 0.50
getMethod · 0.45
putMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected