| 4427 | } |
| 4428 | |
| 4429 | BOOL |
| 4430 | Ext2AssignDrvLetter( |
| 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 | |
| 4478 | DrvMounted: |
| 4479 | |
| 4480 | drvLetter->bTemporary = !bMountMgr; |
| 4481 | Ext2QueryDrvLetter(drvLetter); |
| 4482 | |
| 4483 | return TRUE; |
| 4484 | } |
| 4485 | |
| 4486 | /* |
no test coverage detected