Hi

I partitioned my hard disk into 3 primary partitions, 1 extended partition with 2 logical partitions. The list of all partitions from diskpart (or from disk management MMC) is the following:

Partition 1 - Primar
Partition 2 - Primar
Partition 3 - Extende
Partition 4 - Logica
Partition 5 - Logica
Partition 6 - Primar

I write a C++ tool to get the position of the last primary partition (in the example above is #6) using IOCTL_DISK_GET_DRIVE_LAYOUT_EX. However, when I iterate the partitions (PARTITION_INFORMATION_EX) in DRIVE_LAYOUT_INFORMATION_EX, it returns all the primary partitions first then the rests, i.e. partition 6 above becomes partition 3

Does anyone know why? Does primary partition takes higher precedence than extended/logical partition? IOCTL_DISK_GET_DRIVE_LAYOUT_EX should return an exact layout of the partition in the drive as it's shown in either diskpart or disk management MMC, should it not

Please help, thanks
-Paul

Re: partitions by Phil

Phil
Thu May 13 10:31:56 CDT 2004

Paul wrote:

> Hi,
>
> I partitioned my hard disk into 3 primary partitions, 1 extended partition with 2 logical partitions. The list of all partitions from diskpart (or from disk management MMC) is the following:
>
> Partition 1 - Primary
> Partition 2 - Primary
> Partition 3 - Extended
> Partition 4 - Logical
> Partition 5 - Logical
> Partition 6 - Primary
>
> I write a C++ tool to get the position of the last primary partition (in the example above is #6) using IOCTL_DISK_GET_DRIVE_LAYOUT_EX. However, when I iterate the partitions (PARTITION_INFORMATION_EX) in DRIVE_LAYOUT_INFORMATION_EX, it returns all the primary partitions first then the rests, i.e. partition 6 above becomes partition 3.
>
> Does anyone know why?

That is the way DOS would see the partitions.

> Does primary partition takes higher precedence than extended/logical partition? IOCTL_DISK_GET_DRIVE_LAYOUT_EX should return an exact layout of the partition in the drive as it's shown in either diskpart or disk management MMC, should it not?

No, in this case Windows is clearly showing it's DOS roots. Or at least the
developer that spec'ed out this API had DOS roots....

> Please help, thanks!
> -Paul

--
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com


Re: partitions by Ted

Ted
Sat May 29 21:53:02 CDT 2004

It's returned this way because that's how the information is laid out on in
the partition table of the disk itself. There's no provision in the on-disk
structures to preserve any notion of ordering. The extended partition is a
container for logical partitions (the terminology is a bit strange, and yet,
this does in fact reveal DOS roots), and so it's just returned last by
convention.

"Phil Frisbie, Jr." <phil@hawksoft.com> wrote in message
news:O2lsx9POEHA.2336@TK2MSFTNGP09.phx.gbl...
> Paul wrote:
>
> > Hi,
> >
> > I partitioned my hard disk into 3 primary partitions, 1 extended
partition with 2 logical partitions. The list of all partitions from
diskpart (or from disk management MMC) is the following:
> >
> > Partition 1 - Primary
> > Partition 2 - Primary
> > Partition 3 - Extended
> > Partition 4 - Logical
> > Partition 5 - Logical
> > Partition 6 - Primary
> >
> > I write a C++ tool to get the position of the last primary partition (in
the example above is #6) using IOCTL_DISK_GET_DRIVE_LAYOUT_EX. However,
when I iterate the partitions (PARTITION_INFORMATION_EX) in
DRIVE_LAYOUT_INFORMATION_EX, it returns all the primary partitions first
then the rests, i.e. partition 6 above becomes partition 3.
> >
> > Does anyone know why?
>
> That is the way DOS would see the partitions.
>
> > Does primary partition takes higher precedence than extended/logical
partition? IOCTL_DISK_GET_DRIVE_LAYOUT_EX should return an exact layout of
the partition in the drive as it's shown in either diskpart or disk
management MMC, should it not?
>
> No, in this case Windows is clearly showing it's DOS roots. Or at least
the
> developer that spec'ed out this API had DOS roots....
>
> > Please help, thanks!
> > -Paul
>
> --
> Phil Frisbie, Jr.
> Hawk Software
> http://www.hawksoft.com
>