[SETUPLIB] GetSourcePaths(): Fix determination of the installation source path.

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.
This commit is contained in:
Hermès Bélusca-Maïto 2024-10-23 15:20:46 +02:00
parent 2d655a487e
commit 3ddb05d443
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 125 additions and 77 deletions

View file

@ -171,9 +171,9 @@ InstallSetupInfFile(
NTSTATUS
GetSourcePaths(
OUT PUNICODE_STRING SourcePath,
OUT PUNICODE_STRING SourceRootPath,
OUT PUNICODE_STRING SourceRootDir);
_Out_ PUNICODE_STRING SourcePath,
_Out_ PUNICODE_STRING SourceRootPath,
_Out_ PUNICODE_STRING SourceRootDir);
ERROR_NUMBER
LoadSetupInf(