reactos/base/setup/lib/utils
Hermès Bélusca-Maïto 47a1acedf7
[SETUPLIB][USETUP] Improve disk HW numbering, removable disk support, and "super-floppy" partitioning.
Nowadays more and more people try to install ReactOS from removable
drives (e.g. USB sticks) onto fixed HDDs, or try to install it into
USB sticks too.

Both fixed and removable drives, as well as partitions on these, are
represented in NT using the same device name format:

  \Device\HarddiskM\PartitionN ,

with an increasing disk number M. Using this number for building the
corresponding firmware-specific ARC multi(x)disk(y)rdisk(z) path used
by the NT/ROS loader (FreeLdr, ...) is then prone to error since there
may have  been  removable drives  inserted  and  accounted for in the
calculation  of  the disk number.  These drives must be  correctly
subtracted in order to generate the correct ARC path, valid once all
the removable drives have been ejected (which should also be the
situation seen from the BIOS when booting up, except of course if you
boot on a USB stick).

This problem is now solved. Note that it matters only for the disks
that have also been enumerated by the firmware (BIOS; Int 13h). We
don't have to care about the other drives, since the ARC path will be
of a different format and will not use the disk number (instead, the
SCSI coordinates are used).

We also try to enumerate all the disks found in all the possible disk
adapters and  controllers enumerated  in the Hardware registry tree
(and that are visible by FreeLdr) in order to cover all.

Finally, we detect whether a disk reports as  a "super-floppy",  i.e.
an unpartitioned disk with a valid VBR. This is indeed how a standard
floppy disk looks like, or how USB sticks are partitioned on Windows.
Such disk is reported has having only one single partition starting at
the beginning of the disk, with partition number == 0, its type being
FAT16 non-bootable.
This allows us to forbid creating any new partitions on such disks.
Note that accessing either \Device\HarddiskN\Partition0 or Partition1
on such a disk returns the same data.
Note also that on the contrary, regular MBR-partitioned disks would
report at least four partitions entries, instead of just one.

The other improvements are:

- Do *NOT* write any MBR on a disk partitioned as "super-floppy".
  CORE-13703

- Fix the computed disk identifier, of format: %08x-%08x-%c .
  The numbers are respectively the checksum of the first sector, and
  the disk signature. The terminating letter is A or X, depending
  whether the first sector ends with 0x55AA/0xAA55 or not (see also
  commit 5053f1f5).

- Warn if the user attempts to install ReactOS on a disk that is not
  visible by the  firmware of his computer,  because it may not be
  bootable.
2019-03-12 02:17:11 +01:00
..
arcname.c [SETUPLIB][USETUP] Minor improvements. 2018-11-01 18:55:45 +01:00
arcname.h
arcname_tests.c
bldrsup.c [SETUPLIB] Improve the Freeldr timeout INI setting hack-fix. Dedicated to Mark Jansen ;-) CORE-15193 2018-11-24 02:45:03 +01:00
bldrsup.h
filesup.c [SETUPLIB][USETUP] Move the remaining (directory-creation) functions from usetup's filesup to setuplib. 2018-10-28 18:17:34 +01:00
filesup.h [SETUPLIB][USETUP] Move the remaining (directory-creation) functions from usetup's filesup to setuplib. 2018-10-28 18:17:34 +01:00
genlist.c [SETUPLIB][USETUP] Remove the deprecated GenericListHasSingleEntry() function and use instead GetNumberOfListEntries(). 2018-10-28 15:04:33 +01:00
genlist.h [SETUPLIB][USETUP] Remove the deprecated GenericListHasSingleEntry() function and use instead GetNumberOfListEntries(). 2018-10-28 15:04:33 +01:00
inicache.c [SETUP] Silence some noisy DPRINT1 2019-01-01 10:08:02 +01:00
inicache.h
linklist.h
ntverrsrc.c
ntverrsrc.h
osdetect.c [SETUPLIB][USETUP] Minor improvements. 2019-03-10 15:41:20 +01:00
osdetect.h [SETUPLIB] Retrieve and store the machine (architecture) ID of the discovered NTOS installations. Will be used later. 2018-11-06 00:09:13 +01:00
partlist.c [SETUPLIB][USETUP] Improve disk HW numbering, removable disk support, and "super-floppy" partitioning. 2019-03-12 02:17:11 +01:00
partlist.h [SETUPLIB][USETUP] Improve disk HW numbering, removable disk support, and "super-floppy" partitioning. 2019-03-12 02:17:11 +01:00
regutil.c [SETUPLIB] Properly cleanup the temporary registry keys created for setting up the registry. 2018-10-28 14:42:01 +01:00
regutil.h [SETUPLIB] Properly cleanup the temporary registry keys created for setting up the registry. 2018-10-28 14:42:01 +01:00