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

Method DismountAll

cppcryptfs/ui/MountPropertyPage.cpp:852–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850}
851
852CString CMountPropertyPage::DismountAll(bool interactive, bool forceDismount)
853{
854 // TODO: Add your control notification handler code here
855
856 CListCtrl *pList = (CListCtrl*)GetDlgItem(IDC_DRIVE_LETTERS);
857
858 if (!pList)
859 return LocUtils::GetStringFromResources(IDS_UNABLE_GET_LIST).c_str();
860
861 int count = pList->GetItemCount();
862
863 int i;
864
865 bool hadSuccess = false;
866 bool hadFailure = false;
867
868 bool volnameFailure = false;
869
870 DWORD mounted_letters = theApp.m_mountedLetters;
871
872 CString open_handles_mes = CheckOpenHandles(m_hWnd, nullptr, interactive, forceDismount).c_str();
873
874 if (open_handles_mes.GetLength() > 0)
875 return open_handles_mes;
876
877 for (i = 0; i < count; i++) {
878 CString cmp;
879 CString cpath;
880 cpath = pList->GetItemText(i, PATH_INDEX);
881 if (cpath.GetLength() > 1) {
882 cmp = pList->GetItemText(i, DL_INDEX);
883 if (cmp.GetLength() < 1) {
884 hadFailure = true;
885 continue;
886 }
887 if (is_mountpoint_a_drive(cmp)) {
888 wstring wmes;
889 if (!write_volume_name_if_changed(*(const WCHAR *)cmp, wmes)) {
890 volnameFailure = true;
891 }
892 }
893 wstring wmes;
894 if (unmount_crypt_fs(cmp, false, wmes)) {
895 if (is_mountpoint_a_drive(cmp)) {
896 mounted_letters &= ~(1 << (*(const WCHAR *)cmp - 'A'));
897 }
898 hadSuccess = true;
899 pList->SetItemText(i, PATH_INDEX, L"");
900 } else {
901 hadFailure = true;
902 }
903 }
904 }
905
906 theApp.DoWaitCursor(1);
907 wait_for_all_unmounted();
908 theApp.DoWaitCursor(-1);
909

Callers

nothing calls this directly

Calls 5

CheckOpenHandlesFunction · 0.85
is_mountpoint_a_driveFunction · 0.85
unmount_crypt_fsFunction · 0.85
wait_for_all_unmountedFunction · 0.85

Tested by

no test coverage detected