[DISKPART] list partition: Show a message when there are no partitions on a disk

This commit is contained in:
Eric Kohl
2025-12-15 20:36:51 +01:00
parent 182715ed50
commit ccfb061a2b
13 changed files with 49 additions and 3 deletions

View File

@@ -112,6 +112,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Partition %-3lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nThere is no disk to list partitions.\nPlease select a disk and try again.\n\n"
IDS_LIST_PARTITION_NONE "\nAuf dem Datenträger sind keine Partitionen vorhanden, die angezeigt werden können.\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Label FS Type Size Status Info\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -112,6 +112,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Partition %-3lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nThere is no disk to list partitions.\nPlease select a disk and try again.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Label FS Type Size Status Info\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -119,6 +119,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " -------------- ---------------- ---------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Partizione %-3lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nNon c'è nessun disco per mostrare partizioni.\nSelezionare un disco e riprova.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Etichetta FS Tipo Dimensione Stato Info\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ---------- ----- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -112,6 +112,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- ------------\n"
IDS_LIST_PARTITION_FORMAT "%c Partycja %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nNie wybrano dysku do wyświetlenia partycji.\nWybierz dysk i spróbuj ponownie.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Wolumin ### Lit Etykieta FS Typ Rozmiar Stan Info\n"
IDS_LIST_VOLUME_LINE " ----------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Wolumin %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -114,6 +114,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ------- --------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Partição %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nSem discos para listar Partições.\nPor favor seleccione um disco e tente novamente.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Label FS Type Size Status Info\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -120,6 +120,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Partiție %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nNu există niciun disc pentru a afișa partiții.\nSelectați un disc apoi reîncercați.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Volum ### Ltr Etichetă FS Tip Mărime Stare Informații\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volum %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -114,6 +114,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Раздел %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nДиск с разметкой элементов не выбран.\nУкажите диск и повторите попытку.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Label FS Type Size Status Info\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -116,6 +116,7 @@ BEGIN
IDS_LIST_PARTITION_LINE "%c ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT " Partition %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nThere is no disk to list partitions.\nPlease select a disk and try again.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Label FS Type Size Status Info\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -122,6 +122,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Bölüm %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\nBölümleri listelemek için bir disk yok.\nLütfen bir disk seçiniz ve yeniden deneyiniz.\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Birim ### Hrf Etiket DS Dür Boyut Durum Bilgi\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Birim %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -121,6 +121,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c Partition %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\n这里没有要列出分区的磁盘。\n请选择一个磁盘再试一次。\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Label FS Type Size Status Info\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c Volume %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -121,6 +121,7 @@ BEGIN
IDS_LIST_PARTITION_LINE " ------------- ---------------- ------- -------\n"
IDS_LIST_PARTITION_FORMAT "%c 磁碟分割 %2lu %-16s %4I64u %-2s %4I64u %-2s\n"
IDS_LIST_PARTITION_NO_DISK "\n沒有可列出分區的磁碟。\n請選擇一個磁碟再試一次。\n\n"
IDS_LIST_PARTITION_NONE "\nThere are no partitions on this disk to show.\n"
IDS_LIST_VOLUME_HEAD " 磁碟區 ### Ltr 標籤 FS 類型 大小 狀態 資訊\n"
IDS_LIST_VOLUME_LINE " ---------- --- ----------- ----- ---------- ------- ------- --------\n"
IDS_LIST_VOLUME_FORMAT "%c 磁碟區 %-3lu %c %-11.11s %-5s %-10.10s %4I64u %-2s\n"

View File

@@ -189,6 +189,7 @@ ListPartition(
LPWSTR lpSizeUnit;
LPWSTR lpOffsetUnit;
ULONG PartNumber = 1;
BOOL bPartitionFound = FALSE;
if (CurrentDisk == NULL)
{
@@ -196,6 +197,39 @@ ListPartition(
return TRUE;
}
if (CurrentDisk->PartitionStyle == PARTITION_STYLE_MBR)
{
Entry = CurrentDisk->PrimaryPartListHead.Flink;
while (Entry != &CurrentDisk->PrimaryPartListHead)
{
PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
if (PartEntry->Mbr.PartitionType != PARTITION_ENTRY_UNUSED)
bPartitionFound = TRUE;
Entry = Entry->Flink;
}
}
else if (CurrentDisk->PartitionStyle == PARTITION_STYLE_GPT)
{
Entry = CurrentDisk->PrimaryPartListHead.Flink;
while (Entry != &CurrentDisk->PrimaryPartListHead)
{
PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
if (!IsEqualGUID(&PartEntry->Gpt.PartitionType, &PARTITION_ENTRY_UNUSED_GUID))
bPartitionFound = TRUE;
Entry = Entry->Flink;
}
}
if (bPartitionFound == FALSE)
{
ConPuts(StdOut, L"\n");
ConResPuts(StdOut, IDS_LIST_PARTITION_NONE);
ConPuts(StdOut, L"\n");
return TRUE;
}
/* Header labels */
ConPuts(StdOut, L"\n");
ConResPuts(StdOut, IDS_LIST_PARTITION_HEAD);

View File

@@ -85,9 +85,10 @@
#define IDS_LIST_PARTITION_LINE 3304
#define IDS_LIST_PARTITION_FORMAT 3305
#define IDS_LIST_PARTITION_NO_DISK 3306
#define IDS_LIST_VOLUME_HEAD 3307
#define IDS_LIST_VOLUME_LINE 3308
#define IDS_LIST_VOLUME_FORMAT 3309
#define IDS_LIST_PARTITION_NONE 3307
#define IDS_LIST_VOLUME_HEAD 3308
#define IDS_LIST_VOLUME_LINE 3309
#define IDS_LIST_VOLUME_FORMAT 3310
#define IDS_RESCAN_START 4100
#define IDS_RESCAN_END 4101