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

Method Mount

cppcryptfs/ui/MountPropertyPage.cpp:161–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161CString CMountPropertyPage::Mount(LPCWSTR argPath, LPCWSTR argMountPoint, LPCWSTR argPassword, bool argReadOnly, LPCWSTR argConfigPath, bool argReverse)
162{
163
164
165 POSITION pos = NULL;
166
167 CSecureEdit *pPass = &m_password;
168
169 LockZeroBuffer<WCHAR> password(MAX_PASSWORD_LEN + 1, false);
170
171 if (!password.IsLocked()) {
172 return LocUtils::GetStringFromResources(IDS_UNABLE_LOCK_BUFFER).c_str();
173 }
174
175 if (wcscpy_s(password.m_buf, MAX_PASSWORD_LEN + 1, argPassword ? argPassword : pPass->m_strRealText)) {
176 return LocUtils::GetStringFromResources(IDS_UNABLE_GET_PASS).c_str();
177 }
178
179 if (wcslen(password.m_buf) < 1) {
180 return LocUtils::GetStringFromResources(IDS_PASS_CANNOT_BE_EMPTY).c_str();
181 }
182
183 CListCtrl *pList = (CListCtrl*)GetDlgItem(IDC_DRIVE_LETTERS);
184
185 if (!pList)
186 return LocUtils::GetStringFromResources(IDS_UNABLE_GET_LIST).c_str();
187
188 pos = pList->GetFirstSelectedItemPosition();
189
190 if (!pos)
191 return LocUtils::GetStringFromResources(IDS_UNABLE_GET_SELECTED).c_str();
192
193 int nItem = -1;
194
195 if (argMountPoint != NULL && wcslen(argMountPoint) > 0) {
196 LVFINDINFO fi;
197 memset(&fi, 0, sizeof(fi));
198 fi.flags = LVFI_STRING;
199 CString str = wcslen(argMountPoint) == 1 ? CString(*argMountPoint) + L":" : argMountPoint;
200 fi.psz = str;
201 nItem = pList->FindItem(&fi);
202 if (nItem < 0) {
203 if (is_mountpoint_a_drive(str)) {
204 CString strMsg;
205 strMsg.Format(LocUtils::GetStringFromResources(IDS_MPOINT_ALREADY_USED).c_str(), str);
206 return strMsg;
207 } else {
208 int i = pList->GetItemCount();
209 nItem = pList->InsertItem(LVIF_TEXT | (m_imageIndex >= 0 ? LVIF_IMAGE : 0) | LVIF_STATE, i, str,
210 true ? LVIS_SELECTED : 0, LVIS_SELECTED, m_imageIndex >= 0 ? m_imageIndex : 0, 0);
211 }
212 }
213 int nOldItem = pList->GetNextSelectedItem(pos);
214 if (nOldItem >= 0)
215 pList->SetItemState(nOldItem, ~LVIS_SELECTED, LVIS_SELECTED);
216 if (nItem >= 0) {
217 pList->SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED);
218 pList->EnsureVisible(nItem, FALSE);

Callers

nothing calls this directly

Calls 15

is_mountpoint_a_driveFunction · 0.85
CanGetSessionIdOkFunction · 0.85
have_sessionidFunction · 0.85
get_sessionidFunction · 0.85
mount_crypt_fsFunction · 0.85
GetPathHashFunction · 0.85
IsLockedMethod · 0.80
SetRealTextMethod · 0.80
sizeMethod · 0.80
eraseMethod · 0.80
GetSettingsMethod · 0.80
AddMethod · 0.80

Tested by

no test coverage detected