Skip to content

Commit

Permalink
Refresh keeps the current key and Export chooses REG extension by def…
Browse files Browse the repository at this point in the history
…ault

fixed a bug when jumping to a key from the list of handles
  • Loading branch information
BeneficialCode committed Mar 6, 2024
1 parent a9fac03 commit 303b813
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion WinArk/ExportDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LRESULT CExportDlg::OnCloseCmd(WORD, WORD wID, HWND, BOOL&) {
}

LRESULT CExportDlg::OnBrowse(WORD, WORD wID, HWND, BOOL&) {
CSimpleFileDialog dlg(FALSE, nullptr, nullptr,
CSimpleFileDialog dlg(FALSE, L"Reg", nullptr,
OFN_EXPLORER | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY,
L"Reg format (*reg)\0*.reg\0Native Format\0*.*\0", m_hWnd);
if (dlg.DoModal() == IDOK) {
Expand Down
35 changes: 31 additions & 4 deletions WinArk/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,28 @@ CTreeItem CRegistryManagerView::InsertKeyItem(HTREEITEM hParent, PCWSTR name, No
HTREEITEM CRegistryManagerView::BuildKeyPath(const CString& path, bool accessible) {
auto hItem = path[0] == L'\\' ? m_hRealReg : m_hStdReg;
CString name;
int start = path[0] == L'\\' ? 10 : 0;

int start = path[0] == L'\\' ? 9 : 0;

if (path.Left(2) == L"\\\\") {
// remote Registry
start = path.Find(L"\\", 2);
auto remoteName = path.Mid(2, start - 2);
hItem = m_Tree.GetRootItem().GetNextSibling();

while (hItem) {
CString text;
m_Tree.GetItemText(hItem, text);
if (text.CompareNoCase(remoteName) == 0)
break;

hItem = m_Tree.GetNextSiblingItem(hItem);
}

if (!hItem)
return nullptr;
}

TreeHelper th(m_Tree);
while (!(name = path.Tokenize(L"\\", start)).IsEmpty()) {
auto hChild = th.FindChild(hItem, name);
Expand Down Expand Up @@ -1110,9 +1131,15 @@ void CRegistryManagerView::RefreshFull(HTREEITEM hItem) {
}

LRESULT CRegistryManagerView::OnViewRefresh(WORD, WORD, HWND, BOOL&) {
RefreshFull(m_hStdReg);
RefreshFull(m_hRealReg);
UpdateList();
auto path = GetCurrentKeyPath();
TreeHelper th(m_Tree);
th.DoForEachItem(m_hStdReg, 0, [this](auto hItem, auto state) {
RefreshItem(hItem);
});
th.DoForEachItem(m_hRealReg, 0, [this](auto hItem, auto state) {
RefreshItem(hItem);
});
GotoKey(path);
return 0;
}

Expand Down

0 comments on commit 303b813

Please sign in to comment.