CORE-13525
Notes:
- Most of the exported functions have been turned from default cdecl to explicit stdcall / "NTAPI".
- The two InitializeSetup() phases have been collapsed to make the initialization simpler.
Average reductions (percentages; see PR #7523 for actual numbers):
x86 Debug builds:
reactos.exe: 35.1%
smss.exe : 39.8%
Total (including setuplib.dll): 17.9%
x86 Release builds:
reactos.exe: 22.3%
smss.exe : 25.0%
Total (including setuplib.dll): 10.6%
x64 Debug builds:
reactos.exe: 40.6%
smss.exe : 41.6%
Total (including setuplib.dll): 20.0%
x64 Release builds:
reactos.exe: 22.8%
smss.exe : 22.3%
Total (including setuplib.dll): 10.1%
Fixes previous attempt at commit 0ca4e6dcf, which was reverted by commit
bbdcc14b1 because the partitioning checks mistook unpartitioned disks as
GPT.
Addendum to commit 99f0937fd.
The partition-creation checks are unified for these partitions into one
single function. To prepare for GPT support, the specifics are put into
a separate MBRPartitionCreateChecks() helper, called for MBR disks by the
upper-level function. GPT disks will have a similar helper in the future.
Addendum to commmit 99f0937fd.
The partition-creation checks are unified for these partitions into one
single function. To prepare for GPT support, the specifics are put into
a separate MBRPartitionCreateChecks() helper, called for MBR disks by the
upper-level function. GPT disks will have a similar helper in the future.
Refine the algorithm introduced in commit c560342f08 (r75667, r75676),
whereby the installation source path is based on the full image file path
of the installer program, and of the \SystemRoot symlink.
Also reverts commit 6f389a35db "Add a workaround for installing from USB drives"
CORE-17818
+ SAL2-annotate and add Doxygen comments.
----
In case the \SystemRoot full path prefixes the image file path,
use the resolved \SystemRoot as the installation source path.
Otherwise, use the image file path.
The \SystemRoot symlink target resolution needs full path reparsing,
because it can reference other symlinks. This is what happens, for
example when booting the installation from a removable hard-disk.
We can have:
\SystemRoot ---> \Device\Harddisk1\Partition1\ReactOS
and: \Device\Harddisk1\Partition1 ---> \Device\HarddiskVolume2
etc.
and we wish to resolve \SystemRoot to: \Device\HarddiskVolume2\ReactOS
instead of keeping the former version (using Harddisk1\Partition1).
We then verify whether it prefixes the image file path, which is
a fully reparsed path.
CORE-13525
This is done so that the caller doesn't need to know details
about particular architecture specifics, like VBR, MBR etc.
Extra checks and specific handling is also performed for supporting
bootloader installation on removable media:
- verify whether the media is a floppy or some other removable media,
- depending on which, a suitable file system is chosen,
- and if the media is not a floppy, do the supplemental partition
verifications to determine whether the media is a "super-floppy"
(in the partitioning sense).
This function could be generalized later to copy other files necessary
for the bootloader; removing also the currently hardcoded placement in
the installation source directory, and instead, using a configurable
path (specified in txtsetup.sif); etc.
Adapted from a commit by Timo Kreuzer (see PR #7420)
Co-Authored-By: Timo Kreuzer <timo.kreuzer@reactos.org>
CORE-13525
- Newly-created partitions and unpartitioned space ar reinserted
or updated in correct order in the tree-list. Volume-creation
information data associated with the tree items is persisted
across operations.
- Reliably delete data associated to tree-list items via the
TVN_DELETEITEM notification.
This allows simplifying the cleanup function; keeping simple
the code that deletes items when deleting partitions, etc.
- Make the PrintPartitionData() function call itself recursively on
extended partitions to display the sub-list of logical partitions.
- Handle the new partition size in MB the same way as in USETUP.
- Allow existing partitions/volumes to be re-formatted, using
common code with the partition creation dialog.
- Allow selecting unpartitioned space or non-formatted partitions
for installing ReactOS: unused space will automatically be
partitioned and non-formatted partitions formatted (the user
is prompted for choosing the file system).
- Correctly zero the progress-bar position when starting file copy.
- Add missing file copy error handler in FileCopyCallback:
just copying what USETUP does.
CORE-13525
This greatly helps in reducing code complexity in some areas: code that
previously iterated over all partitions of a given disk, just to find
which ones were partitioned and contained a valid file system, now just
have to iterate over mounted volumes.
See in particular, `lib/utils/osdetect.c` and `lib/fsutil.c` .
- Remove FORMATSTATE "Preformatted" enum value;
- Cleanup osdetect code after introducing Volume support;
- Some simplifications for FormatState.
- Differentiate between 'new' partition and 'new' volume:
* "New" partition: it has been created and added in the cached list,
but not yet actually written into the disk.
* "New" volume: newly-created volume (may be backed by a partition or
not), not yet formatted. May exist on either new, or not new partition,
or elsewhere.
- Cache partition and volume NT device names.
These do not change across repartitioning operations, as long as the
partition or the filesystem volume hasn't been deleted/recreated.
This avoids doing \Device\Harddisk%u\Partition%u sprintf's everytime
we need to retrieve the given partition or volume device name.
When a partition/fileysystem volume is "virtually" created (i.e. in
the partition list, but not yet committed to disk and exposed to the
OS), no device partition number and device name are available yet.
In particular, validate that no manipulation of \Device\HarddiskM\Partition0
(i.e. the whole disk) is being made.
Addendum to commit 32e6eed760 (r63715)
CORE-5982
The function assumed that the directory path name to be created
always starts with a harddisk-partition root device name of the form:
\Device\HarddiskX\PartitionY\
Indeed, it can be (when using the volume manager) of the form:
\Device\HarddiskVolumeN\
and could even have a different format if trying to install ReactOS
on an external removable drive or other weird device.
Since the format of this prefix is not 100% always the same,
a different way to create the sub-directories is needed.
The nested-directory creation algorithm is changed as follows:
Suppose that the directory to be created is:
\Device\HarddiskVolume1\ReactOS\system32\drivers
The function first loops backwards each path component in order
to find the deepest existing sub-directory: it will try to verify
whether each of the following sub-directories exist, successively:
\Device\HarddiskVolume1\ReactOS\system32\drivers
\Device\HarddiskVolume1\ReactOS\system32\
\Device\HarddiskVolume1\ReactOS\
\Device\HarddiskVolume1\
(Notice the trailing path separators kept in this step.)
In principle, this root device FS directory must exist (since the
volume has been formatted previously). Once found, the function will
then create each of the sub-directories in turn:
\Device\HarddiskVolume1\ReactOS
\Device\HarddiskVolume1\ReactOS\system32
\Device\HarddiskVolume1\ReactOS\system32\drivers
----
An alternative to the fix could be to always specify the root device
name in a separate parameter, but this hasn't been pursued here so as
to not modify all the callers of this function.
It was introduced in commit 703eb5e8c9 (r7756) in order to hack around
the "dot"-path added in the reactos.dff generator file by the earlier
commit 3bd689f185 (r7269).
Its aim was to describe the installation directory itself, instead of
one of its sub-directories.
That _invalid_ "dot"-path was removed later by commit 027e2bfa3a (r15423);
however the '\.' hack stayed for quite a while in our code.
The correct way to describe the installation directory itself is to use
instead "\", compatible with Windows' setup, as was originally done in
txtsetup.sif, and fixed in reactos.dff(.in) in commit 97bb83fcd9 (r66604).
It will be used to determine how the bootloader has to be installed, etc.
Currently hardcoded for XBOX, or rnutime-determined for NEC PC-98 and BIOS-based PC-AT.
More thorough runtime determination will be added in the future.
CORE-6149, CORE-6179, CORE-9529
See also commits d329fbebf (r66995), 7c3f4c94a (r68307), and 16daf6700.
The function verifies that each path component of the directory is
a valid 8.3 name, not . or .. nor empty. This behaviour is compatible
with what can be observed from Windows XP/2003 installer.
(To reliably test this with the Windows installer, you need to modify
the TXTSETUP.SIF DefaultPath value in the [SetupData] section.)
Reverts the IsValidPath() move done in commit 9c64b57dc.
- Turn IsValidPath() into a IsValidInstallDirectory() helper function
available in the setuplib, so that it can also be used in the GUI setup.
- Introduce a IS_VALID_INSTALL_PATH_CHAR() macro.
The idea is reminiscent of the SetupCommitFileQueue() function:
filesystem volume operations are "queued" and processed via a
"commit queue".
The commit queue uses a user-specified callback, that is used to
interact with the user whenever an operation (filesystem formatting,
checking) is started, ended, or fails, for example by displaying
appropriate UI screens and choices, etc.
If East Asian people were unable
to see the Latin characters, it
becomes a barrier to mutual
understanding.
FontLink will break that barrier.
JIRA issue: CORE-9616
JIRA issue: CORE-15480
- Modify font substitutes.
- Unify the lock variables.
- Add FONTLINK and
FONTLINK_CHAIN structures.
- Add FontLink_Create and
FontLink_Destroy functions.
- Add FontLink_Chain_Init,
FontLink_Chain_Free,
FontLink_Chain_LoadReg,
FontLink_Chain_Populate, and
FontLink_Chain_FindGlyph
functions.
- Implement FontLink.
- Add font file DroidSansFallback.ttf
for LiveCD.
See commits ebcf3cf38 and c9c6902f0 (PR #5837)
In addition, correctly set the type of extended partition being used,
depending on whether it is contained below or above the 1024-cylinder
boundary (tested on NT).
CORE-19575
For the time being, don't add read-only attribute for ease of testing
and modifying files, but it won't always stay this way.
For example, Windows sets its boot.ini (as well as NTLDR, NTDETECT.COM
etc.) as read-only (+ hidden and system) during its 1st-stage setup.
2nd-stage setup makes some adjustments in boot.ini but doesn't restore
its read-only attribute.
Windows tools that can modify boot.ini (i.e. msconfig.exe, bootcfg.exe,
and sysdm.cpl) **ALL** know how to remove the read-only attribute for
modifying boot.ini, before restoring it if needed.
The BootDrive and BootPartition values are deprecated, and support
for them will soon be removed from FreeLoader.
Add an helper function to migrate these values during ReactOS
(re)installation / update.
The support is so far enabled only for INI files (freeldr.ini, boot.ini).
May be subject to further improvements in the future.
Usage examples:
- When finding existing ReactOS or Windows installations, the boot store
should exist and is opened in read-only mode. Closing the boot store
doesn't store any temporary modifications made to it.
- When doing a clean installation, freeldr.ini is created in read-write
access.
- When installing with an existing freeldr.ini or boot.ini, they are
opened as existing files in read-write access.
- QueryBootStoreOptions(): De-duplicate code.
- SetBootStoreOpt(): Respect the FieldsToChange flag.
- BOOT_STORE_OPTIONS: Remove unused Version field and distinguish
between "Current" and "Next" BootEntryKey.
- If a section already exists, return the existing one. This allows
avoiding different section entries with the same name in the cache.
If an INI file has separate sections with the same name, their
contents (key-values) get merged into a unique section.
- If a key-value already exists, update its data value and return the
existing one. (Note that this may be subject to behaviour change in
the future.)
- Make the Create*Partition helpers take a size in bytes, not in sectors.
This allows them to be easier to use by the caller, alleviating the
need for making the size conversion into sectors. Instead it is done
internally by the helpers.
- Introduce helper macros to easily retrieve the size of a partition
entry or a disk in bytes, from their internal representation in number
of sectors.
- The 'AutoCreate' variable being USETUP-specific, remove it from the
PARTENTRY structure and use instead a flag set into the 'New' member.
- Rename IsDiskSizeValid to IsPartitionLargeEnough, to better describe
what the function is for.
The reason is to avoid enforcing the usage of a specific list
container by the users of the setup library. This is a departure
of what I originally thought would be the best, in commits
92692eae3 (r74553), 8f2c4f7a6 (r75700)
This should actually make some parts of the GUI setup code simpler
(e.g. using the win32 comboboxes to store the list contents).
LangID is a LANGID and LayoutID is a KLID: keyboard layout ID.
See terminology at http://archives.miloush.net/michkap/archive/2004/11/27/270931.html
These tables of MUI_LAYOUTS for each language, correspond to the
intl.inf LCID map:
```
; List of locales.
; <LCID> = <Description>,<OEMCP>,<Language Group>,<langID:HKL pair>,<langID:HKL pair>,...
```
where:
- each MUI_LANGUAGE entry corresponds to one such locale description;
- each MUI_LAYOUTS entry corresponds to a <langID:HKL pair>.
See http://archives.miloush.net/michkap/archive/2006/10/14/825404.html
for some details.
Based on CORE-19346 "segoe-ui-symbo.patch".
In order to display gender glyphs (U+2642 and
U+2640; ♂ and ♀), we add a font substitute from
"Segoe UI Symbol" to "Arial".
ReactOS Arial has many symbol glyphs, so I think
we can use it for "Segoe UI Symbol" font substitute.
The glyph size problem will be fixed in #6156.
CORE-19346