MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / RemoveMountPoint

Method RemoveMountPoint

Ext2Mgr/MountPoints.cpp:344–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}
343
344BOOL
345CMountPoints::RemoveMountPoint(CHAR drvChar)
346{
347 PEXT2_LETTER drvLetter = NULL;
348 ULONGLONG letterMask = 0;
349
350 if (drvChar >= '0' && drvChar <= '9') {
351 drvLetter = &drvDigits[drvChar - '0'];
352 letterMask = ((ULONGLONG) 1) << (drvChar - '0' + 32);
353 } else if (drvChar >= 'A' && drvChar <= 'Z') {
354 drvLetter = &drvLetters[drvChar - 'A'];
355 letterMask = ((ULONGLONG) 1) << (drvChar - 'A');
356 }
357
358 if (!drvLetter) {
359 return FALSE;
360 }
361
362 Ext2SetRegistryMountPoint(&drvChar, NULL, FALSE);
363 if (Ext2RemoveDrvLetter(drvLetter)) {
364
365 m_MainDlg->SendMessage(WM_MOUNTPOINT_NOTIFY,
366 'DR', (LPARAM)drvLetter->Letter);
367
368 } else {
369
370 CString str;
371 str.Format("Failed to remove drive letter %c:\n", drvChar);
372 AfxMessageBox(str, MB_OK|MB_ICONWARNING);
373 return FALSE;
374 }
375
376 if (m_Part) {
377 m_Part->DrvLetters &= (~letterMask);
378 if (m_Part->Volume) {
379 m_Part->Volume->DrvLetters &= ~letterMask;
380 }
381 InitializeList(m_Part->DrvLetters);
382 }
383
384 if (m_Volume) {
385 PEXT2_PARTITION part = Ext2QueryVolumePartition(m_Volume);
386 m_Volume->DrvLetters &= ~letterMask;
387 if (part) {
388 part->DrvLetters &= ~letterMask;
389 }
390 InitializeList(m_Volume->DrvLetters);
391 }
392
393 if (m_Cdrom) {
394 m_Cdrom->DrvLetters &= ~letterMask;
395 InitializeList(m_Cdrom->DrvLetters);
396 }
397
398 return TRUE;
399}
400
401void CMountPoints::OnRemoveMountpoint()

Callers

nothing calls this directly

Calls 3

Ext2QueryVolumePartitionFunction · 0.85
Ext2RemoveDrvLetterFunction · 0.70

Tested by

no test coverage detected