| 565 | } |
| 566 | |
| 567 | void CRegistryManagerView::UpdateList(bool force) { |
| 568 | m_Items.clear(); |
| 569 | m_List.SetItemCount(0); |
| 570 | |
| 571 | auto hItem = m_Tree.GetSelectedItem(); |
| 572 | m_CurrentPath = GetFullNodePath(hItem); |
| 573 | auto& path = m_CurrentPath; |
| 574 | |
| 575 | m_AddressBar.SetWindowText(path); |
| 576 | |
| 577 | m_CurrentKey.Close(); |
| 578 | |
| 579 | if (hItem == m_hLocalRoot) |
| 580 | return; |
| 581 | |
| 582 | if (hItem == m_hRealReg) |
| 583 | m_CurrentKey.Attach(Registry::OpenRealRegistryKey()); |
| 584 | |
| 585 | if (AppSettings::Get().ShowKeysInList() && (hItem == m_hStdReg || hItem == m_hRealReg || |
| 586 | (GetNodeData(hItem) & NodeType::RemoteRegistry) == NodeType::RemoteRegistry)) { |
| 587 | // special case for root of registry |
| 588 | for (hItem = m_Tree.GetChildItem(hItem); hItem; hItem = m_Tree.GetNextSiblingItem(hItem)) { |
| 589 | RegistryItem item; |
| 590 | CString name; |
| 591 | m_Tree.GetItemText(hItem, name); |
| 592 | item.Name = name; |
| 593 | if (m_CurrentPath[0] == L'\\') |
| 594 | name = m_CurrentPath + L"\\" + name; |
| 595 | auto key = Registry::OpenKey(name, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS); |
| 596 | if (key) { |
| 597 | Registry::GetSubKeyCount(key.Get(), nullptr, &item.TimeStamp); |
| 598 | } |
| 599 | item.Key = true; |
| 600 | item.Type = REG_KEY; |
| 601 | m_Items.push_back(std::move(item)); |
| 602 | } |
| 603 | m_List.SetItemCount(static_cast<int>(m_Items.size())); |
| 604 | DoSort(GetSortInfo(m_List)); |
| 605 | |
| 606 | return; |
| 607 | } |
| 608 | |
| 609 | if (!m_CurrentPath.IsEmpty()) { |
| 610 | m_CurrentKey = Registry::OpenKey(m_CurrentPath, |
| 611 | KEY_QUERY_VALUE | (AppSettings::Get().ShowKeysInList() ? KEY_ENUMERATE_SUB_KEYS : 0)); |
| 612 | ATLASSERT(m_CurrentKey.IsValid()); |
| 613 | } |
| 614 | |
| 615 | if (AppSettings::Get().ShowKeysInList()) { |
| 616 | // insert up directory |
| 617 | RegistryItem up; |
| 618 | up.Name = L".."; |
| 619 | up.Type = REG_KEY_UP; |
| 620 | up.Key = true; |
| 621 | m_Items.push_back(up); |
| 622 | |
| 623 | if (m_CurrentKey) { |
| 624 | Registry::EnumSubKeys(m_CurrentKey.Get(), [&](auto name, const auto& ft) { |