Pressing Shift-F10 to open cmd.exe when the setup program runs from
a different current directory than System32, now works correctly.
Use the 2nd CreateProcessW() `lpCommandLine` parameter, instead of the
1st parameter `lpApplicationName`, so as to use default path search.
The command-line buffer given to the 2nd-parameter can be temporarily
modified by CreateProcessW(), thus use an on-stack buffer.
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw#parameters
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).
The variadic DisplayMessage(V) helpers display a message box, where
both the title and message can be specified either as explicit strings
or via resource IDs. It also supports the message to be a printf-like
format string, in which case the additional formatting arguments are
subsequently specified.
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.
Fix a typo in "ジドウテキニ" word: `\274\336\304\336\263\303\306` (ジドウテニ)
that was introduced in 2009 year (commit 379ce6f163).
The word "ジドウテキニ" is "自動的に" in Kanji, means "automatically".
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.