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

Method Dismount

cppcryptfs/ui/MountPropertyPage.cpp:757–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

755}
756
757CString CMountPropertyPage::Dismount(LPCWSTR argMountPoint, bool interactive, bool forceDismount)
758{
759
760 CListCtrl *pList = (CListCtrl*)GetDlgItem(IDC_DRIVE_LETTERS);
761
762 if (!pList)
763 return LocUtils::GetStringFromResources(IDS_UNABLE_GET_LIST).c_str();
764
765 POSITION pos = pList->GetFirstSelectedItemPosition();
766
767 if (!pos)
768 return LocUtils::GetStringFromResources(IDS_UNABLE_GET_SELECTED).c_str();
769
770 int nItem;
771
772 if (argMountPoint && wcslen(argMountPoint) > 0) {
773 LVFINDINFO fi;
774 memset(&fi, 0, sizeof(fi));
775 fi.flags = LVFI_STRING;
776 CString str = wcslen(argMountPoint) == 1 ? CString(*argMountPoint) + L":" : argMountPoint;
777 fi.psz = str;
778 nItem = pList->FindItem(&fi);
779 if (nItem < 0) {
780 CString msg;
781 msg.Format(LocUtils::GetStringFromResources(IDS_DRIVE_WITHOUT_MOUNTED_FS).c_str(), str);
782 return msg;
783 }
784 } else {
785 nItem = pList->GetNextSelectedItem(pos);
786 }
787
788 if (nItem < 0)
789 return LocUtils::GetStringFromResources(IDS_UNABLE_FIND_ITEM).c_str();
790
791 CString cmp = pList->GetItemText(nItem, DL_INDEX);
792
793 if (cmp.GetLength() < 1)
794 return LocUtils::GetStringFromResources(IDS_UNABLE_GET_LETTER).c_str();
795
796 CString cpath = pList->GetItemText(nItem, PATH_INDEX);
797
798 if (cpath.GetLength() < 1) {
799 CString msg;
800 msg.Format(LocUtils::GetStringFromResources(IDS_DRIVE_WITHOUT_MOUNTED_FS).c_str(), cmp);
801 return msg;
802 }
803
804 CString mes;
805
806 if (is_mountpoint_a_drive(cmp)) {
807 wstring wmes;
808 if (!write_volume_name_if_changed(*(const WCHAR *)cmp, wmes))
809 mes += wmes.c_str();
810 }
811
812 CString open_handles_mes = CheckOpenHandles(m_hWnd, cmp, interactive, forceDismount).c_str();
813
814 if (open_handles_mes.GetLength() > 0)

Callers

nothing calls this directly

Calls 4

is_mountpoint_a_driveFunction · 0.85
CheckOpenHandlesFunction · 0.85
unmount_crypt_fsFunction · 0.85

Tested by

no test coverage detected