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

Method OnSetActive

cppcryptfs/ui/MountPropertyPage.cpp:932–1085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930
931
932BOOL CMountPropertyPage::OnSetActive()
933{
934 // TODO: Add your specialized code here and/or call the base class
935
936 RecentItems ritems(TEXT("Folders"), TEXT("LastDir"), m_numLastDirs);
937
938 const auto path_initial_default = TEXT("C:\\");
939 ritems.Populate(m_lastDirs, path_initial_default);
940
941 CComboBox *pBox = (CComboBox*)GetDlgItem(IDC_PATH);
942
943 if (pBox) {
944
945 CString cur;
946
947 pBox->GetWindowText(cur);
948
949 pBox->ResetContent();
950
951 pBox->SetWindowTextW(cur);
952
953 int i;
954
955 if (pBox) {
956 for (i = 0; i < m_numLastDirs; i++) {
957 if (m_lastDirs[i].GetLength()) {
958 if (i == 0) {
959 pBox->SetWindowTextW(m_lastDirs[i]);
960 }
961 pBox->InsertString(i, m_lastDirs[i]);
962
963 //Mount it when AUTO_MOUNT and firstRun
964 if (bMountFrameFirstRun){
965 CString path_hash;
966 wstring hash;
967 if (!GetPathHash(m_lastDirs[i], hash))
968 continue;
969
970 path_hash = hash.c_str();
971 int flags = theApp.GetProfileInt(L"MountFlags", path_hash, 0);
972 if (flags & AUTO_MOUNT_FLAG) {
973 CString mountPoint = theApp.GetProfileString(L"MountPoints", path_hash, NULL);
974 if (mountPoint.GetLength() == 0) {
975 CString strMessage;
976 strMessage.Format(LocUtils::GetStringFromResources(IDS_FAIL_RETRIVE_MPOINT).c_str(), m_lastDirs[i]);
977 MessageBox(strMessage, L"cppcryptfs", MB_OK | MB_ICONEXCLAMATION);
978 continue;
979 }
980
981 LockZeroBuffer<WCHAR> password(MAX_PASSWORD_LEN + 1, true);
982
983 if (!SavedPasswords::RetrievePassword(m_lastDirs[i], password.m_buf, password.m_len)) {
984 CString strMessage;
985 strMessage.Format(LocUtils::GetStringFromResources(IDS_FAIL_RETRIVE_PASS).c_str(), m_lastDirs[i]);
986 MessageBox(strMessage, L"cppcryptfs", MB_OK | MB_ICONEXCLAMATION);
987 continue;
988 }
989

Callers

nothing calls this directly

Calls 5

GetPathHashFunction · 0.85
PopulateMethod · 0.80
GetSettingCurrentMethod · 0.80
ActivateMethod · 0.80
SetRealTextMethod · 0.80

Tested by

no test coverage detected