| 1329 | } |
| 1330 | |
| 1331 | LRESULT CRegistryManagerView::OnKeyPermissions(WORD, WORD, HWND, BOOL&){ |
| 1332 | auto path = GetFullNodePath(m_Tree.GetSelectedItem()); |
| 1333 | SecurityHelper::EnablePrivilege(SE_TAKE_OWNERSHIP_NAME, true); |
| 1334 | if (::GetFocus() == m_List) { |
| 1335 | auto& item = m_Items[m_List.GetSelectionMark()]; |
| 1336 | ATLASSERT(item.Key); |
| 1337 | path += L"\\" + item.Name; |
| 1338 | } |
| 1339 | auto readonly = m_ReadOnly; |
| 1340 | auto key = Registry::OpenKey(path, READ_CONTROL | (readonly ? 0 : (WRITE_DAC | WRITE_OWNER))); |
| 1341 | if (!key && ::GetLastError() == ERROR_ACCESS_DENIED) { |
| 1342 | key = Registry::OpenKey(path, READ_CONTROL); |
| 1343 | readonly = true; |
| 1344 | } |
| 1345 | if (!key && ::GetLastError() == ERROR_ACCESS_DENIED) { |
| 1346 | key = Registry::OpenKey(path, MAXIMUM_ALLOWED); |
| 1347 | } |
| 1348 | if (!key) { |
| 1349 | DisplayError(L"Failed to open key"); |
| 1350 | } |
| 1351 | else { |
| 1352 | CSecurityInformation si(key, path, readonly); |
| 1353 | ::EditSecurity(m_hWnd, &si); |
| 1354 | } |
| 1355 | SecurityHelper::EnablePrivilege(SE_TAKE_OWNERSHIP_NAME, false); |
| 1356 | return 0; |
| 1357 | } |
| 1358 | |
| 1359 | LRESULT CRegistryManagerView::OnProperties(WORD, WORD, HWND, BOOL&){ |
| 1360 | if (::GetFocus() == m_List) { |
nothing calls this directly
no test coverage detected