| 9 | } |
| 10 | |
| 11 | void CEventsDlg::BuildEventsTree(const EventsConfiguration& config) { |
| 12 | m_Tree.LockWindowUpdate(TRUE); |
| 13 | |
| 14 | m_Tree.DeleteAllItems(); |
| 15 | for (auto& category : KernelEventCategory::GetAllCategories()) { |
| 16 | if (category.Advanced == m_Advanced) { |
| 17 | int image = CEtwView::GetImageFromEventName(category.Name.c_str()); |
| 18 | auto item = m_Tree.InsertItem(category.Name.c_str(), image, image, TVI_ROOT, TVI_LAST); |
| 19 | if (m_Advanced && !category.Advanced) |
| 20 | item.SetState(TVIS_BOLD, TVIS_BOLD); |
| 21 | |
| 22 | item.SetData((DWORD_PTR)&category); |
| 23 | auto cat = config.GetCategory(category.Name.c_str()); |
| 24 | for (auto& evt : category.Events) { |
| 25 | image = CEtwView::GetImageFromEventName(evt.Name.c_str()); |
| 26 | auto child = item.InsertAfter(evt.Name.c_str(), TVI_LAST, image); |
| 27 | child.SetData((DWORD_PTR)&evt); |
| 28 | if (cat && cat->Contains(evt.Opcode)) |
| 29 | m_Tree.SetCheckState(child, TRUE); |
| 30 | } |
| 31 | if (cat) { |
| 32 | if (cat->Opcodes.empty()) { |
| 33 | // all events must be checked |
| 34 | CheckTreeChildren(item, TRUE); |
| 35 | m_Tree.SetCheckState(item, TRUE); |
| 36 | } |
| 37 | else { |
| 38 | item.Expand(TVE_EXPAND); |
| 39 | } |
| 40 | } |
| 41 | item.SortChildren(FALSE); |
| 42 | } |
| 43 | } |
| 44 | m_Tree.SortChildren(TVI_ROOT, FALSE); |
| 45 | m_Tree.LockWindowUpdate(FALSE); |
| 46 | } |
| 47 | |
| 48 | LRESULT CEventsDlg::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) { |
| 49 | DlgResize_Init(true); |
nothing calls this directly
no test coverage detected