MR> If a person has more than one primary partition on the one drive, all
MR> of which are formatted HPFS (OS/2, and an OS/2 maintenance partition,
MR> perhaps), then I'll be finding several candidate partitions.
MR>
MR> Is there a simple way to figure out which one is correct? Perhaps
MR> there's a value for the partition status indicating whether the
MR> partition is accessible or not?
Partitions are "hidden" by programs such as Boot Manager by changing their
types to an "unrecognised" type. Usually this is done by just flipping a bit
or two in the type byte. So the answer is that if you have "hidden"
partitions they will usually have types that, as standard, operating systems
will not recognise as valid partition types. There will be only one primary
partition in the primary MBR that has a valid partition type (and that isn't
an extended partition), and that will be your candidate partition.
The reason that it works this way is because of the way that most operating
systems look for partitions when assigning drive letters to them. They use a
very simplistic algorithm. They stop processing the table in each MBR when
they reach the first (non-0x05/0x0F) partition with a type that they
recognise. ( If you want to see how OS/2 does it, look at the code for
OS2DASD.DMD on the OS/2 DDK, and look at the Process_Partition function in the
file DMBPB.C . )
The slight exception to this rule is Windows NT 4.0, which caters for more
than one primary partition having a recognised type in the primary MBR. This
allows for up to four primary partitions per disk. But as the prominent
warning displayed by Windows NT's Disk Manager utility when one tries to
create more than one primary partition explains, this is incompatible with
other operating systems. (Well, *most* other operating systems. (-:)
I thought that you had already solved this problem, though. Didn't you say
that the DosDevIOCtl to obtain the BPB gave you in the "reserved sectors"
field the offset from the start of the "drive" to the partition ? Surely that
solves this very problem ?
¯ JdeBP ®
--- FleetStreet 1.22 NR
396/1
* Origin: JdeBP's point, using Squish (2:257/609.3)
|