32 DPRINT1(
"CreateEfiPartition()\n");
51 DPRINT(
"NoErr\n", pszSuffix);
64 DPRINT(
"Size : %s\n", pszSuffix);
76 DPRINT(
"Offset : %s\n", pszSuffix);
98 DPRINT1(
"Size: %I64u\n", ullSize);
100 DPRINT1(
"Offset: %I64u\n", ullOffset);
109 DPRINT1(
"SectorCount: %I64u\n", ullSectorCount);
111#ifdef DUMP_PARTITION_LIST
117 ListEntry = ListEntry->
Flink)
123 if (ullSectorCount == 0)
125 DPRINT(
"Claim whole unused space!\n");
143 DPRINT(
"Claim matching unused space!\n");
157 else if (ullSectorCount < PartEntry->
SectorCount.QuadPart)
159 DPRINT(
"Claim part of unused space\n");
161 if (NewPartEntry ==
NULL)
194#ifdef DUMP_PARTITION_LIST
243 CREATE_DISK DiskInfo;
252 DPRINT1(
"CreateDisk() failed!\n");
267 DPRINT(
"NoErr\n", pszSuffix);
280 DPRINT(
"Size : %s\n", pszSuffix);
292 DPRINT(
"Offset : %s\n", pszSuffix);
306 DPRINT(
"Align : %s\n", pszSuffix);
323 DPRINT1(
"Size: %I64u\n", ullSize);
325 DPRINT1(
"Offset: %I64u\n", ullOffset);
336 ConPuts(
StdOut,
L"We already have an extended partition on this disk!\n");
345 DPRINT1(
"SectorCount: %I64u\n", ullSectorCount);
352 ConPuts(
StdOut,
L"No disk space left for an extended partition!\n");
356 if (ullSectorCount == 0)
383 if (NewPartEntry ==
NULL)
461 DPRINT(
"NoErr\n", pszSuffix);
474 DPRINT(
"Size : %s\n", pszSuffix);
486 DPRINT(
"Offset : %s\n", pszSuffix);
500 DPRINT(
"Id : %s\n", pszSuffix);
522 DPRINT(
"Align : %s\n", pszSuffix);
539 DPRINT1(
"Size: %I64u\n", ullSize);
541 DPRINT1(
"Offset: %I64u\n", ullOffset);
550 DPRINT1(
"SectorCount: %I64u\n", ullSectorCount);
554 ListEntry = ListEntry->
Flink)
560 if (ullSectorCount == 0)
589 if (NewPartEntry ==
NULL)
651 DPRINT1(
"CreateMsrPartition()\n");
670 DPRINT(
"NoErr\n", pszSuffix);
683 DPRINT(
"Size : %s\n", pszSuffix);
695 DPRINT(
"Offset : %s\n", pszSuffix);
717 DPRINT1(
"Size: %I64u\n", ullSize);
719 DPRINT1(
"Offset: %I64u\n", ullOffset);
728 DPRINT1(
"SectorCount: %I64u\n", ullSectorCount);
730#ifdef DUMP_PARTITION_LIST
736 ListEntry = ListEntry->
Flink)
742 if (ullSectorCount == 0)
744 DPRINT(
"Claim whole unused space!\n");
762 DPRINT(
"Claim matching unused space!\n");
776 else if (ullSectorCount < PartEntry->
SectorCount.QuadPart)
778 DPRINT(
"Claim part of unused space\n");
780 if (NewPartEntry ==
NULL)
813#ifdef DUMP_PARTITION_LIST
845 if (pszPartitionType)
868 ConPuts(
StdOut,
L"No space left for another primary partition!\n");
877 DPRINT1(
"SectorCount: %I64u\n", ullSectorCount);
881 ListEntry = ListEntry->
Flink)
887 if (ullSectorCount == 0)
916 if (NewPartEntry ==
NULL)
968 GUID guidPartitionType;
972 if (pszPartitionType)
974 if (!
StringToGUID(&guidPartitionType, pszPartitionType))
982 CopyMemory(&guidPartitionType, &PARTITION_BASIC_DATA_GUID,
sizeof(
GUID));
991 DPRINT1(
"SectorCount: %I64u\n", ullSectorCount);
993#ifdef DUMP_PARTITION_LIST
999 ListEntry = ListEntry->
Flink)
1005 if (ullSectorCount == 0)
1007 DPRINT(
"Claim whole unused space!\n");
1025 DPRINT(
"Claim matching unused space!\n");
1039 else if (ullSectorCount < PartEntry->
SectorCount.QuadPart)
1041 DPRINT(
"Claim part of unused space\n");
1043 if (NewPartEntry ==
NULL)
1076#ifdef DUMP_PARTITION_LIST
1115 CREATE_DISK DiskInfo;
1124 DPRINT1(
"CreateDisk() failed!\n");
1139 DPRINT(
"NoErr\n", pszSuffix);
1152 DPRINT(
"Size : %s\n", pszSuffix);
1164 DPRINT(
"Offset : %s\n", pszSuffix);
1178 DPRINT(
"Id : %s\n", pszSuffix);
1179 pszPartitionType = pszSuffix;
1184 DPRINT(
"Align : %s\n", pszSuffix);
1201 DPRINT(
"Size: %I64u\n", ullSize);
1203 DPRINT1(
"Offset: %I64u\n", ullOffset);
1208 DPRINT(
"Partition Type: %s\n", pszPartitionType);
void ConPuts(FILE *fp, LPCWSTR psz)
void ConResPuts(FILE *fp, UINT nID)
static VOID CreatePrimaryGptPartition(_In_ ULONGLONG ullSize, _In_ PWSTR pszPartitionType)
EXIT_CODE CreateMsrPartition(_In_ INT argc, _In_ PWSTR *argv)
EXIT_CODE CreatePrimaryPartition(_In_ INT argc, _In_ PWSTR *argv)
EXIT_CODE CreateEfiPartition(_In_ INT argc, _In_ PWSTR *argv)
EXIT_CODE CreateExtendedPartition(_In_ INT argc, _In_ PWSTR *argv)
static VOID CreatePrimaryMbrPartition(_In_ ULONGLONG ullSize, _In_ PWSTR pszPartitionType)
EXIT_CODE CreateLogicalPartition(_In_ INT argc, _In_ PWSTR *argv)
#define IDS_CREATE_PARTITION_INVALID_STYLE
#define IDS_CREATE_PARTITION_FAIL
#define IDS_ERROR_INVALID_ARGS
#define IDS_SELECT_NO_DISK
#define IDS_CREATE_PARTITION_SUCCESS
#define PARTITION_EXTENDED
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
VOID UpdateMbrDiskLayout(_In_ PDISKENTRY DiskEntry)
VOID CreateGUID(_Out_ GUID *pGuid)
BOOL HasPrefix(_In_ PWSTR pszString, _In_ PWSTR pszPrefix, _Out_opt_ PWSTR *pszSuffix)
enum _EXIT_CODE EXIT_CODE
VOID UpdateGptDiskLayout(_In_ PDISKENTRY DiskEntry, _In_ BOOL DeleteEntry)
NTSTATUS WriteMbrPartitions(_In_ PDISKENTRY DiskEntry)
VOID ScanForUnpartitionedMbrDiskSpace(PDISKENTRY DiskEntry)
NTSTATUS WriteGptPartitions(_In_ PDISKENTRY DiskEntry)
VOID CreateSignature(_Out_ PDWORD pSignature)
BOOL StringToGUID(_Out_ GUID *pGuid, _In_ PWSTR pszString)
#define NT_SUCCESS(StatCode)
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
_ACRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *, wchar_t **, int)
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
#define InsertTailList(ListHead, Entry)
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define GetPrimaryPartitionCount(DiskEntry)
ULARGE_INTEGER SectorCount
PPARTENTRY ExtendedPartition
LIST_ENTRY LogicalPartListHead
ULARGE_INTEGER StartSector
LIST_ENTRY PrimaryPartListHead
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
ULARGE_INTEGER SectorCount
struct _DISKENTRY * DiskEntry
ULARGE_INTEGER StartSector
NTSTATUS CreateDisk(_In_ ULONG DiskNumber, _In_ PCREATE_DISK DiskInfo)
#define CONTAINING_RECORD(address, type, field)
static PPARTENTRY CurrentPartition