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

Method ShowValueProperties

WinArk/View.cpp:1368–1490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1366}
1367
1368INT_PTR CRegistryManagerView::ShowValueProperties(RegistryItem& item, int index) {
1369 auto cb = [this](auto& cmd, bool) {
1370 if (GetFullNodePath(m_Tree.GetSelectedItem()) == cmd.GetPath()) {
1371 int index = m_List.FindItem(cmd.GetName(), false);
1372 ATLASSERT(index >= 0);
1373 if (index >= 0) {
1374 m_Items[index].Value.Empty();
1375 m_Items[index].Size -= 1;
1376 m_List.RedrawItems(index, index);
1377 m_List.SetItemState(index, LVIS_SELECTED, LVIS_SELECTED);
1378 }
1379 }
1380 return true;
1381 };
1382 bool success = false;
1383 bool result = false;
1384 switch (item.Type)
1385 {
1386 case REG_LINK:
1387 AtlMessageBox(m_hWnd, L"No special properties available for a symbolic link", IDS_TITLE, MB_ICONINFORMATION);
1388 return 0;
1389
1390 case REG_SZ:
1391 case REG_EXPAND_SZ:
1392 {
1393 CStringValueDlg dlg(m_CurrentKey, item.Name, m_ReadOnly);
1394 result = dlg.DoModal() == IDOK && dlg.IsModified();
1395 if (result) {
1396 auto hItem = m_Tree.GetSelectedItem();
1397 DWORD type = dlg.GetType();
1398 CString value = dlg.GetValue();
1399 LONG size = (1 + value.GetLength()) * sizeof(WCHAR);
1400 auto cmd = std::make_shared<ChangeValueCommand>(GetFullNodePath(hItem),
1401 item.Name, type, (PVOID)(PCWSTR)value,size);
1402 success = m_CmdMgr.AddCommand(cmd);
1403 if (success) {
1404 cmd->SetCallback(cb);
1405 item.Value.Empty();
1406 item.Size -= 1;
1407 m_List.RedrawItems(index, index);
1408 }
1409 }
1410 break;
1411 }
1412
1413 case REG_MULTI_SZ:
1414 {
1415 CMultiStringValueDlg dlg(m_CurrentKey, item.Name, m_ReadOnly);
1416 result = dlg.DoModal() == IDOK && dlg.IsModified();
1417 if (result) {
1418 auto hItem = m_Tree.GetSelectedItem();
1419 auto value = dlg.GetValue();
1420 // �����Ŀ���ַ������е���һ�ַ���ֱ��������һ��������Ŀ���ַ����Ӽ����ַ�Ϊֹ
1421 value.TrimRight(L"\r\n");
1422 value.Replace(L"\r\n", L"\n");
1423 auto len = value.GetLength();
1424 for (int i = 0; i < len; i++) {
1425 if (value[i] == L'\n')

Callers

nothing calls this directly

Calls 11

GetPathMethod · 0.80
GetNameMethod · 0.80
ReplaceMethod · 0.80
SetAtMethod · 0.80
FindItemMethod · 0.45
IsModifiedMethod · 0.45
GetTypeMethod · 0.45
GetValueMethod · 0.45
GetLengthMethod · 0.45
AddCommandMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected