MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / OnImport

Method OnImport

WinArk/View.cpp:1492–1516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1490}
1491
1492LRESULT CRegistryManagerView::OnImport(WORD, WORD, HWND, BOOL&) {
1493 if (!SecurityHelper::EnablePrivilege(SE_BACKUP_NAME, true) ||
1494 !SecurityHelper::EnablePrivilege(SE_RESTORE_NAME, true)) {
1495 AtlMessageBox(m_hWnd, L"Exporting, importing, and loading hives require the Backup/Restore privileges. \
1496 Running elevated will allow it.", IDS_TITLE, MB_ICONERROR);
1497 return 0;
1498 }
1499
1500 CSimpleFileDialog dlg(TRUE, L"dat", nullptr, OFN_FILEMUSTEXIST | OFN_ENABLESIZING | OFN_EXPLORER,
1501 L"All Files\0*.*\0", m_hWnd);
1502 if (dlg.DoModal() == IDOK) {
1503 auto error = ::RegRestoreKey(m_CurrentKey.Get(), dlg.m_szFileName, REG_FORCE_RESTORE);
1504 if (ERROR_SUCCESS != error) {
1505 DisplayError(L"Failed to import file", nullptr, error);
1506 }
1507 else {
1508 RefreshItem(m_Tree.GetSelectedItem());
1509 }
1510 }
1511
1512 SecurityHelper::EnablePrivilege(SE_BACKUP_NAME, false);
1513 SecurityHelper::EnablePrivilege(SE_RESTORE_NAME, false);
1514
1515 return 0;
1516}
1517
1518LRESULT CRegistryManagerView::OnExport(WORD, WORD, HWND, BOOL&) {
1519 CExportDlg dlg;

Callers

nothing calls this directly

Calls 2

EnablePrivilegeFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected