typedef enum _FORMATSTATE
{
- Unformatted,
- UnformattedOrDamaged,
- UnknownFormat,
- Preformatted,
- Formatted
+ Unformatted,
+ UnformattedOrDamaged,
+ UnknownFormat,
+ Preformatted,
+ Formatted
} FORMATSTATE, *PFORMATSTATE;
typedef struct _PARTENTRY
{
- LIST_ENTRY ListEntry;
+ LIST_ENTRY ListEntry;
- CHAR DriveLetter[4];
- CHAR VolumeLabel[17];
- CHAR FileSystemName[9];
+ struct _DISKENTRY *DiskEntry;
- /* Partition is unused disk space */
- BOOLEAN Unpartitioned;
+ ULARGE_INTEGER StartSector;
+ ULARGE_INTEGER SectorCount;
- /* Partition is new. Table does not exist on disk yet */
- BOOLEAN New;
+ BOOLEAN BootIndicator;
+ UCHAR PartitionType;
+ ULONG HiddenSectors;
+ ULONG PartitionNumber;
+ ULONG PartitionIndex;
- /* Partition was created automatically. */
- BOOLEAN AutoCreate;
+ CHAR DriveLetter;
+ CHAR VolumeLabel[17];
+ CHAR FileSystemName[9];
- FORMATSTATE FormatState;
+ BOOLEAN LogicalPartition;
- /*
- * Raw offset and length of the unpartitioned disk space.
- * Includes the leading, not yet existing, partition table.
- */
- ULONGLONG UnpartitionedOffset;
- ULONGLONG UnpartitionedLength;
+ /* Partition is partitioned disk space */
+ BOOLEAN IsPartitioned;
- PARTITION_INFORMATION PartInfo[4];
+ /* Partition is new. Table does not exist on disk yet */
+ BOOLEAN New;
+
+ /* Partition was created automatically. */
+ BOOLEAN AutoCreate;
+
+ FORMATSTATE FormatState;
} PARTENTRY, *PPARTENTRY;
typedef struct _BIOSDISKENTRY
{
- LIST_ENTRY ListEntry;
- ULONG DiskNumber;
- ULONG Signature;
- ULONG Checksum;
- BOOLEAN Recognized;
- CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
- CM_INT13_DRIVE_PARAMETER Int13DiskData;
+ LIST_ENTRY ListEntry;
+ ULONG DiskNumber;
+ ULONG Signature;
+ ULONG Checksum;
+ BOOLEAN Recognized;
+ CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
+ CM_INT13_DRIVE_PARAMETER Int13DiskData;
} BIOSDISKENTRY, *PBIOSDISKENTRY;
typedef struct _DISKENTRY
{
- LIST_ENTRY ListEntry;
+ LIST_ENTRY ListEntry;
+
+ ULONGLONG Cylinders;
+ ULONG TracksPerCylinder;
+ ULONG SectorsPerTrack;
+ ULONG BytesPerSector;
- ULONGLONG Cylinders;
- ULONGLONG TracksPerCylinder;
- ULONGLONG SectorsPerTrack;
- ULONGLONG BytesPerSector;
+ ULARGE_INTEGER SectorCount;
+ ULONG SectorAlignment;
- ULONGLONG DiskSize;
- ULONGLONG CylinderSize;
- ULONGLONG TrackSize;
+ BOOLEAN BiosFound;
+ ULONG BiosDiskNumber;
+// ULONG Signature;
+// ULONG Checksum;
- BOOLEAN BiosFound;
- ULONG BiosDiskNumber;
- ULONG Signature;
- ULONG Checksum;
+ ULONG DiskNumber;
+ USHORT Port;
+ USHORT Bus;
+ USHORT Id;
- ULONG DiskNumber;
- USHORT Port;
- USHORT Bus;
- USHORT Id;
+ /* Has the partition list been modified? */
+ BOOLEAN Dirty;
- /* Has the partition list been modified? */
- BOOLEAN Modified;
+ BOOLEAN NewDisk;
+ BOOLEAN NoMbr; /* MBR is absent */
- BOOLEAN NewDisk;
- BOOLEAN NoMbr; /* MBR is absent */
+ UNICODE_STRING DriverName;
- UNICODE_STRING DriverName;
+ PDRIVE_LAYOUT_INFORMATION LayoutBuffer;
- LIST_ENTRY PartListHead;
+ PPARTENTRY ExtendedPartition;
+
+ LIST_ENTRY PrimaryPartListHead;
+ LIST_ENTRY LogicalPartListHead;
} DISKENTRY, *PDISKENTRY;
typedef struct _PARTLIST
{
- SHORT Left;
- SHORT Top;
- SHORT Right;
- SHORT Bottom;
+ SHORT Left;
+ SHORT Top;
+ SHORT Right;
+ SHORT Bottom;
- SHORT Line;
- SHORT Offset;
+ SHORT Line;
+ SHORT Offset;
- ULONG TopDisk;
- ULONG TopPartition;
+ ULONG TopDisk;
+ ULONG TopPartition;
- PDISKENTRY CurrentDisk;
- PPARTENTRY CurrentPartition;
- UCHAR CurrentPartitionNumber;
+ PDISKENTRY CurrentDisk;
+ PPARTENTRY CurrentPartition;
- PDISKENTRY ActiveBootDisk;
- PPARTENTRY ActiveBootPartition;
- UCHAR ActiveBootPartitionNumber;
+ PDISKENTRY ActiveBootDisk;
+ PPARTENTRY ActiveBootPartition;
- LIST_ENTRY DiskListHead;
- LIST_ENTRY BiosDiskListHead;
+ LIST_ENTRY DiskListHead;
+ LIST_ENTRY BiosDiskListHead;
} PARTLIST, *PPARTLIST;
typedef struct _PARTITION
{
- unsigned char BootFlags; /* bootable? 0=no, 128=yes */
- unsigned char StartingHead; /* beginning head number */
- unsigned char StartingSector; /* beginning sector number */
- unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */
- unsigned char PartitionType; /* Operating System type indicator code */
- unsigned char EndingHead; /* ending head number */
- unsigned char EndingSector; /* ending sector number */
- unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
- unsigned int StartingBlock; /* first sector relative to start of disk */
- unsigned int SectorCount; /* number of sectors in partition */
+ unsigned char BootFlags; /* bootable? 0=no, 128=yes */
+ unsigned char StartingHead; /* beginning head number */
+ unsigned char StartingSector; /* beginning sector number */
+ unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */
+ unsigned char PartitionType; /* Operating System type indicator code */
+ unsigned char EndingHead; /* ending head number */
+ unsigned char EndingSector; /* ending sector number */
+ unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
+ unsigned int StartingBlock; /* first sector relative to start of disk */
+ unsigned int SectorCount; /* number of sectors in partition */
} PARTITION, *PPARTITION;
typedef struct _PARTITION_SECTOR
{
- UCHAR BootCode[440]; /* 0x000 */
- ULONG Signature; /* 0x1B8 */
- UCHAR Reserved[2]; /* 0x1BC */
- PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
- USHORT Magic; /* 0x1FE */
+ UCHAR BootCode[440]; /* 0x000 */
+ ULONG Signature; /* 0x1B8 */
+ UCHAR Reserved[2]; /* 0x1BC */
+ PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
+ USHORT Magic; /* 0x1FE */
} PARTITION_SECTOR, *PPARTITION_SECTOR;
#include <poppack.h>
typedef struct
{
- LIST_ENTRY ListEntry;
- ULONG DiskNumber;
- ULONG Idendifier;
- ULONG Signature;
+ LIST_ENTRY ListEntry;
+ ULONG DiskNumber;
+ ULONG Idendifier;
+ ULONG Signature;
} BIOS_DISK, *PBIOS_DISK;
PPARTLIST
-CreatePartitionList (SHORT Left,
- SHORT Top,
- SHORT Right,
- SHORT Bottom);
+CreatePartitionList(
+ SHORT Left,
+ SHORT Top,
+ SHORT Right,
+ SHORT Bottom);
VOID
-DestroyPartitionList (PPARTLIST List);
+DestroyPartitionList(
+ PPARTLIST List);
VOID
-DrawPartitionList (PPARTLIST List);
+DrawPartitionList(
+ PPARTLIST List);
DWORD
-SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber);
+SelectPartition(
+ PPARTLIST List,
+ ULONG DiskNumber,
+ ULONG PartitionNumber);
BOOL
-SetMountedDeviceValues(PPARTLIST List);
+SetMountedDeviceValues(
+ PPARTLIST List);
-VOID
-ScrollDownPartitionList (PPARTLIST List);
+BOOL
+ScrollDownPartitionList(
+ PPARTLIST List);
+
+BOOL
+ScrollUpPartitionList(
+ PPARTLIST List);
VOID
-ScrollUpPartitionList (PPARTLIST List);
+CreatePrimaryPartition(
+ PPARTLIST List,
+ ULONGLONG PartitionSize,
+ BOOLEAN AutoCreate);
VOID
-CreateNewPartition (PPARTLIST List,
- ULONGLONG PartitionSize,
- BOOLEAN AutoCreate);
+CreateExtendedPartition(
+ PPARTLIST List,
+ ULONGLONG PartitionSize);
VOID
-DeleteCurrentPartition (PPARTLIST List);
+DeleteCurrentPartition(
+ PPARTLIST List);
VOID
-CheckActiveBootPartition (PPARTLIST List);
+CheckActiveBootPartition(
+ PPARTLIST List);
BOOLEAN
-CheckForLinuxFdiskPartitions (PPARTLIST List);
+CheckForLinuxFdiskPartitions(
+ PPARTLIST List);
BOOLEAN
-WritePartitionsToDisk (PPARTLIST List);
+WritePartitionsToDisk(
+ PPARTLIST List);
+
+ULONG
+PrimaryPartitionCreationChecks(
+ IN PPARTLIST List);
+
+ULONG
+ExtendedPartitionCreationChecks(
+ IN PPARTLIST List);
/* EOF */