MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / OnCbnSelchangePath

Method OnCbnSelchangePath

cppcryptfs/ui/MountPropertyPage.cpp:1099–1193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1097
1098
1099void CMountPropertyPage::OnCbnSelchangePath()
1100{
1101 // TODO: Add your control notification handler code here
1102
1103 CComboBox *pWnd = (CComboBox*)GetDlgItem(IDC_PATH);
1104
1105 if (!pWnd)
1106 return;
1107
1108 CString cpath;
1109
1110 int sel = pWnd->GetCurSel();
1111
1112 if (sel == CB_ERR)
1113 return;
1114
1115 pWnd->GetLBText(sel, cpath);
1116
1117 if (cpath.GetLength() < 1)
1118 return;
1119
1120 CString path_hash;
1121 wstring hash;
1122 if (!GetPathHash(cpath, hash))
1123 return;
1124
1125 path_hash = hash.c_str();
1126
1127
1128 CString config_path = theApp.GetProfileString(L"ConfigPaths", path_hash, L"");
1129
1130 CWnd *pConfigPathWnd = GetDlgItem(IDC_CONFIG_PATH);
1131
1132 if (!pConfigPathWnd)
1133 return;
1134
1135 pConfigPathWnd->SetWindowTextW(config_path);
1136
1137 int flags = theApp.GetProfileInt(L"MountFlags", path_hash, 0);
1138 CheckDlgButton(IDC_READONLY, (flags & READONLY_FLAG) != 0);
1139 CheckDlgButton(IDC_REVERSE, (flags & REVERSE_FLAG) != 0);
1140 CheckDlgButton(IDC_AUTO_MOUNT, (flags & AUTO_MOUNT_FLAG) != 0);
1141
1142 bool save_passwords_enabled = false;
1143 CryptSettings::getInstance().GetSettingCurrent(ENABLE_SAVING_PASSWORDS, save_passwords_enabled);
1144
1145 CheckDlgButton(IDC_SAVE_PASSWORD, (flags & SAVE_PASSWORD_FLAG) && save_passwords_enabled);
1146
1147 LockZeroBuffer<WCHAR> password(MAX_PASSWORD_LEN+1, true);
1148
1149 if ((flags & SAVE_PASSWORD_FLAG) && save_passwords_enabled && SavedPasswords::RetrievePassword(cpath, password.m_buf, password.m_len)) {
1150
1151 password.m_buf[MAX_PASSWORD_LEN] = '\0';
1152 CSecureEdit *pEd = (CSecureEdit*)GetDlgItem(IDC_PASSWORD);
1153 if (pEd) {
1154 pEd->SetRealText(password.m_buf);
1155 }
1156 } else {

Callers

nothing calls this directly

Calls 3

GetPathHashFunction · 0.85
GetSettingCurrentMethod · 0.80
SetRealTextMethod · 0.80

Tested by

no test coverage detected