Commit graph

426 commits

Author SHA1 Message Date
Justin Miller
83faff8706
[FREELDR] Hack AMD64 so it can boot in high mem (#8226)
Hack ReactOS AMD64 so we can boot on systems with higher ram amounts tested up to 128gb

JIRA report: CORE-20265
2025-07-03 12:47:34 -07:00
Hermès Bélusca-Maïto
af96e9f353
[TRANSLATIONS] Fix some typos in French translations (#8164) 2025-06-29 16:31:39 +02:00
Daniel Victor
6ed46baf49
[FREELDR] Improve disk detection (#8074)
Improve disk detection on UEFI by using PublicBootHandle index

JIRA issue: CORE-11954
2025-06-23 16:03:05 -07:00
Daniel Victor
22d077f9f1
[FREELDR] Make the NTFS filename comparison conforming to NTLDR/BOOTMGR (#8021)
When an NTFS partition is created with Windows and modified with Linux
(see below), the NTLDR/BOOTMGR will compare the file names ignoring the
case of the files, while FreeLdr does not and the same hack is on Btrfs
file name comparison.

This PR is necessary because the case of the file names on registry, etc.
may not always be consistent!

How to reproduce:
- Try to install Windows with NTFS and install FreeLdr on it;
- Try to modify Windows partition on Linux like creating/copying some new files;
- Try to boot with FreeLdr (it will fail if the hive file path case is different
  than the actual file path);
- Try to boot with NTLDR/BOOTMGR (it will work finally reaching the desktop).
2025-06-03 16:47:15 +02:00
Daniel Victor
bad53bf847
[FREELDR] Fix UEFI boot after FreeLoader split (#8069)
Add missing initialization of the module list and boot devices.
This makes UEFI boot work again after #7488 merge.

CORE-11954
2025-06-02 13:42:49 +03:00
Mohammad Amin Mollazadeh
0fa49018cd
[FREELDR] Show a notice message when booting in debug mode (#7967)
Make FreeLoader print a notice message before it passes the control
to the kernel, if kernel-mode debugging is enabled via boot options.

This can be helpful for people who may forget that they're booting
in debug mode (the default boot option also for the bootcd) and they
need to attach a debugger for the boot process to continue.
2025-05-14 22:15:11 +02:00
Hervé Poussineau
9b70d4380c [FREELDR] Allow empty RDPATH parameter
In that case, read the whole partition/disk, instead of the selected file.

CORE-14603
2025-04-27 23:49:21 +02:00
Hermès Bélusca-Maïto
a3899d8151
[FREELDR:PC98] Don't do the HighRes check everytime a character is written with writechr (#4359)
And bring similar simplifications to the PC98 FAT12 bootsector.

Co-authored-by: Dmitry Borisov <di.sean@protonmail.com>
2025-04-08 15:50:43 +02:00
Adam Słaboń
d66ad21ee0
[FREELDR][INSTALL] Update the FreeLoader installation message (#7853)
Update the installfreeldr message in accordance with the changes in 3d516e71d3.
2025-04-02 00:06:12 +03:00
Justin Miller
177cbd81af Revert "[FREELDR] Pass the correct ACPI table for Windows (#7486)"
Sorry this is something I had to do, I should have investigated deeper
before approving it and that's on me so ill take this over and get this
done. and credit you once again. Thank you @ILauncherDev
This reverts commit 185225a5fc.
2025-03-28 07:20:45 +01:00
Daniel Victor
185225a5fc
[FREELDR] Pass the correct ACPI table for Windows (#7486)
JIRA issue: CORE-11954 and CORE-18969

This PR passes the real ACPI table instead of a hardcoded (PVOID)1.
2025-03-24 21:49:39 +01:00
Serge Gautherie
9ecd5fb6fe
[FREELDR] DisplayBootTimeOptions(): Simplify concatenation checks (#4058) 2025-03-24 20:14:04 +01:00
Dmitry Borisov
5fb6fad175
[FREELDR] iso.c: Remember the last directory that was accessed (#7734)
This patch reduces the number of sectors read by 709 (from 8788 to 8079)
2025-03-21 22:17:29 +01:00
Dmitry Borisov
564be44f45
[FREELDR] iso.c: Remove a redundant zero initialization of the FileName buffer (#7734)
The FileName buffer is NUL-terminated later on.
2025-03-21 22:17:11 +01:00
Dmitry Borisov
b931c51937
[FREELDR] iso.c: Avoid unnecessary zero-init and copy of the file info structure (#7734)
FileHandle gets initialized completely in IsoSearchDirectoryBufferForFile()

- Also mark some functions as static.
2025-03-21 22:15:54 +01:00
Dmitry Borisov
61ee431169
[FREELDR] iso.c: Cache the PVD information for ISO volumes (#7734)
This patch reduces the number of sectors read by 41 (from 8829 to 8788)
2025-03-21 22:15:43 +01:00
Daniel Victor
19c1f5661f
[BOOTSECT][FREELDR] Fix wrong comment of conditional jump on ext.S and extldr.S (#7798) 2025-03-18 23:52:56 +01:00
Dmitry Borisov
787f81f3f5
[FREELDR] Refactor and optimize the IDE driver (#7728)
[DDK] Update IDENTIFY data and other ATA definitions.
Based on the MinGW header.

[FREELDR] Refactor and optimize the IDE driver.
Fix long-standing bugs, which have a negative impact on the boot stability.

- Make the driver more ATA specification compliant.
- Improve the speed of device detection.
- Remove inconsistent delays.
- Support modern hard drives with sector size greater than 512 bytes.
- Add basic error recovery.
- Move private definitions to a separate private header.
- Remove the useless AtaFree API method.
2025-03-18 21:56:25 +01:00
Daniel Victor
ddf55b3772
[BOOTSECT][FREELDR] Rewrite the Ext bootsector (#7544)
Rewrite the Ext bootsector because the older one was broken and had no compatibility with Ext4 extents.
Introduce a 3rd-stage bootsector for complex code.

CORE-14235

- Why was the previous bootsector broken?
  Because of hardcoded inode size, hardcoded freeldr base address, etc.

- Why is there a extldr.sys?
  The extldr.sys was introduced because the limited code space in the bootsector
  prevents adding new features, such as Ext4 full extents support.

- What is extldr.sys and What does it do?
  It is the helper file for the Ext bootsector and that is necessary for adding
  Ext4 support. It locates the freeldr.sys file, loads it into memory and runs it.
2025-03-18 21:53:47 +01:00
Timo Kreuzer
9a093ecbe9 [FREELDR] Fix menu display on VMware
When drawing the menu, the boot options should not be overwritten, but when clearing the screen, everything needs to be drawn, otherwise there will be uninitialized characters at the bottom. See CORE-20014.
2025-03-18 00:36:40 +02:00
Dmitry Borisov
029e53ddb5
[MINIHAL] Minor improvements (#7398)
* [FREELDR] Mark noreturn functions

* [FREELDR] Compile hw debugging support code only in debug builds

- Make BREAKPOINT() portable

* [FREELDR] Consolidate identical names into a single string

* [FREELDR] Use intrinsics for string I/O operations on x86 and x64

Stop them being pulled in from a static minihal library

* [MINIHAL] Exclude unnecessary portio dependency
2025-03-11 10:30:14 +03:00
Daniel Victor
afb96acfdd [FREELDR] Use the OFF(x) macro on realmode assembly files 2025-03-02 19:09:46 +01:00
Daniel Victor
56c8c8ab4f [FREELDR] Add Extents support 2025-02-20 19:28:41 +02:00
Daniel Victor
a980ad08b4 [FREELDR] Rewrite the header and reformat/adapt current code 2025-02-20 19:28:41 +02:00
Daniel Victor
1f3083be75 [FREELDR] Rename almost everything to Ext 2025-02-20 19:28:41 +02:00
Daniel Victor
d0dfb6cf6f [FREELDR] Rename the ext2.* to ext.* 2025-02-20 19:28:41 +02:00
Timo Kreuzer
a1a169fbe8 [FREELDR] Fix pc98 build 2025-02-04 16:45:48 +02:00
Timo Kreuzer
2b71c738b8 [ROSLOAD] Enable registry healing code for x64 2025-02-04 16:45:48 +02:00
Timo Kreuzer
e56911f66b [FREELDR] Implement loading of rosload as 2nd stage loader 2025-02-04 16:45:48 +02:00
Timo Kreuzer
adacd51a30 [FREELDR] Use StallExecutionProcessor instead of KeStallExecutionProcessor
The latter will only be available in rosload.exe.
2025-02-04 16:45:48 +02:00
Timo Kreuzer
17cf47df44 [ROSLOAD] Add rosload.exe target as 2nd stage loader 2025-02-04 16:45:48 +02:00
Timo Kreuzer
ebcf3f23aa [FREELDR] Remove ShowBootOptions from Menu code
This removes a dependency of UI code to boot options code by getting rid of a call to DisplayBootTimeOptions() from within the menu code.
Instead this is now handled by MainBootMenuKeyPressFilter.
2025-02-04 16:45:48 +02:00
Timo Kreuzer
9daef292e9 [FREELDR] Move MachInitializeBootDevices to BootMain 2025-02-04 16:45:48 +02:00
Timo Kreuzer
f81c1910ee [FREELDR] Export functions for a 2nd stage loader 2025-02-04 16:45:48 +02:00
Timo Kreuzer
2f9dde09e1 [FREELDR] Replace some macros/inline functions and global variables with functions
This allows to easily import them from a 2nd stage loader without having to bother about _declspec(dllimport)
2025-02-04 16:45:48 +02:00
Katayama Hirofumi MZ
fe11f7a2e5
[REACTOS] Refresh old URLs (#7632)
URLs are getting old. We have to
update URLs for documentation
purpose.
JIRA issue: CORE-19963
- Refresh old URLs.
- Add " (DEAD_LINK)" labels
  to dead links.
- Use MS Learn links rather
  than MSDN ones.
- Some dead links revived by
  Web Archive.
- Don't change Wine Tests
  and Wine Sync.
- Don't change 3rd party libraries.
- Don't append "redirected" labels.
2025-01-28 13:36:45 +09:00
Daniel Victor
d72864de95 [FREELDR] Fix wrong segment register at lgdt instruction in amd64.S 2025-01-20 08:34:44 +02:00
Hermès Bélusca-Maïto
ba342e1d14
[FREELDR] peloader.c: Minor code enhancements.
PeLdrCheckForLoadedDll():
- Use a for-loop to iterate over the linked list.
- Adjust few comments.
- Use SAL2 annotations.

PeLdrpCompareDllName():
- Make its input paramters const.
- Use SAL2 annotations.
2024-12-14 23:31:41 +01:00
Daniel Victor
34e76ade03 [FREELDR] Make it more compatible with w2k3 ini file 2024-12-11 07:18:34 +02:00
Andrei Miloiu
6ec5f8841b
[FDEBUG] Update Romanian (ro-RO) translation (#7340) 2024-12-06 20:48:33 +01:00
Hermès Bélusca-Maïto
dfb43905bb
[FREELDR] peloader.c: Fix PE import binding (#7537)
Use the PE import table's OriginalFirstThunk array when scanning and
resolving imports during DLL binding.

It points to an array of pointer-sized IMAGE_THUNK_DATA structures
which describe the functions being imported. On the other hand, the
FirstThunk points to an array of pointers, whose initial values are
a copy of those pointed to by OriginalFirstThunk, but are replaced
by the actual function pointers determined at runtime, when a DLL
is loaded (see PeLdrpBindImportName() function).
If we were to use the FirstThunk array to find again later the imports
by name or ordinal, we would fail because these are replaced by the
addresses of the corresponding functions.

This fixes loading kdcom.dll from Windows XP x64 with FreeLDR when
testing on ReactOS x64.

```diff
 (freeldr\freeldr\lib\peloader.c:498) trace: PeLdrpScanImportAddressTable() ---- Calling PeLdrpBindImportName() in a loop
 (freeldr\freeldr\lib\peloader.c:501) trace: *** ThunkName->u1.AddressOfData = 00000000000070F0
 (freeldr\freeldr\lib\peloader.c:502) trace: *** ThunkData->u1.AddressOfData = 0000000000573780
 (freeldr\freeldr\lib\peloader.c:209) trace:   !!! ExportDirectory->NumberOfNames 1504
-(freeldr\freeldr\lib\peloader.c:210) trace:   !!! ImportHint 0 - ExportName 'CcCanIWrite' - ImportDataName ''
+(freeldr\freeldr\lib\peloader.c:210) trace:   !!! ImportHint 282 - ExportName 'HalPrivateDispatchTable' - ImportDataName 'HalPrivateDispatchTable'
 ....
-(freeldr\freeldr\lib\peloader.c:268) err: Did not find export ''!
-(freeldr\freeldr\lib\peloader.c:709) err: PeLdrpScanImportAddressTable() failed: ImportName = 'ntoskrnl.exe', DirectoryPath = 'multi(0)disk(0)rdisk(0)partition(2)\ReactOS\system32\'
```
('-': lines before the fix; '+': lines after the fix)

Code has been adapted based from the following functions:
ntdll/ldr/ldrpe.c!LdrpSnapThunk() and LdrpSnapIAT()
ntoskrnl/mm/ARM3/sysldr.c!MiSnapThunk() and MiResolveImageReferences()

References:
https://devblogs.microsoft.com/oldnewthing/20231129-00/?p=109077
https://devblogs.microsoft.com/oldnewthing/20231130-00/?p=109084
https://stackoverflow.com/questions/42413937/why-pe-need-original-first-thunkoft
2024-12-03 13:13:38 +01:00
Hermès Bélusca-Maïto
576fafbaf8
[FREELDR] peloader.c: Add SAL2 annotations for two import-resolving helpers (#7537)
Add annotations for PeLdrpBindImportName()
and PeLdrpScanImportAddressTable().
2024-12-03 13:13:26 +01:00
Hermès Bélusca-Maïto
ddd59f19ae
[FREELDR] peloader.c: Fix some traces 2024-12-03 12:32:08 +01:00
Timo Kreuzer
9b8c59d6b7 [FREELDR] Refactor LoadBootDeviceDriver 2024-11-02 17:31:57 +02:00
Timo Kreuzer
393b1f8998 [FREELDR] Implement PeLdrLoadBootImage 2024-11-02 17:31:57 +02:00
Timo Kreuzer
f9849f7cc4 [FREELDR] Initialize a global module list head for freeldr 2024-11-02 17:31:57 +02:00
Timo Kreuzer
6eac9b5891 [FREELDR] Pass VA instead of PA to PeLdrAllocateDataTableEntry
This allows to create DTEs for loader modules.
2024-11-02 17:31:57 +02:00
Timo Kreuzer
8a5ef4c1cc [FREELDR] Implement PeLdrLoadImageEx
This allows to load an image as freeldr extension code.
TODO:
- Add global bootloader DTE list
- Add wrapper function that also processes imports
- Use this for scsiport
2024-11-02 17:31:57 +02:00
Timo Kreuzer
bee8e81d5a [FREELDR] Move IoReadPartitionTable to ntoskrnl.c 2024-11-02 17:31:57 +02:00
Timo Kreuzer
77ba2d496b [FREELDR] Fix some trace prints 2024-11-02 17:31:57 +02:00