MCPcopy Create free account
hub / github.com/DFIR-ORC/dfir-orc / PrintConfig

Method PrintConfig

src/OrcLib/Configuration/ConfigFile.cpp:359–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359HRESULT ConfigFile::PrintConfig(const ConfigItem& config, DWORD dwIndent)
360{
361 const auto MAX_INDENT = 20;
362
363 WCHAR szIndent[MAX_INDENT];
364 if (dwIndent >= MAX_INDENT)
365 return E_INVALIDARG;
366 wmemset(szIndent, L'\t', MAX_INDENT);
367 szIndent[dwIndent] = L'\0';
368
369 switch (config.Type)
370 {
371 case ConfigItem::NODE:
372 Log::Info(
373 L"{}NODE: \"{}\" {} {}",
374 szIndent,
375 config.strName,
376 (config.Flags & ConfigItem::MANDATORY) ? L"Mandatory" : L"Optional",
377 config ? L"Present" : L"Absent");
378 if (!config.empty())
379 Log::Info(L"{}\tDATA: \"{}\" ", szIndent, config.c_str());
380
381 std::for_each(begin(config.SubItems), end(config.SubItems), [dwIndent](const ConfigItem& item) {
382 PrintConfig(item, dwIndent + 1);
383 });
384 break;
385
386 case ConfigItem::ATTRIBUTE:
387 Log::Info(
388 L"{}ATTRIBUTE: \"{}={}\" {} {}",
389 szIndent,
390 config.strName,
391 config.c_str(),
392 (config.Flags & ConfigItem::MANDATORY) ? L"Mandatory" : L"Optional",
393 config ? L"Present" : L"Absent");
394 break;
395 case ConfigItem::NODELIST: {
396 Log::Info(
397 L"{}NODES: \"{}\" {} {}",
398 szIndent,
399 config.strName,
400 (config.Flags & ConfigItem::MANDATORY) ? L"Mandatory" : L"Optional",
401 config ? L"Present" : L"Absent");
402
403 std::for_each(begin(config.NodeList), end(config.NodeList), [dwIndent](const ConfigItem& item) {
404 PrintConfig(item, dwIndent + 1);
405 });
406 }
407 break;
408 }
409
410 return S_OK;
411}
412
413HRESULT ConfigFile::SetOutputSpec(ConfigItem& item, const OutputSpec& outputSpec)
414{

Callers 1

PrintAutoRunsMethod · 0.80

Calls 3

c_strMethod · 0.80
InfoFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected