reactos/base/setup/lib/utils
Hermès Bélusca-Maïto ea5728b5f3
[SETUPLIB] SetupCreateDirectory(): Don't assume the form of the directory prefix (#7257)
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.
2024-08-22 20:40:35 +02:00
..
arcname.c [SETUPLIB][USETUP] Reduce duplicated code 2024-07-04 17:14:32 +02:00
arcname.h
arcname_tests.c [SETUPLIB][USETUP] Use NT RTL String Safe functions instead of Win32-oriented ones (and remove usage of HRESULT too). 2018-10-28 00:58:46 +02:00
bldrsup.c [SETUPLIB] Don't flag freeldr.ini as read-only during installation. 2024-05-07 19:30:33 +02:00
bldrsup.h [SETUPLIB] Use new BootPath value for BootSector boot entries (#6815) 2024-05-07 12:33:14 +02:00
filesup.c [SETUPLIB] SetupCreateDirectory(): Don't assume the form of the directory prefix (#7257) 2024-08-22 20:40:35 +02:00
filesup.h [SETUPLIB] SetupCreateDirectory(): Don't assume the form of the directory prefix (#7257) 2024-08-22 20:40:35 +02:00
fsrec.c [SETUPLIB][USETUP] FS utilities: Use the ISO C and C++ conformant name: _wcsicmp 2024-07-01 16:28:17 +02:00
fsrec.h [SETUPLIB] Make InferFileSystem() compatible for both MBR and GPT disks. Simplify the FSREC interface a bit. 2020-11-24 03:24:36 +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 [SETUPLIB] Add support for removing sections and key values, and remove some hacks (#6815) 2024-05-05 18:15:31 +02:00
inicache.h [SETUPLIB] Add support for removing sections and key values, and remove some hacks (#6815) 2024-05-05 18:15:31 +02:00
linklist.h
ntverrsrc.c
ntverrsrc.h
osdetect.c [SETUPLIB] Cleanup some partition getters and remove GetDiskOrPartition. 2024-06-24 16:28:07 +02: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
partinfo.c [SETUPLIB][REACTOS][USETUP] Move partition types information to its dedicated file; update MBR partition types and add GPT GUID partition types. 2021-02-01 01:48:14 +01:00
partinfo.h [SETUPLIB][REACTOS][USETUP] Move partition types information to its dedicated file; update MBR partition types and add GPT GUID partition types. 2021-02-01 01:48:14 +01:00
partlist.c [SETUPLIB][USETUP] Reduce duplicated code 2024-07-04 17:14:32 +02:00
partlist.h [SETUPLIB][USETUP] Isolate and decouple the filesystem operations code from the UI (#7049) 2024-07-01 16:18:57 +02:00
regutil.c [REACTOS] Fix a number of MSVC warnings 2021-07-23 22:03:48 +02:00
regutil.h [SETUPLIB] Properly cleanup the temporary registry keys created for setting up the registry. 2018-10-28 14:42:01 +01:00