| 40 | // |
| 41 | // |
| 42 | void 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); |
nothing calls this directly
no test coverage detected