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

Function Ext2AssignDrvLetter

Ext2Mgr/enumDisk.cpp:4429–4484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4427}
4428
4429BOOL
4430Ext2AssignDrvLetter(
4431 PEXT2_LETTER drvLetter,
4432 PCHAR devPath,
4433 BOOL bMountMgr
4434 )
4435{
4436 CHAR dosPath[] = "A:\0";
4437 CHAR drvPath[] = "A:\\\0";
4438 CHAR volumeName[MAX_PATH];
4439
4440 BOOL rc = 0;
4441
4442 if (drvLetter->bUsed) {
4443 return FALSE;
4444 }
4445
4446 memset(volumeName, 0, MAX_PATH);
4447 dosPath[0] = drvPath[0] = drvLetter->Letter;
4448
4449 rc = Ext2DefineDosDevice(DDD_RAW_TARGET_PATH,
4450 dosPath, devPath);
4451
4452 if (rc) {
4453
4454 /* Now it's done, since user only
4455 needs a temporary mount point */
4456 if (!bMountMgr) {
4457 goto DrvMounted;
4458 }
4459
4460 rc = GetVolumeNameForVolumeMountPoint (
4461 drvPath, volumeName, MAX_PATH);
4462
4463 Ext2DefineDosDevice (
4464 DDD_RAW_TARGET_PATH|
4465 DDD_REMOVE_DEFINITION|
4466 DDD_EXACT_MATCH_ON_REMOVE,
4467 dosPath, devPath);
4468
4469 if (rc) {
4470 rc = SetVolumeMountPoint(drvPath, volumeName);
4471 }
4472 }
4473
4474 if (!rc) {
4475 return FALSE;
4476 }
4477
4478DrvMounted:
4479
4480 drvLetter->bTemporary = !bMountMgr;
4481 Ext2QueryDrvLetter(drvLetter);
4482
4483 return TRUE;
4484}
4485
4486/*

Callers 4

Ext2MountVolumeFunction · 0.70
Ext2MountVolumeAsFunction · 0.70
Ext2NotifyVolumePointFunction · 0.70
AddMountPointMethod · 0.70

Calls 2

Ext2DefineDosDeviceFunction · 0.85
Ext2QueryDrvLetterFunction · 0.85

Tested by

no test coverage detected