Commit Graph

935 Commits

Author SHA1 Message Date
Hermès Bélusca-Maïto
9761df14f0 [BOOTDATA] Explicitly add "Profiles/Default User/My Documents" to the LiveImage (#8936)
CORE-19691

Removing the `livecd_start.cmd` entry also caused the "Profiles/Default User/My Documents"
directory to not be created in the LiveImage. When booting it, this
caused explorer.exe to hang while loading the desktop, for **some**
(but not all) non-english environments.
(Technically it should instead ignore the non-existing directory if it
cannot create or open it, or drop an error then continue execution...
But that's another bug for another time!)

Adding back the creation of this directory fixes the hang.
2026-05-13 22:16:08 +02:00
Hermès Bélusca-Maïto
a46e1e96ec [BOOTDATA][CMAKE][MKSHELLLINK] Improve shell link shortcuts creation for the LiveImage (#8936)
CORE-15156, CORE-19691, CORE-19692

Finally get rid of the livecd_start.cmd hack introduced waaaay back
in commit ff6d7b0236 (r54514)!
See also commits ea682b6909 (r54512) and 71867403fd (r54513).

For target paths, use the shell "special shell folder" syntax:
`shell:windows\...` or `shell:system\...`, introduced in commit
7b081be46d (PR #7158) by Whindmar Saksit.

Specify an explicit icon path and index for the "Read Me.lnk" shortcut.

Includes ideas from PR #7154 by Katayama Hirofumi MZ.

The generated shell links are confirmed to work on ReactOS, but also on
Windows 2003 and Windows 7.

- Change the MKSHELLLINK icon parameter syntax to be: `-i [icon_path[,nr]]`
  where, either both `icon_path` and icon index are given, separated by
  a comma ',' , or, either the `icon_path` is given but the index is
  optional (default: 0), or, only the icon index is given, in which case
  the icon path is set to the target instead.

- Use a `VERBATIM` command-line for `add_custom_command()`, so that *nix
  builds can cope with parameters containing backslashes.

- The shortcut target path, working directory, command-line arguments,
  and icon path all may specify explicit Win32 environment variables
  (like `%SystemRoot%`, `%HOMEDRIVE%`, etc.). Because these environment
  variables are specified as data given to the build tool via CMake,
  **AND** we have to workaround keeping these variables unexpanded when
  they are transmitted to the tool via CMD.EXE (on builds made on Windows),
  specify these variables in an "escaped" format, using `^%` instead:
  `^%SystemRoot^%`, etc.
  Additionally these paths may be explicitly quoted and passed that way
  to the MKSHELLLINK tool.

  In order to deal with both unquoting the strings and unescaping the
  environment variables, introduce a helper function and invoke them on
  the aforementioned strings.
2026-05-13 22:16:07 +02:00
Hermès Bélusca-Maïto
8cb3980766 [BOOTDATA] CMakeLists.txt: Reorganize a bit the add_livecd_shortcut() invocations (#8936)
- Use variables to define and hold the on-disk shortcuts destination
  directories (the "Profiles/All Users/..."), and use these variables
  in the `add_livecd_shortcut()` calls; this allows shortening the
  corresponding lines.

- There are currently two shortcuts: "Command Prompt" and "ReactOS
  Explorer", that are added to more than one destination.
  Previously, we had to invoke `add_livecd_shortcut()` for each
  destination. However, each invocation recreated the _**same**_
  shortcut file (with the same .lnk file name) in the build directory.

  To solve this, the `dest` parameter of the `add_livecd_shortcut()`
  function, is replaced by a `DESTINATION` keyword, whose value is
  a list of one or more destination directories, where the shortcut
  should be added.
2026-05-13 22:16:01 +02:00
Hermès Bélusca-Maïto
3a3b16af0d [BOOTDATA][CMAKE] Improve the add_livecd_shortcut/add_link helpers (#8936)
CMakeLists.txt: `add_livecd_shortcut()`:

Turn the macro into a function. Instead of keeping a `LIVECD_SHORTCUTS`
global-scope list variable, just define a `livecd_links` custom target
as initially empty, then, using `set_property()`, directly append to it
its "SOURCES" i.e. generated .lnk files.
(This is equivalent to using `target_sources(livecd_links PRIVATE ...)`
only in CMake 3.20+ for the custom target.)

CMakeMacros.cmake: `add_link()`:

- Since both `name` and `path` parameters are mandatory, make them
  explicit in the function declaration instead of defining them as
  "optional" parameters.

- Remove the `set_source_files_properties(... PROPERTIES GENERATED TRUE)`
  invocation that followed the `add_custom_command(...)` call, since,
  per the documentation[^1],
  "Each output file will be marked with the `GENERATED` source file
  property automatically." (Since CMake 3.2 at least.)

[^1]: https://cmake.org/cmake/help/v3.17/command/add_custom_command.html
2026-05-13 22:16:00 +02:00
Timo Kreuzer
e9a6d20847 [NLS] Add codepage 20932 (Japanese - EUC-JP) 2026-05-08 07:30:20 +00:00
Hermès Bélusca-Maïto
8fa6679b9f [BOOT] Remove last instances of "hybridcd"
Addendum to commit b2e33f26eb (PR #7313)
2026-05-07 18:03:09 +02:00
Carl J. Bialorucki
c03dd1ba75 [BOOTDATA] Add commented out block for setting visual style 2026-05-07 08:34:25 -05:00
Carl J. Bialorucki
548f0740df [BOOTDATA] Add unattend.inf to livecd target
Needed for 0.4.16 release to set a default visual style
2026-05-07 08:34:25 -05:00
Hermès Bélusca-Maïto
5a8039fe51 [BOOTDATA] Shorten the debug-enabled boot entry labels 2026-05-06 22:29:48 +02:00
Hermès Bélusca-Maïto
81752ca211 [FREELDR] Reset BootType before reading its value in the freeldr.ini OS section, if it exists
Because if the value doesn't exist in the OS section, the value isn't
reset and the code would reuse a stray one that was for the previous entry.
2026-05-06 22:29:47 +02:00
Hermès Bélusca-Maïto
45aa3c2a17 [FREELDR] Consider an unkeyed OS entry in freeldr.ini to be a menu separator 2026-05-06 22:29:46 +02:00
Hermès Bélusca-Maïto
68312dedbe [FREELDR:UEFI] uefidisk.c: Remove stray global variable
Addendum to commit 1fd9d11f16 (PR #5219)
2026-05-06 22:29:46 +02:00
Hermès Bélusca-Maïto
07f36b52aa [FREELDR] peloader.c: Minor nits 2026-05-06 22:29:39 +02:00
Daniel Victor
54422db2b8 [FREELDR] Fix UEFI IA-32 boot (#8886)
The PAE flag might be enabled on some x86-32 UEFI platforms, causing a crash in the kernel.
```
Assertion C:\reactos-master\reactos\ntoskrnl\mm\ARM3\miarm.h(971): PointerPte->u.Hard.Valid == 0
nt!MI_WRITE_VALID_PTE+0x28:
822d1d08 cd2c            int     2Ch
```

Tested using qemu with `OVMF32_CODE_4M.fd` firmware, and with 32bit UEFI in VMware.
2026-04-30 23:56:19 +02:00
Hermès Bélusca-Maïto
bac97c58e2 [FREELDR] Rework the contents of the FreeLoader setup, custom-boot, and NT advanced boot options menus
- Make the menu contents more dynamic; inspired by PR #8871 by Ahmed Arif.

- advopts.c: Double-relicense ntldropts.c/h to GPL-2.0-or-later or MIT,
  as most of the code in this file has been rewritten for years now.

- options.c (FreeLoader setup options menu):
  Double-relicense options.c/h to GPL-2.0-or-later or MIT, as most
  of the code in this file has been rewritten since commit 9ff4e4b9ef.
2026-04-28 23:23:25 +02:00
Hermès Bélusca-Maïto
925d227faa [FREELDR:NTLDR] Move NtLdrUpdateLoadOptions() to ntldropts.c and rename it to NtLdrUpdateOptions()
Also:
- Update SAL annotations to SAL2;
- Double-relicense ntldropts.c/h to GPL-2.0-or-later or MIT.
2026-04-28 23:23:24 +02:00
Hermès Bélusca-Maïto
b2e33f26eb [REACTOS] Merge our bootcd and livecd into an all-in-one ReactOS BootCD (#7313)
CORE-9069, CORE-13525, RELEASE-11

This new BootCD contains the functionality of both the original bootcd
(text-mode 1st-stage installer) and the livecd (that will include the
1st-stage GUI installer later).
Our separate livecd ISOs become obsolete, and this completely removes
the need for the so-called "hybridcd" ISO.

Some details:

- The "hybridcd" build target is completely removed, since now the new
  BootCD *is* basically what we used to call "hybridcd".

- The "livecd" build target is kept so far (to minimize the code changes),
  but internally I start to refer to it as "LiveImage", and is reduced
  to a minimum.

  A minimal non-bootable "liveimg.iso" is built (but currently not
  included within the BootCD). Its purpose will be to implement the
  "ReactOS Live" functionality as a RAMDISK.
  (We currently don't support other file formats apart from ISO and
  flat disk for a RAMDISK).

  The "ReactOS Live" (non-RAMDISK) is implemented by adding to the
  BootCD file tree the files from the LiveImage.
  These files add two root directories, "Profiles" and "reactos"
  (which is the SystemRoot for the non-ramdisk LiveImage).

- The minimal text-mode ReactOS installation used for the 1st-stage
  installer, including USETUP itself, and the executable for the
  1st-stage GUI installer and the reactos.cab (installation source),
  are moved to the root directory called "i386" (ideally, one directory
  per architecture).

- The "bootcdregtest" target, i.e. the ISOs we feed our testbots with,
  are left untouched, i.e. they are only constituted of the 1st-stage
  text-mode installation only, but placed in a per-architecture root
  directory ("i386", etc. as for the bootcd).

- Remove the ACPI APIC/SMP entries from bootcd.ini. They will be made
  available via the Advanced Boot Options F8 menu in Debug builds, for
  testing purposes only, in a subsequent commit.

This commit is based upon an older SVN one:
svn path=/branches/setup_improvements/; revision=75273
2026-04-28 23:11:10 +02:00
Hermès Bélusca-Maïto
16e6da0e96 [FREELDR:SETUPLDR] Add the missing known platform-specific SourcePaths where TXTSETUP.SIF can be found
And slightly improve the search loop.

- Unconditionally look into the root directory as well, in order to cover
  all possible boot disk layouts in case someone customizes the ReactOS
  boot media layout.

- Improve the `InfOpenFile()` call error handling, in order to show the
  erroneous line _iff_ the call failed because of a wrong syntax in
  TXTSETUP.SIF . Distinguish it from a failure because the file doesn't
  exist in the source path being tested (in which case, no error is shown).
2026-04-28 23:11:09 +02:00
Hermès Bélusca-Maïto
4dc1ea6c8f [BOOTDATA] Move the legide.sys entry in txtsetup.sif into the x86-specific section
The legide.sys driver, introduced in commit ae2827f481, is compiled *ONLY*
for the x86 platform (not x64 nor the others) as specified in commit 7d33f7503b.
Fix the file installation copy by moving its entry into the x86-specific section.

Addendum to commit 7174935d73 (PR #8888). CORE-17256
2026-04-28 23:07:42 +02:00
Carl J. Bialorucki
7174935d73 [BOOTDATA] Fix legide.sys load on boot (#8888)
After merging the new ATA driver, FreeLdr complains about not being able
to load legide.sys. Fix that by adding legide.sys driver to txtsetup.sif
so FreeLoader can load it.

Addendum to ae2827f481. CORE-17256
2026-04-22 10:28:38 +03:00
Dmitry Borisov
7d33f7503b [UNIATA] Disable the driver and enable the new ATA stack
Also fix descriptions for devices 1166:0241 and 1166:0242.
See https://bugzilla.kernel.org/show_bug.cgi?id=10424 and
aeb74914ef

CORE-17256
2026-04-21 15:01:22 -05:00
Timo Kreuzer
420a4bc9cb [FREELDR] Add NlsLeadByteInfo to rtl/nlsboot.c 2026-04-21 13:13:33 +00:00
Hermès Bélusca-Maïto
a2269ef7f9 [BOOTDATA] hivesys.inf: "OsLoaderPath" and "SystemPartition" shouldn't be pre-hardcoded
These two registry values, stored in `HKEY_LOCAL_MACHINE\SYSTEM\Setup`,
are generated at runtime by the kernel; they are based on the current
values of: `LoaderBlock->NtHalPathName` and `LoaderBlock->ArcBootDeviceName`
respectively.

In particular, hardcoding `SystemPartition` to a default value
"\Device\Harddisk0\Partition1" , would be as random as hardcoding it
to anything else, since nothing justifies that there exists a partition
on the first harddisk, and if there is one, nothing guarantees that it
is one that was used to boot the operating system... Especially when
booting a LiveCD!
2026-04-16 17:43:40 +02:00
Hermès Bélusca-Maïto
e2c92c0ffb [FREELDR] Switch partition interface to using the more generic PARTITION_INFORMATION
instead of the MBR-specific PARTITION_TABLE_ENTRY structure.

Simplify also some aspects of the code:

- for MBR code, avoid copying around partition entries, but use
  pointers instead;

- more generally, use the actual disk sector size instead of guessing,
  and pass it to the partition interface routines.
2026-04-15 18:19:20 +02:00
Hermès Bélusca-Maïto
c479bf81ff [FREELDR] Remove internal/hal.h include from main header 2026-04-15 13:46:40 +02:00
Hermès Bélusca-Maïto
9baf0933fb [FREELDR:NTLDR] Improve LoaderBlock ArcBootDeviceName determination; correctly set ArcHalDeviceName
- `ArcBootDeviceName`: Given a theoretically valid ARC boot path
  of the form:
    `multi(0)disk(0)rdisk(0)partition(2)ReactOS\\weird)name`
  correctly determine `ArcBootDeviceName` to be:
    `multi(0)disk(0)rdisk(0)partition(2)`
  and `SystemRoot` to be what follows it:
    `ReactOS\\weird)name`

  Usual paths like: `multi(0)disk(0)rdisk(0)partition(2)\\ReactOS`
  are still correctly handled, of course.

- The `ArcHalDeviceName` path is the ARC path to the system partition,
  where the firmware started the bootloader from. For historical reasons
  it's called Arc **HAL**, because on older (and non-x86) Windows versions
  the HAL was to be placed next to the OS loader in the system partition,
  while the rest of the OS (kernel, etc.) was placed elsewhere.

  So, in order to correctly set `ArcHalDeviceName`, pass the determined
  SystemPartition all the way down to `WinLdrInitializePhase1()`.
2026-04-09 22:42:24 +02:00
Hermès Bélusca-Maïto
7fc926974f [FREELDR:NTLDR] Enable EMS support on all platforms
Set the `HeadlessLoaderBlock` for all platforms, since headless support
is platform-independent. Addendum to commit ea93b886df.
2026-04-09 21:15:53 +02:00
Hermès Bélusca-Maïto
7779fb4459 [FREELDR] Retrieve and store the disk GUID signature if the disk is GPT partitioned (#8843)
For fixed-disks (i.e. not floppy nor CD-ROM), check in `disk.c!DiskInitialize()`
whether the disk being enumerated is GPT. If so, retrieve its disk GUID.
Pass this information to `AddReactOSArcDiskInfo()` when filling the ARC
disk information block, which sets the `IsGpt` and `GptSignature` members
of the `ARC_DISK_SIGNATURE` structure accordingly.

Debugging output example, where the first disk (0x80) is MBR, while the
second (0x81) is GPT:
```
(freeldr\disk\disk.c:100) err: DiskInitialize(0x80, 'multi(0)disk(0)rdisk(0)', Type: 25)
(freeldr\disk\disk.c:125) err: Signature: 163fbb9d
(freeldr\disk\disk.c:134) err: Checksum: 47699104
(freeldr\disk\disk.c:137) err: IsPartitionValid: TRUE
(freeldr\disk\disk.c:100) err: DiskInitialize(0x81, 'multi(0)disk(0)rdisk(1)', Type: 25)
(freeldr\disk\disk.c:125) err: Signature: 0
(freeldr\disk\disk.c:134) err: Checksum: 9cb5ff90
(freeldr\disk\disk.c:137) err: IsPartitionValid: TRUE
(freeldr\disk\disk.c:157) err: Disk 0x81 is GPT, DiskGuid: {1e4e8972-e026-4d5f-b213-7be3f2fad3f8}
```

----

This fixes the BSOD 0x7B `INACCESSIBLE_BOOT_DEVICE` that happens when
trying to boot a ReactOS installation present in a partition on a GPT
partitioned disk.

In the kernel IO manager:
`IopCreateArcNamesDisk()`, invoked by `IopCreateArcNames()`, tries to
map the list of disks dynamically detected by the boot disk drivers
with those detected by the bootloader, by matching their disk signatures.

- The signatures of the disks detected by the boot disk drivers are
  obtained when querying their drive layout and partition table (which
  also tells whether the disk is MBR or GPT partitioned);

- while the signatures of the disks detected by the bootloader are
  enumerated in the `LoaderBlock->ArcDiskInformation->DiskSignatureListHead`
  linked-list (inside `ARC_DISK_SIGNATURE` structures).

The routine compares the disk signatures by invoking `IopVerifyDiskSignature()`,
which, depending on whether the disk is MBR or GPT (as reported in the
drive layout), compares the signature with that of `ARC_DISK_SIGNATURE`
`Signature` (for MBR) or `GptSignature` (for GPT) structure members.

In case the boot disk turns out to not be mapped -- which was the case
until now if it was GPT-partitioned -- then the `IopMarkBootPartition()`
routine invoked later, wouldn't be able to find and open the boot disk,
and would trigger the BSOD 0x7B, as the result.
2026-04-08 20:56:38 +02:00
Hermès Bélusca-Maïto
00ed55bcba [FREELDR:UEFI] Move GPT partition support into a separate module... (#8843)
so that it can be used for other platforms.
Based upon suggestions by Daniel Victor (@iLauncherDev).

partition.c: Double-license GPL-2.0-or-later and MIT
2026-04-08 20:51:43 +02:00
Hermès Bélusca-Maïto
1490f34da2 [FREELDR] partition.c: Split the MBR and Xbox (BRFR) code into separate files (#8843)
No actual code changes.
Based upon suggestions by Daniel Victor (@iLauncherDev).
2026-04-08 20:42:15 +02:00
Daniel Victor
bad308a34d [FREELDR] Add assembly helpers for the original Xbox (#8722)
This fixes boot regression on Xbox, introduced in 3964c936cb.

A new `call writestr` on early boot leads to `writechr` helper call,
which uses INT 10h BIOS service. This ends up in early boot crash,
as the original Xbox doesn't have VGA BIOS, nor the BIOS Data Area.

Fix the problem by adding Xbox-specific assembly helpers.

CORE-16216, CORE-19882
2026-04-08 19:08:44 +03:00
Hermès Bélusca-Maïto
03de1f932f [FREELDR:NTLDR] Fix build following commit 9ff4e4b9ef 2026-04-04 22:34:53 +02:00
Hermès Bélusca-Maïto
bf26ae38a5 [FREELDR] Make FreeLoader a bit more usable even if FREELDR.INI is missing
CORE-9023

In case FREELDR.INI is missing, or there are no operating systems listed
and available (either the corresponding section is missing, or is empty),
fall back to the FreeLoader Setup and Configuration F2 menu, that allows
performing a minimal number of operations (enabling FreeLoader debugging;
doing a custom boot... and more to come!)

Fix also a bug in `InitOperatingSystemList()`, that would allow
allocating an empty list with zero items. Now it returns NULL if
no operating systems are found.

Default to the Minimal text UI instead of the fullfledged one, if no
"MinimalUI" option can be found in FREELDR.INI (or if the INI is missing).
2026-04-04 22:19:18 +02:00
Hermès Bélusca-Maïto
9ff4e4b9ef [FREELDR][NTLDR] Move the ReactOS/NT-specific advanced boot menu to its separate file
CORE-9023

Make also the advanced boot menu depend on the operating system type.
It can be opened by pressing F8, or F5, as in the Windows' bootloader.

The FreeLoader-specific options are moved to a separate menu,
accessible via the F2 key from the main menu.

Work-in-progress: display the boot options that correspond to the
currently-selected boot entry.
2026-04-04 22:15:58 +02:00
Hermès Bélusca-Maïto
1ac657ed0e [FREELDR:NTLDR] Normalize the boot options as soon as possible, and fix the algorithm
Use `NtLdrGetNextOption()` to loop over each individual option and move
it to its proper place. This automatically trims any '/' option
separator, including repeated ones and whitespaces, and allow for
straightforward replacement with one single space.
2026-04-04 21:46:29 +02:00
Hermès Bélusca-Maïto
e87a74f131 [FREELDR] LaunchSecondStageLoader(): Always return ESUCCESS if rosload.exe started correctly...
instead of returning an erroneous value, since the rosload.exe entry point
`RunLoader()` doesn't return any value. This allows exiting from rosload.exe
and NOT having the `LaunchSecondStageLoader()` returning 0, for example,
which would then be interpreted as an error condition and showing the
"Unable to load second stage loader." error box.
2026-04-04 21:46:28 +02:00
Hermès Bélusca-Maïto
56481e1b8d [FREELDR:ARCH] Modularize the disk registration code (#8736) 2026-04-02 17:36:10 +02:00
Hermès Bélusca-Maïto
d2cbec0b5f [FREELDR:ARCH] Fix minor bugs; condense XboxDiskInit() a bit (#8732)
- `AtaInit()` returns the number of detected ATA devices. Therefore,
  when iterating over them, go from index 0 to the count _minus_ 1,
  in `Pc98InitializeBootDevices()` and in `XboxDiskInit()`.

- Initialize `DiskDrive->Type` to `DRIVE_TYPE_HDD` for detected SCSI
  hard-disk drives in `pc98disk.c!InitScsiDrive()`.

- Rearrange `XboxDiskInit()` and reduce its indentation level.
2026-04-02 17:23:39 +02:00
Hermès Bélusca-Maïto
62d71ebbd3 [FREELDR:ARCH] hwide.c: Don't rely on DEVICE_UNIT P; to be at the beginning of the HW_DEVICE_UNIT structure (#8732) 2026-04-02 17:20:20 +02:00
Hermès Bélusca-Maïto
9f42210478 [FREELDR:ARCH] Modularize the DiskError() functionality (#8732)
Move the `DiskReportError()` and `DiskError()` routines into the
`freeldr/disk/disk.c` file, reviving it as a collection of disk
devices helpers (and more in the future).

The architecture-specific disk modules only define the error code mapping
`DiskGetErrorCodeString()` function, that is then used by `DiskError()`.
2026-04-02 17:17:01 +02:00
Hermès Bélusca-Maïto
c25c527c25 [FREELDR:ARCH] Simplify DetectPciBios() (#8732)
- Let it take a `MachFindPciBios` parameter, similar to the
  `GET_SERIAL_PORT MachGetSerialPort` parameter of `DetectSerialPorts()`.

- Remove the `FindPciBios` global.
- Reduce indentation level.
2026-04-02 17:16:54 +02:00
Ahmed Arif
229f7891a1 [FREELDR][HAL] Skip x86 BIOS emulator on UEFI boots (#8827)
Skip x86 BIOS emulator initialization on EFI boots by having FreeLdr populate EFI boot state in the loader block and making HAL consume it.

This keeps BIOS behavior unchanged while avoiding legacy BIOS/INT10 setup in the EFI path and preventing early EFI boot failures caused by entering the BIOS emulator path at all.
2026-04-02 13:37:43 +02:00
Ahmed Arif
5b7a4c948c [FREELDR] Tune MiniTUI progress bar colors (#8828)
If NTLDR_PROGRESSBAR is not defined, use Vista+ style TUI for progress bars in Freeldr. Also, add some macros to improve readability.
2026-04-02 13:04:14 +02:00
Ahmed Arif
9a7f64a0c6 [FREELDR:UEFI] Add BGRT logo support and center it on the loading screen (#8820)
* [FREELDR][UEFI] Add BGRT logo support and center it on the loading screen
* [FREELDR][UEFI] Rework BGRT support and localize ACPI definitions
* [FREELDR][UEFI] Handle signed BGRT BMP height explicitly
* [FREELDR][UEFI] Use shared ACPI BGRT definitions

---------

Co-authored-by: Ahmed ARIF <arif.ing@outlook.com>
2026-04-02 11:35:09 +02:00
Ahmed Arif
b34a1f15df [FREELDR:UEFI] Fix amd64 assembly calling convention and GDT reload (#8698)
- Fix #GP crash on UEFI x64 boot caused by `call ExecuteLoaderCleanly[rip]` and `mov rax, UefiExitBootServices[rip]; call rax` generating indirect calls that read function code bytes as a pointer.

- Reload CS and data segments after `lgdt` to avoid #GP from stale UEFI selectors (e.g. CS=0x38) exceeding the new GDT limit.
2026-03-26 19:36:14 +01:00
Hermès Bélusca-Maïto
62deebac2d [FREELDR:NTLDR] Try to auto-detect which bootvid module to load at boot time (#8720)
Detect whether we run on XBOX or PC98 (on x86 builds), or on (U)EFI or on
a BIOS-based PC, or whether a generic linear framebuffer mode is used, in
order to choose the correct bootvid module to load, based from a predefined
file names list (ideally it should be derived from txtsetup.sif...).

Supersedes PR #8701.

Use `KeFindConfiguration*Entry()` to spelunk the hardware configuration
tree in the NT loader module.

Alternatively, allow the user to override the choice with a new `BOOTVID=`
boot option. In any case, if the selected bootvid module failed to be loaded,
silently fall back to the default bootvid.dll file. The fallback is done
by just letting the PE loader resolve the necessary exports from hal.dll
and ntoskrnl.exe.
2026-03-22 20:16:15 +01:00
Hermès Bélusca-Maïto
6c532e771e [FREELDR][KDCOM][KDGDB] Allow specifying the serial port address in the DEBUGPORT option
This is the same feature as the one that already exists in the
NTOS:KD!kdmain.c module used by the in-kernel KDBG debugger
(GCC builds), first introduced in commit 4ce30245de (r54473),
and documented at:
https://reactos.org/wiki/Debugging#Changing_the_serial_port_address

This feature is useful if one uses a PCI, PCIe, PCMCIA, or ExpressCard
serial card on real hardware (these cards are used e.g. with laptops
without a built-in serial port), or with AMT serial over LAN.
After determining the serial port I/O address (say, 0xCC00), specify
the debug port as follows:

/DEBUGPORT=COM:0xCC00

instead of the usual syntax: /DEBUGPORT=COMn (n an integer).

The same syntax can be used for debugging FreeLoader as well: in the
FREELDR.INI file, add a "Debug" line in the "FREELOADER" section,
as follows:

```
[FREELOADER]
Debug=/DEBUG /DEBUGPORT=COM:0xCC00 /BAUDRATE=115200
```

----

NOTE for KDCOM/KDGDB:

Since `strtoul()` is used, but isn't exported by ntoskrnl, link against
the "strtol" static library that has been introduced in commit d317d4fbcc
(r71481).
2026-03-21 00:10:21 +01:00
Hermès Bélusca-Maïto
f77fcc15ff [FREELDR:INI] Remove trailing whitespace from parsed INI key name
Leading whitespace was already skipped in the code.
2026-03-21 00:06:30 +01:00
Hermès Bélusca-Maïto
8e8cd2e1f6 [FREELDR:INI] inifile.h/parse.c: Formatting; use PCSTR where applicable 2026-03-21 00:06:28 +01:00
Hermès Bélusca-Maïto
956d9f7973 [FREELDR][KDCOM][KDGDB][KDVM][NTOS:KD] Don't overrun the command-line when parsing "DEBUGPORT"
Don't loop past the end of the command-line buffer, if the command-line
terminates with a lone "DEBUGPORT" without any extra parameter following.
For example: "some things   DEBUGPORT  "
2026-03-21 00:06:20 +01:00