From bf8741d208896e59a81957af4ee24fcf00c5afef Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 14 Dec 2025 20:23:03 +0100 Subject: [PATCH] [DISKPART] Implement the 'create partition efi' and 'create partition msr' commands --- base/system/diskpart/create.c | 380 ++++++++++++++++ base/system/diskpart/diskpart.h | 10 + base/system/diskpart/diskpart_msg.mc | 657 ++++++++++++++++++++++++++- base/system/diskpart/interpreter.c | 4 +- 4 files changed, 1029 insertions(+), 22 deletions(-) diff --git a/base/system/diskpart/create.c b/base/system/diskpart/create.c index bd467202829..3097cf05261 100644 --- a/base/system/diskpart/create.c +++ b/base/system/diskpart/create.c @@ -12,6 +12,196 @@ #include +BOOL +CreateEfiPartition( + _In_ INT argc, + _In_ PWSTR *argv) +{ + PPARTENTRY PartEntry, NewPartEntry; + PLIST_ENTRY ListEntry; + ULONGLONG ullSize = 0ULL; + ULONGLONG ullSectorCount; +#if 0 + ULONGLONG ullOffset = 0ULL; + BOOL bNoErr = FALSE; +#endif + INT i; + PWSTR pszSuffix = NULL; + NTSTATUS Status; + + DPRINT1("CreateEfiPartition()\n"); + + if (CurrentDisk == NULL) + { + ConResPuts(StdOut, IDS_SELECT_NO_DISK); + return TRUE; + } + + if (CurrentDisk->PartitionStyle != PARTITION_STYLE_GPT) + { + ConResPuts(StdOut, IDS_CREATE_PARTITION_INVALID_STYLE); + return TRUE; + } + + for (i = 3; i < argc; i++) + { + if (HasPrefix(argv[i], L"size=", &pszSuffix)) + { + /* size= (MB) */ + DPRINT("Size : %s\n", pszSuffix); + + ullSize = _wcstoui64(pszSuffix, NULL, 10); + if ((ullSize == 0) && (errno == ERANGE)) + { + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); + return TRUE; + } + } + else if (HasPrefix(argv[i], L"offset=", &pszSuffix)) + { + /* offset= (KB) */ + DPRINT("Offset : %s\n", pszSuffix); + ConPuts(StdOut, L"The OFFSET option is not supported yet!\n"); +#if 0 + ullOffset = _wcstoui64(pszSuffix, NULL, 10); + if ((ullOffset == 0) && (errno == ERANGE)) + { + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); + return TRUE; + } +#endif + } + else if (_wcsicmp(argv[i], L"noerr") == 0) + { + /* noerr */ + DPRINT("NoErr\n", pszSuffix); + ConPuts(StdOut, L"The NOERR option is not supported yet!\n"); +#if 0 + bNoErr = TRUE; +#endif + } + else + { + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); + return TRUE; + } + } + + DPRINT1("Size: %I64u\n", ullSize); +#if 0 + DPRINT1("Offset: %I64u\n", ullOffset); +#endif + + /* Size */ + if (ullSize != 0) + ullSectorCount = (ullSize * 1024 * 1024) / CurrentDisk->BytesPerSector; + else + ullSectorCount = 0; + + DPRINT1("SectorCount: %I64u\n", ullSectorCount); + +#ifdef DUMP_PARTITION_LIST + DumpPartitionList(CurrentDisk); +#endif + + for (ListEntry = CurrentDisk->PrimaryPartListHead.Flink; + ListEntry != &CurrentDisk->PrimaryPartListHead; + ListEntry = ListEntry->Flink) + { + PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry); + if (PartEntry->IsPartitioned) + continue; + + if (ullSectorCount == 0) + { + DPRINT("Claim whole unused space!\n"); + PartEntry->IsPartitioned = TRUE; + PartEntry->New = TRUE; + CopyMemory(&PartEntry->Gpt.PartitionType, &PARTITION_SYSTEM_GUID, sizeof(GUID)); + CreateGUID(&PartEntry->Gpt.PartitionId); + PartEntry->Gpt.Attributes = 0ULL; + PartEntry->PartitionNumber = 0; + PartEntry->FormatState = Unformatted; + PartEntry->FileSystemName[0] = L'\0'; + + CurrentPartition = PartEntry; + CurrentDisk->Dirty = TRUE; + break; + } + else + { + if (ullSectorCount == PartEntry->SectorCount.QuadPart) + { + DPRINT("Claim matching unused space!\n"); + PartEntry->IsPartitioned = TRUE; + PartEntry->New = TRUE; + CopyMemory(&PartEntry->Gpt.PartitionType, &PARTITION_SYSTEM_GUID, sizeof(GUID)); + CreateGUID(&PartEntry->Gpt.PartitionId); + PartEntry->Gpt.Attributes = 0ULL; + PartEntry->PartitionNumber = 0; + PartEntry->FormatState = Unformatted; + PartEntry->FileSystemName[0] = L'\0'; + + CurrentPartition = PartEntry; + CurrentDisk->Dirty = TRUE; + break; + } + else if (ullSectorCount < PartEntry->SectorCount.QuadPart) + { + DPRINT("Claim part of unused space\n"); + NewPartEntry = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PPARTENTRY)); + if (NewPartEntry == NULL) + { + ConPuts(StdOut, L"Memory allocation failed!\n"); + return TRUE; + } + + NewPartEntry->DiskEntry = PartEntry->DiskEntry; + + NewPartEntry->StartSector.QuadPart = PartEntry->StartSector.QuadPart; + NewPartEntry->SectorCount.QuadPart = ullSectorCount; + + NewPartEntry->LogicalPartition = FALSE; + NewPartEntry->IsPartitioned = TRUE; + NewPartEntry->New = TRUE; + CopyMemory(&NewPartEntry->Gpt.PartitionType, &PARTITION_SYSTEM_GUID, sizeof(GUID)); + CreateGUID(&NewPartEntry->Gpt.PartitionId); + NewPartEntry->Gpt.Attributes = 0ULL; + NewPartEntry->PartitionNumber = 0; + NewPartEntry->FormatState = Unformatted; + NewPartEntry->FileSystemName[0] = L'\0'; + + PartEntry->StartSector.QuadPart += ullSectorCount; + PartEntry->SectorCount.QuadPart -= ullSectorCount; + + InsertTailList(ListEntry, &NewPartEntry->ListEntry); + + CurrentPartition = NewPartEntry; + CurrentDisk->Dirty = TRUE; + break; + } + } + } + +#ifdef DUMP_PARTITION_LIST + DumpPartitionList(CurrentDisk); +#endif + + UpdateGptDiskLayout(CurrentDisk, FALSE); + Status = WriteGptPartitions(CurrentDisk); + if (!NT_SUCCESS(Status)) + { + ConResPuts(StdOut, IDS_CREATE_PARTITION_FAIL); + CurrentPartition = NULL; + return TRUE; + } + + ConResPuts(StdOut, IDS_CREATE_PARTITION_SUCCESS); + + return TRUE; +} + + BOOL CreateExtendedPartition( _In_ INT argc, @@ -417,6 +607,196 @@ CreateLogicalPartition( } +BOOL +CreateMsrPartition( + _In_ INT argc, + _In_ PWSTR *argv) +{ + PPARTENTRY PartEntry, NewPartEntry; + PLIST_ENTRY ListEntry; + ULONGLONG ullSize = 0ULL; + ULONGLONG ullSectorCount; +#if 0 + ULONGLONG ullOffset = 0ULL; + BOOL bNoErr = FALSE; +#endif + INT i; + PWSTR pszSuffix = NULL; + NTSTATUS Status; + + DPRINT1("CreateMsrPartition()\n"); + + if (CurrentDisk == NULL) + { + ConResPuts(StdOut, IDS_SELECT_NO_DISK); + return TRUE; + } + + if (CurrentDisk->PartitionStyle != PARTITION_STYLE_GPT) + { + ConResPuts(StdOut, IDS_CREATE_PARTITION_INVALID_STYLE); + return TRUE; + } + + for (i = 3; i < argc; i++) + { + if (HasPrefix(argv[i], L"size=", &pszSuffix)) + { + /* size= (MB) */ + DPRINT("Size : %s\n", pszSuffix); + + ullSize = _wcstoui64(pszSuffix, NULL, 10); + if ((ullSize == 0) && (errno == ERANGE)) + { + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); + return TRUE; + } + } + else if (HasPrefix(argv[i], L"offset=", &pszSuffix)) + { + /* offset= (KB) */ + DPRINT("Offset : %s\n", pszSuffix); + ConPuts(StdOut, L"The OFFSET option is not supported yet!\n"); +#if 0 + ullOffset = _wcstoui64(pszSuffix, NULL, 10); + if ((ullOffset == 0) && (errno == ERANGE)) + { + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); + return TRUE; + } +#endif + } + else if (_wcsicmp(argv[i], L"noerr") == 0) + { + /* noerr */ + DPRINT("NoErr\n", pszSuffix); + ConPuts(StdOut, L"The NOERR option is not supported yet!\n"); +#if 0 + bNoErr = TRUE; +#endif + } + else + { + ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); + return TRUE; + } + } + + DPRINT1("Size: %I64u\n", ullSize); +#if 0 + DPRINT1("Offset: %I64u\n", ullOffset); +#endif + + /* Size */ + if (ullSize != 0) + ullSectorCount = (ullSize * 1024 * 1024) / CurrentDisk->BytesPerSector; + else + ullSectorCount = 0; + + DPRINT1("SectorCount: %I64u\n", ullSectorCount); + +#ifdef DUMP_PARTITION_LIST + DumpPartitionList(CurrentDisk); +#endif + + for (ListEntry = CurrentDisk->PrimaryPartListHead.Flink; + ListEntry != &CurrentDisk->PrimaryPartListHead; + ListEntry = ListEntry->Flink) + { + PartEntry = CONTAINING_RECORD(ListEntry, PARTENTRY, ListEntry); + if (PartEntry->IsPartitioned) + continue; + + if (ullSectorCount == 0) + { + DPRINT("Claim whole unused space!\n"); + PartEntry->IsPartitioned = TRUE; + PartEntry->New = TRUE; + CopyMemory(&PartEntry->Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID, sizeof(GUID)); + CreateGUID(&PartEntry->Gpt.PartitionId); + PartEntry->Gpt.Attributes = 0ULL; + PartEntry->PartitionNumber = 0; + PartEntry->FormatState = Unformatted; + PartEntry->FileSystemName[0] = L'\0'; + + CurrentPartition = PartEntry; + CurrentDisk->Dirty = TRUE; + break; + } + else + { + if (ullSectorCount == PartEntry->SectorCount.QuadPart) + { + DPRINT("Claim matching unused space!\n"); + PartEntry->IsPartitioned = TRUE; + PartEntry->New = TRUE; + CopyMemory(&PartEntry->Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID, sizeof(GUID)); + CreateGUID(&PartEntry->Gpt.PartitionId); + PartEntry->Gpt.Attributes = 0ULL; + PartEntry->PartitionNumber = 0; + PartEntry->FormatState = Unformatted; + PartEntry->FileSystemName[0] = L'\0'; + + CurrentPartition = PartEntry; + CurrentDisk->Dirty = TRUE; + break; + } + else if (ullSectorCount < PartEntry->SectorCount.QuadPart) + { + DPRINT("Claim part of unused space\n"); + NewPartEntry = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PPARTENTRY)); + if (NewPartEntry == NULL) + { + ConPuts(StdOut, L"Memory allocation failed!\n"); + return TRUE; + } + + NewPartEntry->DiskEntry = PartEntry->DiskEntry; + + NewPartEntry->StartSector.QuadPart = PartEntry->StartSector.QuadPart; + NewPartEntry->SectorCount.QuadPart = ullSectorCount; + + NewPartEntry->LogicalPartition = FALSE; + NewPartEntry->IsPartitioned = TRUE; + NewPartEntry->New = TRUE; + CopyMemory(&NewPartEntry->Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID, sizeof(GUID)); + CreateGUID(&NewPartEntry->Gpt.PartitionId); + NewPartEntry->Gpt.Attributes = 0ULL; + NewPartEntry->PartitionNumber = 0; + NewPartEntry->FormatState = Unformatted; + NewPartEntry->FileSystemName[0] = L'\0'; + + PartEntry->StartSector.QuadPart += ullSectorCount; + PartEntry->SectorCount.QuadPart -= ullSectorCount; + + InsertTailList(ListEntry, &NewPartEntry->ListEntry); + + CurrentPartition = NewPartEntry; + CurrentDisk->Dirty = TRUE; + break; + } + } + } + +#ifdef DUMP_PARTITION_LIST + DumpPartitionList(CurrentDisk); +#endif + + UpdateGptDiskLayout(CurrentDisk, FALSE); + Status = WriteGptPartitions(CurrentDisk); + if (!NT_SUCCESS(Status)) + { + ConResPuts(StdOut, IDS_CREATE_PARTITION_FAIL); + CurrentPartition = NULL; + return TRUE; + } + + ConResPuts(StdOut, IDS_CREATE_PARTITION_SUCCESS); + + return TRUE; +} + + static VOID CreatePrimaryMbrPartition( diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h index 9f293c12601..06e4db8deb9 100644 --- a/base/system/diskpart/diskpart.h +++ b/base/system/diskpart/diskpart.h @@ -297,6 +297,11 @@ ConvertMBR( _In_ PWSTR *argv); /* create.c */ +BOOL +CreateEfiPartition( + _In_ INT argc, + _In_ PWSTR *argv); + BOOL CreateExtendedPartition( _In_ INT argc, @@ -307,6 +312,11 @@ CreateLogicalPartition( _In_ INT argc, _In_ PWSTR *argv); +BOOL +CreateMsrPartition( + _In_ INT argc, + _In_ PWSTR *argv); + BOOL CreatePrimaryPartition( _In_ INT argc, diff --git a/base/system/diskpart/diskpart_msg.mc b/base/system/diskpart/diskpart_msg.mc index 3913d43c924..c6b1a5915d1 100644 --- a/base/system/diskpart/diskpart_msg.mc +++ b/base/system/diskpart/diskpart_msg.mc @@ -1182,34 +1182,286 @@ SymbolicName=MSG_COMMAND_CREATE_PARTITION_EFI Severity=Informational Facility=System Language=English - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=German - + Erstellt eine EFI-Systempartition (Extensible Firmware Interface) + auf einem GPT-Datenträger (GPT = GUID-Partitionstabelle). + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= Die Größe der Partition in MB. Falls keine Größe angegeben + ist, wird die Partition erweitert, bis im aktuellen Bereich + kein freier Speicherplatz mehr vorhanden ist. + + OFFSET= Das Offset, in Kilobytes (KB), an dem die Partition + erstellt wird. Falls kein Offset angegeben ist, wird + die Partition im ersten Datenträgerbereich angelegt, der + eine ausreichende Größe für die Partition hat. + + 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. + + Nachdem die Partition erstellt wurde, erhält die neue Partition + den Fokus. + + Damit dieser Vorgang erfolgreich ausgeführt werden kann, muss ein + GPT-Basisdatenträger ausgewählt sein. + +Beispiel: + + CREATE PARTITION EFI SIZE=1000 . Language=Polish - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=Portugese - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=Romanian - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=Russian - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=Albanian - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=Turkish - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=Chinese - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . Language=Taiwanese - + Creates an Extensible Firmware Interface (EFI) system partition on a GUID + partition table (GPT) disk. + +Syntax: CREATE PARTITION EFI [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). If no size is + given, the partition continues until there is no more free + space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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. + + After the partition has been created, the focus is given to the new + partition. + + A basic GPT disk must be selected for this operation to succeed. + +Example: + + CREATE PARTITION EFI SIZE=1000 . @@ -1968,34 +2220,399 @@ SymbolicName=MSG_COMMAND_CREATE_PARTITION_MSR Severity=Informational Facility=System Language=English - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=German - + Erstellt eine MSR-Partition (Microsoft Reserved) auf einem GPT-Datenträger + (GPT = GUID-Partitionstabelle). + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= Die Größe der Partition in MB. Die Länge der Partition in + Byte entspricht mindestens dem durch N angegebenen Wert. Falls + keine Größe angegeben ist, wird die Partition erweitert, bis + sie den gesamten freien Speicherplatz im aktuellen Bereich + umfasst. + + OFFSET= Das Offset, in Kilobyte (KB), an dem die Partition erstellt + wird. Falls kein Offset angegeben ist, wird die Partition im + ersten Datenträgerbereich erstellt, der eine ausreichende Größe + für die Partition hat. + + NOERR Nur für Skripting. Bei einem Fehler setzt DiskPart die + Verarbeitung von Befehlen fort, als sei der Fehler nicht. + 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- + Basisdatenträger ausgewählt sein. + + Achtung: + + Gehen Sie bei Verwendung dieses Befehls mit äußerster Vorsicht vor. + Da GPT-Datenträger ein bestimmtes Partitionslayout erfordern, könnte + der Datenträger beim Erstellen von MSR-Partitionen unlesbar werden. + Auf GPT-Datenträgern, die zum Starten von ReactOS verwendet werden, ist + die EFI-Systempartition die erste Partition auf dem Datenträger, + gefolgt von der MSR-Partition. GPT-Datenträger, die nur zum Speichern + von Daten verwendet werden, haben keine, EFI-Systempartition. Die + MSR-Partition ist daher in einem solchen Fall die erste Partition. + + Von ReactOS werden online keine MSR-Partitionen bereitgestellt. + Auf MSR-Partitionen können Sie keine Daten speichern, und Sie können + MSR-Partitionen nicht löschen. + +Beispiel: + + CREATE PARTITION MSR SIZE=1000 . Language=Polish - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=Portugese - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=Romanian - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=Russian - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=Albanian - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=Turkish - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=Chinese - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . Language=Taiwanese - + Creates a Microsoft Reserved (MSR) partition on a GUID partition table + (GPT) disk. + +Syntax: CREATE PARTITION MSR [SIZE=] [OFFSET=] [NOERR] + + SIZE= The size of the partition in megabytes (MB). The partition is + at least as big in bytes as the number specified by N. If no + size is given, the partition continues until there is no more + free space in the current region. + + OFFSET= The offset, in kilobytes (KB), at which the partition is + created. If no offset is given, the partition is placed in the + first disk extent that is large enough to hold it. + + 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 basic GPT disk must be selected for this operation to succeed. + + Caution: + + Be very careful when using this command. Because GPT disks require a + specific partition layout, creating Microsoft Reserved partitions could + cause the disk to become unreadable. On GPT disks that are used to boot + ReactOS, the EFI System partition is the first partition on the disk, + followed by the Microsoft Reserved partition. GPT disks used only for + data storage do not have an EFI System partition, in which case the + Microsoft Reserved partition is the first partition. + + ReactOS does not online Microsoft Reserved partitions. You cannot store data + on them and you cannot delete them. + +Example: + + CREATE PARTITION MSR SIZE=1000 . diff --git a/base/system/diskpart/interpreter.c b/base/system/diskpart/interpreter.c index 2f5f12dc2dd..b49e3111b55 100644 --- a/base/system/diskpart/interpreter.c +++ b/base/system/diskpart/interpreter.c @@ -32,10 +32,10 @@ COMMAND cmds[] = {L"CREATE", NULL, NULL, NULL, IDS_HELP_CREATE, MSG_NONE}, {L"CREATE", L"PARTITION", NULL, NULL, IDS_HELP_CREATE_PARTITION, MSG_NONE}, -// {L"CREATE", L"PARTITION", L"EFI", CreateEfiPartition, IDS_HELP_CREATE_PARTITION_EFI, MSG_COMMAND_CREATE_PARTITION_EFI}, + {L"CREATE", L"PARTITION", L"EFI", CreateEfiPartition, IDS_HELP_CREATE_PARTITION_EFI, MSG_COMMAND_CREATE_PARTITION_EFI}, {L"CREATE", L"PARTITION", L"EXTENDED", CreateExtendedPartition, IDS_HELP_CREATE_PARTITION_EXTENDED, MSG_COMMAND_CREATE_PARTITION_EXTENDED}, {L"CREATE", L"PARTITION", L"LOGICAL", CreateLogicalPartition, IDS_HELP_CREATE_PARTITION_LOGICAL, MSG_COMMAND_CREATE_PARTITION_LOGICAL}, -// {L"CREATE", L"PARTITION", L"MSR", CreateMsrPartition, IDS_HELP_CREATE_PARTITION_MSR, MSG_COMMAND_CREATE_PARTITION_MSR}, + {L"CREATE", L"PARTITION", L"MSR", CreateMsrPartition, IDS_HELP_CREATE_PARTITION_MSR, MSG_COMMAND_CREATE_PARTITION_MSR}, {L"CREATE", L"PARTITION", L"PRIMARY", CreatePrimaryPartition, IDS_HELP_CREATE_PARTITION_PRIMARY, MSG_COMMAND_CREATE_PARTITION_PRIMARY}, {L"CREATE", L"VOLUME", NULL, NULL, IDS_HELP_CREATE_VOLUME, MSG_NONE}, {L"CREATE", L"VDISK", NULL, NULL, IDS_HELP_CREATE_VDISK, MSG_NONE},