Skip to content

Commit 702f9c6

Browse files
committed
[DISKPART] Prevent drive letter changes on boot or system volumes
1 parent a40bd10 commit 702f9c6

14 files changed

Lines changed: 24 additions & 0 deletions

File tree

base/system/diskpart/assign.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ assign_main(
7474
}
7575
}
7676

77+
if (CurrentVolume->IsBoot || CurrentVolume->IsSystem)
78+
{
79+
ConResPuts(StdOut, IDS_ASSIGN_SYSTEM_VOLUME);
80+
return EXIT_SUCCESS;
81+
}
82+
7783
if (nExclusive > 1)
7884
{
7985
ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);

base/system/diskpart/lang/de-DE.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ BEGIN
3232
IDS_ASSIGN_ALREADY_ASSIGNED "\nDer angegebene Buchstabe wurde diesem Laufwerk bereits zugewiesen.\n"
3333
IDS_ASSIGN_INVALID_LETTER "\nDer angegebene Laufwerksbuchstabe ist kein gültiger Volumebuchstabe.\n"
3434
IDS_ASSIGN_NO_MORE_LETTER "\nEs ist kein freier Laufwerksbuchstabe vorhanden, der diesem Volume zugewiesen werden kann.\nGeben Sie einen Laufwerksbuchstaben frei, und wiederholen Sie den Vorgang.\n"
35+
IDS_ASSIGN_SYSTEM_VOLUME "\nDer Laufwerkbuchstabe einens System-, Start- oder Auslagerungsvolumes kann nicht neu zugeordnet werden.\n"
3536
END
3637

3738
/* AUTOMOUNT command strings */

base/system/diskpart/lang/en-US.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ BEGIN
3232
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
3333
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
3434
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
35+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
3536
END
3637

3738
/* AUTOMOUNT command strings */

base/system/diskpart/lang/it-IT.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ BEGIN
3939
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
4040
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
4141
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
42+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
4243
END
4344

4445
/* AUTOMOUNT command strings */

base/system/diskpart/lang/pl-PL.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ BEGIN
3232
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
3333
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
3434
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
35+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
3536
END
3637

3738
/* AUTOMOUNT command strings */

base/system/diskpart/lang/pt-PT.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ BEGIN
3434
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
3535
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
3636
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
37+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
3738
END
3839

3940
/* AUTOMOUNT command strings */

base/system/diskpart/lang/ro-RO.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ BEGIN
4040
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
4141
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
4242
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
43+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
4344
END
4445

4546
/* AUTOMOUNT command strings */

base/system/diskpart/lang/ru-RU.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ BEGIN
3434
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
3535
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
3636
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
37+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
3738
END
3839

3940
/* AUTOMOUNT command strings */

base/system/diskpart/lang/sq-AL.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ BEGIN
3636
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
3737
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
3838
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
39+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
3940
END
4041

4142
/* AUTOMOUNT command strings */

base/system/diskpart/lang/tr-TR.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ BEGIN
4242
IDS_ASSIGN_ALREADY_ASSIGNED "\nThe specified letter has already been assigned to this drive.\n"
4343
IDS_ASSIGN_INVALID_LETTER "\nThe letter you specified is not a valid volume letter.\n"
4444
IDS_ASSIGN_NO_MORE_LETTER "\nThere are no free drive letters to assign to this volume.\nPlease free up a drive letter and try again.\n"
45+
IDS_ASSIGN_SYSTEM_VOLUME "\nDiskPart cannot reassign the drive letter on a system, boot or pagefile volume.\n"
4546
END
4647

4748
/* AUTOMOUNT command strings */

0 commit comments

Comments
 (0)