Something went wrong. Try again.
Reactos
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980/* * PROJECT: ReactOS DiskPart * LICENSE: GPL - See COPYING in the top level directory * FILE: base/system/diskpart/gpt.c * PURPOSE: Manages all the partitions of the OS in an interactive way. * PROGRAMMERS: Lee Schroeder */
#include "diskpart.h"
#define NDEBUG#include <debug.h>
EXIT_CODEgpt_main( _In_ INT argc, _In_ PWSTR *argv){ ULONGLONG ullAttributes = 0ULL; PWSTR pszSuffix = NULL; INT i; NTSTATUS Status;
if (CurrentDisk == NULL) { ConResPuts(StdOut, IDS_SELECT_NO_DISK); return EXIT_SUCCESS; }
if (CurrentPartition == NULL) { ConResPuts(StdOut, IDS_SELECT_NO_PARTITION); return EXIT_SUCCESS; }
if (CurrentDisk->PartitionStyle != PARTITION_STYLE_GPT) { ConResPuts(StdOut, IDS_CREATE_PARTITION_INVALID_STYLE); return EXIT_SUCCESS; }
for (i = 1; i < argc; i++) { if (HasPrefix(argv[i], L"attributes=", &pszSuffix)) { /* attributes=<N> */ DPRINT("Attributes: %s\n", pszSuffix);
ullAttributes = _wcstoui64(pszSuffix, NULL, 0); if ((ullAttributes == 0) && (errno == ERANGE)) { ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); return EXIT_SUCCESS; } } else { ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS); return EXIT_SUCCESS; } }
DPRINT("Attributes: 0x%I64x\n", ullAttributes); CurrentPartition->Gpt.Attributes = ullAttributes; CurrentDisk->Dirty = TRUE;
UpdateGptDiskLayout(CurrentDisk, FALSE); Status = WriteGptPartitions(CurrentDisk); if (!NT_SUCCESS(Status)) { ConResPuts(StdOut, IDS_GPT_FAIL); return EXIT_SUCCESS; }
ConResPuts(StdOut, IDS_GPT_SUCCESS);
return EXIT_SUCCESS;}