From 920153534b4cc8ce8b545d9c963f92f4ddf56afb Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 7 Dec 2025 10:09:26 +0100 Subject: [PATCH] [DISKPART] Implement the 'convert mbr' and 'convert gpt' commands - Show Disk UUIDs in the 'detail disk' and 'uniqueid disk' commands. --- base/system/diskpart/convert.c | 179 ++++++++++- base/system/diskpart/detail.c | 9 +- base/system/diskpart/diskpart.h | 42 ++- base/system/diskpart/diskpart_msg.mc | 424 ++++++++++++++++++++++++++- base/system/diskpart/interpreter.c | 5 +- base/system/diskpart/lang/de-DE.rc | 15 +- base/system/diskpart/lang/en-US.rc | 17 +- base/system/diskpart/lang/it-IT.rc | 15 +- base/system/diskpart/lang/pl-PL.rc | 15 +- base/system/diskpart/lang/pt-PT.rc | 15 +- base/system/diskpart/lang/ro-RO.rc | 15 +- base/system/diskpart/lang/ru-RU.rc | 15 +- base/system/diskpart/lang/sq-AL.rc | 15 +- base/system/diskpart/lang/tr-TR.rc | 15 +- base/system/diskpart/lang/zh-CN.rc | 15 +- base/system/diskpart/lang/zh-TW.rc | 15 +- base/system/diskpart/misc.c | 56 ++++ base/system/diskpart/partlist.c | 162 ++++++---- base/system/diskpart/resource.h | 112 +++---- base/system/diskpart/uniqueid.c | 9 +- 20 files changed, 1037 insertions(+), 128 deletions(-) diff --git a/base/system/diskpart/convert.c b/base/system/diskpart/convert.c index a6e72b46f8e..5878e39280c 100644 --- a/base/system/diskpart/convert.c +++ b/base/system/diskpart/convert.c @@ -8,7 +8,184 @@ #include "diskpart.h" -BOOL convert_main(INT argc, LPWSTR *argv) +#define NDEBUG +#include + +NTSTATUS +CreateDisk( + _In_ ULONG DiskNumber, + _In_ PCREATE_DISK DiskInfo) { + WCHAR DstPath[MAX_PATH]; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING Name; + HANDLE FileHandle = NULL; + IO_STATUS_BLOCK Iosb; + NTSTATUS Status; + + DPRINT1("CreateDisk(%lu %p)\n", DiskNumber, DiskInfo); + + StringCchPrintfW(DstPath, ARRAYSIZE(DstPath), + L"\\Device\\Harddisk%lu\\Partition0", + CurrentDisk->DiskNumber); + RtlInitUnicodeString(&Name, DstPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, + &ObjectAttributes, + &Iosb, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); + goto done; + } + + Status = NtDeviceIoControlFile(FileHandle, + NULL, + NULL, + NULL, + &Iosb, + IOCTL_DISK_CREATE_DISK, + DiskInfo, + sizeof(*DiskInfo), + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtDeviceIoControlFile() failed (Status %lx)\n", Status); + goto done; + } + + CurrentDisk->PartitionStyle = DiskInfo->PartitionStyle; + + /* Free the layout buffer */ + if (CurrentDisk->LayoutBuffer) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentDisk->LayoutBuffer); + CurrentDisk->LayoutBuffer = NULL; + CurrentDisk->ExtendedPartition = NULL; + } + + ReadLayoutBuffer(FileHandle, CurrentDisk); + + DPRINT1("PartitionCount: %lu\n", CurrentDisk->LayoutBuffer->PartitionCount); + +#ifdef DUMP_PARTITION_TABLE + DumpPartitionTable(CurrentDisk); +#endif + +done: + if (FileHandle) + NtClose(FileHandle); + + return Status; +} + + +BOOL +ConvertGPT( + _In_ INT argc, + _In_ PWSTR *argv) +{ + CREATE_DISK DiskInfo; + NTSTATUS Status; + + DPRINT("ConvertGPT()\n"); + + if (CurrentDisk == NULL) + { + ConResPuts(StdOut, IDS_SELECT_NO_DISK); + return TRUE; + } + + if (CurrentDisk->PartitionStyle == PARTITION_STYLE_GPT) + { + ConResPuts(StdOut, IDS_CONVERT_GPT_ALREADY); + return TRUE; + } + + if (CurrentDisk->LayoutBuffer->PartitionCount != 0) + { + ConResPuts(StdOut, IDS_CONVERT_GPT_NOT_EMPTY); + return TRUE; + } + +#if 0 + /* Fail if disk size is less than 128MB */ + if (CurrentDisk->SectorCount.QuadPart * CurrentDisk->BytesPerSector < 128ULL * 1024ULL * 1024ULL) + { + ConResPuts(StdOut, IDS_CONVERT_GPT_TOO_SMALL); + return TRUE; + } +#endif + + DiskInfo.PartitionStyle = PARTITION_STYLE_GPT; + CreateGUID(&DiskInfo.Gpt.DiskId); + DiskInfo.Gpt.MaxPartitionCount = 128; + + Status = CreateDisk(CurrentDisk->DiskNumber, &DiskInfo); + if (!NT_SUCCESS(Status)) + { + + } + else + { + ConResPuts(StdOut, IDS_CONVERT_GPT_SUCCESS); + } + + return TRUE; +} + + +BOOL +ConvertMBR( + _In_ INT argc, + _In_ PWSTR *argv) +{ + CREATE_DISK DiskInfo; + NTSTATUS Status; + + DPRINT("ConvertMBR()\n"); + + if (CurrentDisk == NULL) + { + ConResPuts(StdOut, IDS_SELECT_NO_DISK); + return TRUE; + } + + if ((CurrentDisk->PartitionStyle == PARTITION_STYLE_MBR) || + (CurrentDisk->PartitionStyle == PARTITION_STYLE_RAW)) + { + ConResPuts(StdOut, IDS_CONVERT_MBR_ALREADY); + return TRUE; + } + + if (CurrentDisk->LayoutBuffer->PartitionCount != 0) + { + ConResPuts(StdOut, IDS_CONVERT_MBR_NOT_EMPTY); + return TRUE; + } + + DiskInfo.PartitionStyle = PARTITION_STYLE_MBR; + CreateSignature(&DiskInfo.Mbr.Signature); + + Status = CreateDisk(CurrentDisk->DiskNumber, &DiskInfo); + if (!NT_SUCCESS(Status)) + { + + } + else + { + ConResPuts(StdOut, IDS_CONVERT_MBR_SUCCESS); + } + return TRUE; } diff --git a/base/system/diskpart/detail.c b/base/system/diskpart/detail.c index ca06a2b0ad4..2bdee7b03a8 100644 --- a/base/system/diskpart/detail.c +++ b/base/system/diskpart/detail.c @@ -72,6 +72,7 @@ DetailDisk( PLIST_ENTRY Entry; PVOLENTRY VolumeEntry; BOOL bPrintHeader = TRUE; + WCHAR szBuffer[40]; DPRINT("DetailDisk()\n"); @@ -89,7 +90,13 @@ DetailDisk( /* TODO: Print more disk details */ ConPuts(StdOut, L"\n"); - ConResPrintf(StdOut, IDS_DETAIL_INFO_DISK_ID, CurrentDisk->LayoutBuffer->Mbr.Signature); + if (CurrentDisk->LayoutBuffer->PartitionStyle == PARTITION_STYLE_GPT) + PrintGUID(szBuffer, &CurrentDisk->LayoutBuffer->Gpt.DiskId); + else if (CurrentDisk->LayoutBuffer->PartitionStyle == PARTITION_STYLE_MBR) + swprintf(szBuffer, L"%08lx", CurrentDisk->LayoutBuffer->Mbr.Signature); + else + wcscpy(szBuffer, L"00000000"); + ConResPrintf(StdOut, IDS_DETAIL_INFO_DISK_ID, szBuffer); ConResPrintf(StdOut, IDS_DETAIL_INFO_PATH, CurrentDisk->PathId); ConResPrintf(StdOut, IDS_DETAIL_INFO_TARGET, CurrentDisk->TargetId); ConResPrintf(StdOut, IDS_DETAIL_INFO_LUN_ID, CurrentDisk->Lun); diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h index 9216bfcc5c4..dafbcce4016 100644 --- a/base/system/diskpart/diskpart.h +++ b/base/system/diskpart/diskpart.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,8 @@ #include "resource.h" +//#define DUMP_PARTITION_TABLE + /* DEFINES *******************************************************************/ typedef struct _COMMAND @@ -246,7 +249,20 @@ BOOL clean_main(INT argc, LPWSTR *argv); BOOL compact_main(INT argc, LPWSTR *argv); /* convert.c */ -BOOL convert_main(INT argc, LPWSTR *argv); +NTSTATUS +CreateDisk( + _In_ ULONG DiskNumber, + _In_ PCREATE_DISK DiskInfo); + +BOOL +ConvertGPT( + _In_ INT argc, + _In_ PWSTR *argv); + +BOOL +ConvertMBR( + _In_ INT argc, + _In_ PWSTR *argv); /* create.c */ BOOL @@ -405,6 +421,19 @@ PWSTR DuplicateString( _In_ PWSTR pszInString); +VOID +CreateGUID( + _Out_ GUID *pGuid); + +VOID +CreateSignature( + _Out_ PDWORD pSignature); + +VOID +PrintGUID( + _Out_ PWSTR pszBuffer, + _In_ GUID *pGuid); + /* offline.c */ BOOL offline_main(INT argc, LPWSTR *argv); @@ -412,6 +441,12 @@ BOOL offline_main(INT argc, LPWSTR *argv); BOOL online_main(INT argc, LPWSTR *argv); /* partlist.c */ +#ifdef DUMP_PARTITION_TABLE +VOID +DumpPartitionTable( + _In_ PDISKENTRY DiskEntry); +#endif + ULONGLONG AlignDown( _In_ ULONGLONG Value, @@ -429,6 +464,11 @@ CreateVolumeList(VOID); VOID DestroyVolumeList(VOID); +VOID +ReadLayoutBuffer( + _In_ HANDLE FileHandle, + _In_ PDISKENTRY DiskEntry); + NTSTATUS WritePartitions( _In_ PDISKENTRY DiskEntry); diff --git a/base/system/diskpart/diskpart_msg.mc b/base/system/diskpart/diskpart_msg.mc index f4c6a057267..7d4eee3fd3b 100644 --- a/base/system/diskpart/diskpart_msg.mc +++ b/base/system/diskpart/diskpart_msg.mc @@ -740,38 +740,440 @@ Language=Taiwanese MessageId=10010 -SymbolicName=MSG_COMMAND_CONVERT +SymbolicName=MSG_COMMAND_CONVERT_GPT Severity=Informational Facility=System Language=English - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=German - + Konvertiert einen Datenträger mit MBR (Master Boot Record) Partitionstabelle + in einen Datenträger mit GPT (GUID Partititionstabelle) Partititonstabelle. + +Syntax: CONVERT GPT [NOERR] + + NOERR Nur für Skripting. Bei einem Fehler setzt DiskPart die + Verarbeitung von Befehlen fort, als sei der Fehler nicht + aufgetreten. + Ohne den Parameter NOERR wird DiskPart bei einem Fehler mit + dem entsprechenden Fehlercode beendet. + + Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein + MBR-Datenträger ausgewählt sein. + + Der Datenträger muss eine minimale Größe von 128 MB haben. + + Wichtig: + Nur ein leerer Datenträger kann in einen GPT-Datenträger konvertiert + werden. Sichern Sie alle Daten und löschen Sie alle Partitionen und + Volumes bevor Sie den Datenträger konvertieres. + +Beispiel: + CONVERT GPT . Language=Polish - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=Portugese - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=Romanian - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=Russian - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=Albanian - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=Turkish - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=Chinese - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT . Language=Taiwanese - + Converts a disk with an MBR (Master Boot Record) partition table + into a disk with a GPT (GUID partititon table) partititon table. + +Syntax: CONVERT GPT [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + An MBR disk must be selected for this operation to succeed. + + The disk must have a minimum size of 128 MB. + + Important: + Only empty disks can be converted to GPT. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT GPT +. + + +MessageId=10011 +SymbolicName=MSG_COMMAND_CONVERT_MBR +Severity=Informational +Facility=System +Language=English + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=German + Konvertiert einen Datenträger mit GPT (GUID Partititionstabelle) Partitionstabelle + in einen Datenträger mit MBR (Master Boot Record) Partititonstabelle. + +Syntax: CONVERT MBR [NOERR] + + NOERR Nur für Skripting. Bei einem Fehler setzt DiskPart die + Verarbeitung von Befehlen fort, als sei der Fehler nicht + aufgetreten. + Ohne den Parameter NOERR wird DiskPart bei einem Fehler mit + dem entsprechenden Fehlercode beendet. + + Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein + GPT-Datenträger ausgewählt sein. + + Wichtig: + Nur ein leerer Datenträger kann in einen MBR-Datenträger konvertiert + werden. Sichern Sie alle Daten und löschen Sie alle Partitionen und + Volumes bevor Sie den Datenträger konvertieres. + +Beispiel: + CONVERT MBR +. +Language=Polish + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=Portugese + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=Romanian + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=Russian + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=Albanian + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=Turkish + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=Chinese + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR +. +Language=Taiwanese + Converts a disk with a GPT (GUID partititon table) partition table + into a disk with an MBR (Master Boot Record) partititon table. + +Syntax: CONVERT MBR [NOERR] + + NOERR For scripting only. When an error is encountered, DiskPart + continues to process commands as if the error did not occur. + Without the NOERR parameter, an error causes DiskPart to exit + with an error code. + + A GPT disk must be selected for this operation to succeed. + + Important: + Only empty disks can be converted to MBR. Backup all data and delete all + partitions or volumes before you convert the disk. + +Example: + CONVERT MBR . diff --git a/base/system/diskpart/interpreter.c b/base/system/diskpart/interpreter.c index 2e6750ac0ee..2f5f12dc2dd 100644 --- a/base/system/diskpart/interpreter.c +++ b/base/system/diskpart/interpreter.c @@ -25,7 +25,10 @@ COMMAND cmds[] = {L"BREAK", NULL, NULL, break_main, IDS_HELP_BREAK, MSG_COMMAND_BREAK}, {L"CLEAN", NULL, NULL, clean_main, IDS_HELP_CLEAN, MSG_COMMAND_CLEAN}, {L"COMPACT", NULL, NULL, compact_main, IDS_HELP_COMPACT, MSG_COMMAND_COMPACT}, - {L"CONVERT", NULL, NULL, convert_main, IDS_HELP_CONVERT, MSG_COMMAND_CONVERT}, + + {L"CONVERT", NULL, NULL, NULL, IDS_HELP_CONVERT, MSG_NONE}, + {L"CONVERT", L"GPT", NULL, ConvertGPT, IDS_HELP_CONVERT_GPT, MSG_COMMAND_CONVERT_GPT}, + {L"CONVERT", L"MBR", NULL, ConvertMBR, IDS_HELP_CONVERT_MBR, MSG_COMMAND_CONVERT_MBR}, {L"CREATE", NULL, NULL, NULL, IDS_HELP_CREATE, MSG_NONE}, {L"CREATE", L"PARTITION", NULL, NULL, IDS_HELP_CREATE_PARTITION, MSG_NONE}, diff --git a/base/system/diskpart/lang/de-DE.rc b/base/system/diskpart/lang/de-DE.rc index e8a71bd93f1..733d505c2c2 100644 --- a/base/system/diskpart/lang/de-DE.rc +++ b/base/system/diskpart/lang/de-DE.rc @@ -29,6 +29,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nDer gewählte Datenträger ist zum Ausführen des Computers erforderlich und kann nicht bereinigt werden.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDie angegebene Partition konnte nicht erstellt werden.\n" @@ -44,7 +54,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disk ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disk ID: %s\n" IDS_DETAIL_INFO_TYPE "Type" IDS_DETAIL_INFO_STATUS "Status" IDS_DETAIL_INFO_PATH "Path : %hu\n" @@ -165,7 +175,10 @@ BEGIN IDS_HELP_BREAK "Teilt eine Spiegelung auf.\n" IDS_HELP_CLEAN "Löscht die Konfigurationsinformationen oder alle\n Informationen vom Datenträger.\n" IDS_HELP_COMPACT "Versucht, die physische Größe der Datei zu reduzieren.\n" + IDS_HELP_CONVERT "Konvertiert zwischen Datenträgerformaten.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Erstellt ein Volume, eine Partition oder einen virtuellen\n Datenträger.\n" IDS_HELP_CREATE_PARTITION "Erstellt eine Partition.\n" diff --git a/base/system/diskpart/lang/en-US.rc b/base/system/diskpart/lang/en-US.rc index 0d29bdad392..ab6fa71b437 100644 --- a/base/system/diskpart/lang/en-US.rc +++ b/base/system/diskpart/lang/en-US.rc @@ -29,6 +29,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nThe selected disk is neccessary to the operation of your computer, and may not be cleaned.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart was unable to create the specified partition.\n" @@ -44,7 +54,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disk ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disk ID: %s\n" IDS_DETAIL_INFO_TYPE "Type" IDS_DETAIL_INFO_STATUS "Status" IDS_DETAIL_INFO_PATH "Path : %hu\n" @@ -165,7 +175,10 @@ BEGIN IDS_HELP_BREAK "Break a mirror set.\n" IDS_HELP_CLEAN "Clear the configuration information, or all information, off\n the disk.\n" IDS_HELP_COMPACT "Attempts to reduce the physical size of the file.\n" - IDS_HELP_CONVERT "Convert between different disk formats.\n" + + IDS_HELP_CONVERT "Converts between different disk formats.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Create a volume, partition, or virtual disk.\n" IDS_HELP_CREATE_PARTITION "Create a partition.\n" diff --git a/base/system/diskpart/lang/it-IT.rc b/base/system/diskpart/lang/it-IT.rc index 263ab015d7a..2b8fcdc3462 100644 --- a/base/system/diskpart/lang/it-IT.rc +++ b/base/system/diskpart/lang/it-IT.rc @@ -36,6 +36,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nIl disco selezionato è necessario per il funzionamento del computer e non può essere pulito.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart non è stato in grado di creare la partizione specificata.\n" @@ -51,7 +61,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "ID Disco: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "ID Disco: %s\n" IDS_DETAIL_INFO_TYPE "Tipo" IDS_DETAIL_INFO_STATUS "Stato" IDS_DETAIL_INFO_PATH "Percorso : %hu\n" @@ -172,7 +182,10 @@ BEGIN IDS_HELP_BREAK "Interrompi la replicazione su un disco mirror.\n" IDS_HELP_CLEAN "Cancella le informazioni sulla configurazione o tutte le informazioni dal\n disco.\n" IDS_HELP_COMPACT "Tenta di ridurre la grandezza fisica del file.\n" + IDS_HELP_CONVERT "Converti tra formati dischi differenti.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Crea volume, partizione o disco virtuale.\n" IDS_HELP_CREATE_PARTITION "Crea una partizione.\n" diff --git a/base/system/diskpart/lang/pl-PL.rc b/base/system/diskpart/lang/pl-PL.rc index c8529af81b5..0fafe271fec 100644 --- a/base/system/diskpart/lang/pl-PL.rc +++ b/base/system/diskpart/lang/pl-PL.rc @@ -29,6 +29,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nWybrany dysk jest niezbędny do działania tego komputera, nie może być wyczyszczony.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart nie może utworzyć określonej partycji.\n" @@ -44,7 +54,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Dysk ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Dysk ID: %s\n" IDS_DETAIL_INFO_TYPE "Typ" IDS_DETAIL_INFO_STATUS "Stan" IDS_DETAIL_INFO_PATH "Ścieżka : %hu\n" @@ -165,7 +175,10 @@ BEGIN IDS_HELP_BREAK "Dzieli zestaw dublowania.\n" IDS_HELP_CLEAN "Usuń informacje o konfiguracji lub wszystkie informacje\n z dysku.\n" IDS_HELP_COMPACT "Próbuje zmniejszyć fizyczny rozmiaru pliku.\n" + IDS_HELP_CONVERT "Konwertuje między różnymi formatami dysków.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Tworzy wolumin, partycję, lub dysk wirtualny.\n" IDS_HELP_CREATE_PARTITION "Tworzy partycję.\n" diff --git a/base/system/diskpart/lang/pt-PT.rc b/base/system/diskpart/lang/pt-PT.rc index 4fdc4fbcefb..ee7c72ce722 100644 --- a/base/system/diskpart/lang/pt-PT.rc +++ b/base/system/diskpart/lang/pt-PT.rc @@ -31,6 +31,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nThe selected disk is neccessary to the operation of your computer, and may not be cleaned.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart was unable to create the specified partition.\n" @@ -46,7 +56,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disco ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disco ID: %s\n" IDS_DETAIL_INFO_TYPE "Tipo" IDS_DETAIL_INFO_STATUS "Estado" IDS_DETAIL_INFO_PATH "Caminho : %hu\n" @@ -167,7 +177,10 @@ BEGIN IDS_HELP_BREAK "Quebrar duplição.\n" IDS_HELP_CLEAN "Apagar a informção de configuração, or toda a informção, desliga\n o disco.\n" IDS_HELP_COMPACT "Tenta reduzir o tamanho físico do ficheiro.\n" + IDS_HELP_CONVERT "Converter entre diferentes formatos.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Criar volume,partição ou disco virtual.\n" IDS_HELP_CREATE_PARTITION "Create a partition.\n" diff --git a/base/system/diskpart/lang/ro-RO.rc b/base/system/diskpart/lang/ro-RO.rc index 8a1f4dbd693..d354f90d1a1 100644 --- a/base/system/diskpart/lang/ro-RO.rc +++ b/base/system/diskpart/lang/ro-RO.rc @@ -37,6 +37,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nDiscul selectat este necesar pentru funcționarea calculatorului dumneavoastră și este posibil să nu fie curățat.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart nu a reușit să creeze partiția specificată.\n" @@ -52,7 +62,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disc ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disc ID: %s\n" IDS_DETAIL_INFO_TYPE "Tip" IDS_DETAIL_INFO_STATUS "Stare" IDS_DETAIL_INFO_PATH "Cale : %hu\n" @@ -173,7 +183,10 @@ BEGIN IDS_HELP_BREAK "Șterge configurația în oglindă.\n" IDS_HELP_CLEAN "Elimină informațiile de configurare, sau toate informațiile,\n de pe disc.\n" IDS_HELP_COMPACT "Încearcă reducerea dimensiunii fizice a fișierului.\n" + IDS_HELP_CONVERT "Convertește în diverse formate de disc.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Crează un volum, o partiție, sau un disc virtual.\n" IDS_HELP_CREATE_PARTITION "Creează o partiție.\n" diff --git a/base/system/diskpart/lang/ru-RU.rc b/base/system/diskpart/lang/ru-RU.rc index c689015ff4a..0ec51f8571b 100644 --- a/base/system/diskpart/lang/ru-RU.rc +++ b/base/system/diskpart/lang/ru-RU.rc @@ -31,6 +31,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nThe selected disk is neccessary to the operation of your computer, and may not be cleaned.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart was unable to create the specified partition.\n" @@ -46,7 +56,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disk ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disk ID: %s\n" IDS_DETAIL_INFO_TYPE "Тип" IDS_DETAIL_INFO_STATUS "Состояние" IDS_DETAIL_INFO_PATH "Path : %hu\n" @@ -167,7 +177,10 @@ BEGIN IDS_HELP_BREAK "Разбиение зеркального набора.\n" IDS_HELP_CLEAN "Очистка сведений о конфигурации или всех данных на диске.\n" IDS_HELP_COMPACT "Попытки уменьшения физического размера файла.\n" + IDS_HELP_CONVERT "Преобразование форматов диска.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Создание тома, раздела или виртуального диска.\n" IDS_HELP_CREATE_PARTITION "Create a partition.\n" diff --git a/base/system/diskpart/lang/sq-AL.rc b/base/system/diskpart/lang/sq-AL.rc index f7945ec1acf..9a0c8943218 100644 --- a/base/system/diskpart/lang/sq-AL.rc +++ b/base/system/diskpart/lang/sq-AL.rc @@ -33,6 +33,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nThe selected disk is neccessary to the operation of your computer, and may not be cleaned.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart was unable to create the specified partition.\n" @@ -48,7 +58,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disk ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disk ID: %s\n" IDS_DETAIL_INFO_TYPE "Tipi" IDS_DETAIL_INFO_STATUS "Gjendja" IDS_DETAIL_INFO_PATH "Path : %hu\n" @@ -169,7 +179,10 @@ BEGIN IDS_HELP_BREAK "Thyen nje sere lidhjesh.\n" IDS_HELP_CLEAN "Pastron iformacionet e konfigurimit, ose të gjitha informacionet, e\n diskut.\n" IDS_HELP_COMPACT "Tenton te ul masen fizike te dokumentit.\n" + IDS_HELP_CONVERT "Konverton formatet e ndryshme ne disk.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Krijon një volum, particion, ose disk virtual.\n" IDS_HELP_CREATE_PARTITION "Create a partition.\n" diff --git a/base/system/diskpart/lang/tr-TR.rc b/base/system/diskpart/lang/tr-TR.rc index d755605a5c3..52c5eefe247 100644 --- a/base/system/diskpart/lang/tr-TR.rc +++ b/base/system/diskpart/lang/tr-TR.rc @@ -39,6 +39,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nSeçilen disk, bilgisayarınızın çalışması için gereklidir ve temizlenemez.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart belirtilen bölümü oluşturamadı.\n" @@ -54,7 +64,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disk ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disk ID: %s\n" IDS_DETAIL_INFO_TYPE "Tür" IDS_DETAIL_INFO_STATUS "Durum" IDS_DETAIL_INFO_PATH "Yol : %hu\n" @@ -175,7 +185,10 @@ BEGIN IDS_HELP_BREAK "Bir yansıma yığını ayır.\n" IDS_HELP_CLEAN "Diskin yapılandırma bilgisini ya da tüm bilgisini sil.\n" IDS_HELP_COMPACT "Dosyanın fiziki boyutunu düşürmeye çalışır.\n" + IDS_HELP_CONVERT "Farklı disk biçimleri arasında dönüştür.\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "Bir birim, bölüm ya da sanal disk oluştur.\n" IDS_HELP_CREATE_PARTITION "Bir bölüm oluşturun.\n" diff --git a/base/system/diskpart/lang/zh-CN.rc b/base/system/diskpart/lang/zh-CN.rc index aa40d56eae6..7aa28db8727 100644 --- a/base/system/diskpart/lang/zh-CN.rc +++ b/base/system/diskpart/lang/zh-CN.rc @@ -38,6 +38,16 @@ BEGIN IDS_CLEAN_SYSTEM "\nThe selected disk is neccessary to the operation of your computer, and may not be cleaned.\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart was unable to create the specified partition.\n" @@ -53,7 +63,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "Disk ID: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "Disk ID: %s\n" IDS_DETAIL_INFO_TYPE "类型" IDS_DETAIL_INFO_STATUS "状态" IDS_DETAIL_INFO_PATH "Path : %hu\n" @@ -174,7 +184,10 @@ BEGIN IDS_HELP_BREAK "中断镜像集。\n" IDS_HELP_CLEAN "清除配置信息或所有信息,关闭\n 磁盘。\n" IDS_HELP_COMPACT "尝试减少文件的物理大小。\n" + IDS_HELP_CONVERT "在不同的磁盘格式之间进行转换。\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "创建卷、分区或虚拟磁盘。\n" IDS_HELP_CREATE_PARTITION "Create a partition.\n" diff --git a/base/system/diskpart/lang/zh-TW.rc b/base/system/diskpart/lang/zh-TW.rc index 11b68b807c6..54ceb431dac 100644 --- a/base/system/diskpart/lang/zh-TW.rc +++ b/base/system/diskpart/lang/zh-TW.rc @@ -38,6 +38,16 @@ BEGIN IDS_CLEAN_SYSTEM "\n已選擇的磁碟是您的電腦操作所必要的,所以無法清理。\n" END +STRINGTABLE +BEGIN + IDS_CONVERT_GPT_ALREADY "\nThe selected Disk can not be converted because it has already been GPT formatted.\n" + IDS_CONVERT_GPT_NOT_EMPTY "\nThe selected Disk can not be converted to the GPT format.\nSelect an empty MBR Disk for conversion.\n" + IDS_CONVERT_GPT_SUCCESS "\nThe selected Disk was successfully converted to the GPT format.\n" + IDS_CONVERT_MBR_ALREADY "\nThe selected Disk can not be converted because it has already been MBR formatted.\n" + IDS_CONVERT_MBR_NOT_EMPTY "\nThe selected Disk can not be converted to the MBR format.\nSelect an empty GPT Disk for conversion.\n" + IDS_CONVERT_MBR_SUCCESS "\nThe selected Disk was successfully converted to the MBR format.\n" +END + STRINGTABLE BEGIN IDS_CREATE_PARTITION_FAIL "\nDiskPart 無法建立指定的磁碟分割。\n" @@ -53,7 +63,7 @@ END /* Disk Information Labels */ STRINGTABLE BEGIN - IDS_DETAIL_INFO_DISK_ID "磁碟識別碼: %08lx\n" + IDS_DETAIL_INFO_DISK_ID "磁碟識別碼: %s\n" IDS_DETAIL_INFO_TYPE "類型" IDS_DETAIL_INFO_STATUS "狀態" IDS_DETAIL_INFO_PATH "路徑 : %hu\n" @@ -174,7 +184,10 @@ BEGIN IDS_HELP_BREAK "中斷一個鏡像組。\n" IDS_HELP_CLEAN "清除磁碟上的設定資訊或所有資訊。\n" IDS_HELP_COMPACT "嘗試減少檔案的物理大小。\n" + IDS_HELP_CONVERT "轉換不同的磁碟格式。\n" + IDS_HELP_CONVERT_GPT "Converts an MBR disk to the GPT format.\n" + IDS_HELP_CONVERT_MBR "Converts a GPT disk to the MBR format.\n" IDS_HELP_CREATE "建立一個磁碟區、磁碟分割或虛擬磁碟。\n" IDS_HELP_CREATE_PARTITION "建立一個磁碟分割。\n" diff --git a/base/system/diskpart/misc.c b/base/system/diskpart/misc.c index a4819d4751b..eb8e45e4917 100644 --- a/base/system/diskpart/misc.c +++ b/base/system/diskpart/misc.c @@ -146,3 +146,59 @@ DuplicateString( return pszOutString; } + + +VOID +CreateGUID( + _Out_ GUID *pGuid) +{ + RtlGenRandom(pGuid, sizeof(*pGuid)); + /* Clear the version bits and set the version (4) */ + pGuid->Data3 &= 0x0fff; + pGuid->Data3 |= (4 << 12); + /* Set the topmost bits of Data4 (clock_seq_hi_and_reserved) as + * specified in RFC 4122, section 4.4. + */ + pGuid->Data4[0] &= 0x3f; + pGuid->Data4[0] |= 0x80; +} + + +VOID +CreateSignature( + _Out_ PDWORD pSignature) +{ + LARGE_INTEGER SystemTime; + TIME_FIELDS TimeFields; + PUCHAR Buffer; + + NtQuerySystemTime(&SystemTime); + RtlTimeToTimeFields(&SystemTime, &TimeFields); + + Buffer = (PUCHAR)pSignature; + Buffer[0] = (UCHAR)(TimeFields.Year & 0xFF) + (UCHAR)(TimeFields.Hour & 0xFF); + Buffer[1] = (UCHAR)(TimeFields.Year >> 8) + (UCHAR)(TimeFields.Minute & 0xFF); + Buffer[2] = (UCHAR)(TimeFields.Month & 0xFF) + (UCHAR)(TimeFields.Second & 0xFF); + Buffer[3] = (UCHAR)(TimeFields.Day & 0xFF) + (UCHAR)(TimeFields.Milliseconds & 0xFF); +} + + +VOID +PrintGUID( + _Out_ PWSTR pszBuffer, + _In_ GUID *pGuid) +{ + swprintf(pszBuffer, + L"%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + pGuid->Data1, + pGuid->Data2, + pGuid->Data3, + pGuid->Data4[0], + pGuid->Data4[1], + pGuid->Data4[2], + pGuid->Data4[3], + pGuid->Data4[4], + pGuid->Data4[5], + pGuid->Data4[6], + pGuid->Data4[7]); +} diff --git a/base/system/diskpart/partlist.c b/base/system/diskpart/partlist.c index 34ae0b336a2..49169e98df1 100644 --- a/base/system/diskpart/partlist.c +++ b/base/system/diskpart/partlist.c @@ -80,6 +80,57 @@ PVOLENTRY CurrentVolume = NULL; /* FUNCTIONS ******************************************************************/ +#ifdef DUMP_PARTITION_TABLE +VOID +DumpPartitionTable( + _In_ PDISKENTRY DiskEntry) +{ + PPARTITION_INFORMATION_EX PartitionInfo; + ULONG i; + + DbgPrint("\n"); + + if (DiskEntry->LayoutBuffer->PartitionStyle == PARTITION_STYLE_MBR) + { + DbgPrint("Index Start Length Hidden Nr Type Boot RW\n"); + DbgPrint("----- ------------ ------------ ---------- -- ---- ---- --\n"); + + for (i = 0; i < DiskEntry->LayoutBuffer->PartitionCount; i++) + { + PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[i]; + DbgPrint(" %3lu %12I64u %12I64u %10lu %2lu %2x %c %c\n", + i, + PartitionInfo->StartingOffset.QuadPart / DiskEntry->BytesPerSector, + PartitionInfo->PartitionLength.QuadPart / DiskEntry->BytesPerSector, + PartitionInfo->Mbr.HiddenSectors, + PartitionInfo->PartitionNumber, + PartitionInfo->Mbr.PartitionType, + PartitionInfo->Mbr.BootIndicator ? '*': ' ', + PartitionInfo->RewritePartition ? 'Y': 'N'); + } + } + else if (DiskEntry->LayoutBuffer->PartitionStyle == PARTITION_STYLE_GPT) + { + DbgPrint("Index Start Length Nr RW Type \n"); + DbgPrint("----- ------------ ------------ -- -- --------\n"); + for (i = 0; i < DiskEntry->LayoutBuffer->PartitionCount; i++) + { + PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[i]; + + DbgPrint(" %3lu %12I64u %12I64u %2lu %c %08lx\n", + i, + PartitionInfo->StartingOffset.QuadPart / DiskEntry->BytesPerSector, + PartitionInfo->PartitionLength.QuadPart / DiskEntry->BytesPerSector, + PartitionInfo->PartitionNumber, + PartitionInfo->RewritePartition ? 'Y': 'N', + PartitionInfo->Gpt.PartitionType.Data1); + } + } + + DbgPrint("\n"); +} +#endif + ULONGLONG AlignDown( _In_ ULONGLONG Value, @@ -761,6 +812,66 @@ ScanForUnpartitionedDiskSpace( } +VOID +ReadLayoutBuffer( + _In_ HANDLE FileHandle, + _In_ PDISKENTRY DiskEntry) +{ + ULONG LayoutBufferSize; + PDRIVE_LAYOUT_INFORMATION_EX NewLayoutBuffer; + IO_STATUS_BLOCK Iosb; + NTSTATUS Status; + + /* Allocate a layout buffer with 4 partition entries first */ + LayoutBufferSize = sizeof(DRIVE_LAYOUT_INFORMATION_EX) + + ((4 - ANYSIZE_ARRAY) * sizeof(PARTITION_INFORMATION_EX)); + DiskEntry->LayoutBuffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + LayoutBufferSize); + if (DiskEntry->LayoutBuffer == NULL) + { + DPRINT1("Failed to allocate the disk layout buffer!\n"); + return; + } + + for (;;) + { + DPRINT1("Buffer size: %lu\n", LayoutBufferSize); + Status = NtDeviceIoControlFile(FileHandle, + NULL, + NULL, + NULL, + &Iosb, + IOCTL_DISK_GET_DRIVE_LAYOUT_EX, + NULL, + 0, + DiskEntry->LayoutBuffer, + LayoutBufferSize); + if (NT_SUCCESS(Status)) + break; + + if (Status != STATUS_BUFFER_TOO_SMALL) + { + DPRINT1("NtDeviceIoControlFile() failed (Status: 0x%08lx)\n", Status); + return; + } + + LayoutBufferSize += 4 * sizeof(PARTITION_INFORMATION_EX); + NewLayoutBuffer = RtlReAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + DiskEntry->LayoutBuffer, + LayoutBufferSize); + if (NewLayoutBuffer == NULL) + { + DPRINT1("Failed to reallocate the disk layout buffer!\n"); + return; + } + + DiskEntry->LayoutBuffer = NewLayoutBuffer; + } +} + + static VOID AddDiskToList( @@ -781,8 +892,6 @@ AddDiskToList( ULONG i; PLIST_ENTRY ListEntry; PBIOSDISKENTRY BiosDiskEntry; - ULONG LayoutBufferSize; - PDRIVE_LAYOUT_INFORMATION_EX NewLayoutBuffer; Status = NtDeviceIoControlFile(FileHandle, NULL, @@ -967,53 +1076,7 @@ AddDiskToList( InsertAscendingList(&DiskListHead, DiskEntry, DISKENTRY, ListEntry, DiskNumber); - /* Allocate a layout buffer with 4 partition entries first */ - LayoutBufferSize = sizeof(DRIVE_LAYOUT_INFORMATION_EX) + - ((4 - ANYSIZE_ARRAY) * sizeof(PARTITION_INFORMATION_EX)); - DiskEntry->LayoutBuffer = RtlAllocateHeap(RtlGetProcessHeap(), - HEAP_ZERO_MEMORY, - LayoutBufferSize); - if (DiskEntry->LayoutBuffer == NULL) - { - DPRINT1("Failed to allocate the disk layout buffer!\n"); - return; - } - - for (;;) - { - DPRINT1("Buffer size: %lu\n", LayoutBufferSize); - Status = NtDeviceIoControlFile(FileHandle, - NULL, - NULL, - NULL, - &Iosb, - IOCTL_DISK_GET_DRIVE_LAYOUT_EX, - NULL, - 0, - DiskEntry->LayoutBuffer, - LayoutBufferSize); - if (NT_SUCCESS(Status)) - break; - - if (Status != STATUS_BUFFER_TOO_SMALL) - { - DPRINT1("NtDeviceIoControlFile() failed (Status: 0x%08lx)\n", Status); - return; - } - - LayoutBufferSize += 4 * sizeof(PARTITION_INFORMATION_EX); - NewLayoutBuffer = RtlReAllocateHeap(RtlGetProcessHeap(), - HEAP_ZERO_MEMORY, - DiskEntry->LayoutBuffer, - LayoutBufferSize); - if (NewLayoutBuffer == NULL) - { - DPRINT1("Failed to reallocate the disk layout buffer!\n"); - return; - } - - DiskEntry->LayoutBuffer = NewLayoutBuffer; - } + ReadLayoutBuffer(FileHandle, DiskEntry); DPRINT1("PartitionCount: %lu\n", DiskEntry->LayoutBuffer->PartitionCount); @@ -1977,6 +2040,7 @@ GetNextUnpartitionedEntry( return NULL; } + NTSTATUS DismountVolume( _In_ PPARTENTRY PartEntry) diff --git a/base/system/diskpart/resource.h b/base/system/diskpart/resource.h index f44f706fad6..51b5619c5f3 100644 --- a/base/system/diskpart/resource.h +++ b/base/system/diskpart/resource.h @@ -26,6 +26,13 @@ #define IDS_CLEAN_SUCCESS 1021 #define IDS_CLEAN_SYSTEM 1022 +#define IDS_CONVERT_GPT_ALREADY 1040 +#define IDS_CONVERT_GPT_NOT_EMPTY 1041 +#define IDS_CONVERT_GPT_SUCCESS 1042 +#define IDS_CONVERT_MBR_ALREADY 1043 +#define IDS_CONVERT_MBR_NOT_EMPTY 1044 +#define IDS_CONVERT_MBR_SUCCESS 1045 + #define IDS_CREATE_PARTITION_FAIL 1050 #define IDS_CREATE_PARTITION_SUCCESS 1051 @@ -121,68 +128,71 @@ #define IDS_HELP_BREAK 64 #define IDS_HELP_CLEAN 65 #define IDS_HELP_COMPACT 66 + #define IDS_HELP_CONVERT 67 +#define IDS_HELP_CONVERT_GPT 68 +#define IDS_HELP_CONVERT_MBR 69 -#define IDS_HELP_CREATE 68 -#define IDS_HELP_CREATE_PARTITION 69 -#define IDS_HELP_CREATE_PARTITION_EFI 70 -#define IDS_HELP_CREATE_PARTITION_EXTENDED 71 -#define IDS_HELP_CREATE_PARTITION_LOGICAL 72 -#define IDS_HELP_CREATE_PARTITION_MSR 73 -#define IDS_HELP_CREATE_PARTITION_PRIMARY 74 -#define IDS_HELP_CREATE_VOLUME 75 -#define IDS_HELP_CREATE_VDISK 76 +#define IDS_HELP_CREATE 70 +#define IDS_HELP_CREATE_PARTITION 71 +#define IDS_HELP_CREATE_PARTITION_EFI 72 +#define IDS_HELP_CREATE_PARTITION_EXTENDED 73 +#define IDS_HELP_CREATE_PARTITION_LOGICAL 74 +#define IDS_HELP_CREATE_PARTITION_MSR 75 +#define IDS_HELP_CREATE_PARTITION_PRIMARY 76 +#define IDS_HELP_CREATE_VOLUME 77 +#define IDS_HELP_CREATE_VDISK 78 -#define IDS_HELP_DELETE 77 -#define IDS_HELP_DELETE_DISK 78 -#define IDS_HELP_DELETE_PARTITION 79 -#define IDS_HELP_DELETE_VOLUME 80 +#define IDS_HELP_DELETE 79 +#define IDS_HELP_DELETE_DISK 80 +#define IDS_HELP_DELETE_PARTITION 81 +#define IDS_HELP_DELETE_VOLUME 82 -#define IDS_HELP_DETACH 81 +#define IDS_HELP_DETACH 83 -#define IDS_HELP_DETAIL 82 -#define IDS_HELP_DETAIL_DISK 83 -#define IDS_HELP_DETAIL_PARTITION 84 -#define IDS_HELP_DETAIL_VOLUME 85 +#define IDS_HELP_DETAIL 84 +#define IDS_HELP_DETAIL_DISK 85 +#define IDS_HELP_DETAIL_PARTITION 86 +#define IDS_HELP_DETAIL_VOLUME 87 -#define IDS_HELP_EXIT 86 -#define IDS_HELP_EXPAND 87 -#define IDS_HELP_EXTEND 88 -#define IDS_HELP_FILESYSTEMS 89 -#define IDS_HELP_FORMAT 90 -#define IDS_HELP_GPT 91 -#define IDS_HELP_HELP 92 -#define IDS_HELP_IMPORT 93 -#define IDS_HELP_INACTIVE 94 +#define IDS_HELP_EXIT 88 +#define IDS_HELP_EXPAND 89 +#define IDS_HELP_EXTEND 90 +#define IDS_HELP_FILESYSTEMS 91 +#define IDS_HELP_FORMAT 92 +#define IDS_HELP_GPT 93 +#define IDS_HELP_HELP 94 +#define IDS_HELP_IMPORT 95 +#define IDS_HELP_INACTIVE 96 -#define IDS_HELP_LIST 95 -#define IDS_HELP_LIST_DISK 96 -#define IDS_HELP_LIST_PARTITION 97 -#define IDS_HELP_LIST_VOLUME 98 -#define IDS_HELP_LIST_VDISK 99 +#define IDS_HELP_LIST 97 +#define IDS_HELP_LIST_DISK 98 +#define IDS_HELP_LIST_PARTITION 99 +#define IDS_HELP_LIST_VOLUME 100 +#define IDS_HELP_LIST_VDISK 101 -#define IDS_HELP_MERGE 100 -#define IDS_HELP_ONLINE 101 -#define IDS_HELP_OFFLINE 102 -#define IDS_HELP_RECOVER 103 -#define IDS_HELP_REM 104 -#define IDS_HELP_REMOVE 105 -#define IDS_HELP_REPAIR 106 -#define IDS_HELP_RESCAN 107 -#define IDS_HELP_RETAIN 108 -#define IDS_HELP_SAN 109 +#define IDS_HELP_MERGE 102 +#define IDS_HELP_ONLINE 103 +#define IDS_HELP_OFFLINE 104 +#define IDS_HELP_RECOVER 105 +#define IDS_HELP_REM 106 +#define IDS_HELP_REMOVE 107 +#define IDS_HELP_REPAIR 108 +#define IDS_HELP_RESCAN 109 +#define IDS_HELP_RETAIN 110 +#define IDS_HELP_SAN 111 -#define IDS_HELP_SELECT 110 -#define IDS_HELP_SELECT_DISK 111 -#define IDS_HELP_SELECT_PARTITION 112 -#define IDS_HELP_SELECT_VOLUME 113 -#define IDS_HELP_SELECT_VDISK 114 +#define IDS_HELP_SELECT 112 +#define IDS_HELP_SELECT_DISK 113 +#define IDS_HELP_SELECT_PARTITION 114 +#define IDS_HELP_SELECT_VOLUME 115 +#define IDS_HELP_SELECT_VDISK 116 -#define IDS_HELP_SETID 115 -#define IDS_HELP_SHRINK 116 +#define IDS_HELP_SETID 117 +#define IDS_HELP_SHRINK 118 -#define IDS_HELP_UNIQUEID 117 -#define IDS_HELP_UNIQUEID_DISK 118 +#define IDS_HELP_UNIQUEID 119 +#define IDS_HELP_UNIQUEID_DISK 120 #define IDS_ERROR_MSG_NO_SCRIPT 2000 #define IDS_ERROR_MSG_BAD_ARG 2001 diff --git a/base/system/diskpart/uniqueid.c b/base/system/diskpart/uniqueid.c index dacf570d027..7eb467dee8b 100644 --- a/base/system/diskpart/uniqueid.c +++ b/base/system/diskpart/uniqueid.c @@ -18,6 +18,7 @@ UniqueIdDisk( _In_ INT argc, _In_ PWSTR *argv) { + WCHAR szBuffer[40]; PWSTR pszSuffix = NULL; ULONG ulValue; @@ -30,7 +31,13 @@ UniqueIdDisk( if (argc == 2) { ConPuts(StdOut, L"\n"); - ConPrintf(StdOut, L"Disk ID: %08lx\n", CurrentDisk->LayoutBuffer->Mbr.Signature); + if (CurrentDisk->LayoutBuffer->PartitionStyle == PARTITION_STYLE_GPT) + PrintGUID(szBuffer, &CurrentDisk->LayoutBuffer->Gpt.DiskId); + else if (CurrentDisk->LayoutBuffer->PartitionStyle == PARTITION_STYLE_MBR) + swprintf(szBuffer, L"%08lx", CurrentDisk->LayoutBuffer->Mbr.Signature); + else + wcscpy(szBuffer, L"00000000"); + ConPrintf(StdOut, L"Disk ID: %s\n", szBuffer); ConPuts(StdOut, L"\n"); return TRUE; }