Commit Graph

88627 Commits

Author SHA1 Message Date
Carl J. Bialorucki
11b56acf19 Style changes 2026-04-12 18:20:40 -05:00
Max Korostil
b025598b0a [WIN32KNT_APITEST][NTUSER] Fix NtUserConvertMemHandle BSOD 2026-04-12 15:29:41 -05:00
Eric Kohl
ed5124b7a8 [DHCPCSVC][PSDK][IDL] Implement the enable/disable DHCP part of DhcpNotifyConfigChange/Ex 2026-04-12 18:29:10 +02:00
Hermès Bélusca-Maïto
13ac291830 [NTOS:FSTUB] IoGetBootDiskInformation(): Fix the disks matching condition check.
This is the same fix for the same condition check, as the one already
applied to `IopCreateArcNamesDisk()` in commit 3fe12f1a7c.

This bug was introduced in commit 538b9e4fbf (r49212) and is identical
to the one introduced in commit 6d0861e9ed (r49131).

The idea behind the condition check, is that we consider the enumerated
disk to be a match with the currently-considered one from the ARC disk
signatures, *IF*:

- there is only one single disk listed in the ARC disk signatures,
  *AND* only one single disk detected at runtime by the kernel,
  *AND* this disk is MBR-partitioned;

- *OR*, there is one or more disks present and the enumerated disk's
  signature match the currently-considered ARC disk signature. (This
  is the more general case for when there are one or multiple disks
  on the system, and/or one disk at least is GPT).
2026-04-12 17:26:54 +02:00
Eric Kohl
98b9b434c6 [DHCPCSVC] Implement alternate configuration
- Set the ip address, subnet mask and default gateway when an alternate configuration has been configured.
- Set registry values for the alternate configuration and APIPA.
2026-04-12 14:35:48 +02:00
Hermès Bélusca-Maïto
278234259d [NTOS:FSTUB] Fix bugs in the drive-letters assignment algorithm
Addendum to commit 5ab1cfc553.

- Fix the drive letters assignment ordering for hard disks.

  * Fix the loop that assigns letters to MBR boot and primary partitions;
  * Fix the condition that finds the boot partition (or defaults to the
    first primary partition) to be skipped when assigning letters to all
    remaining hard-disk partitions -- after letters have been assigned
    to the specific boot, primary, logical, etc. partitions.

  NOTE: The drive-letter assignment algorithm is as follows:

  1. For each hard disk, assign a letter to the first encountered boot
     (MBR "active") partition; or if GPT disk, to all data partitions.
     If no boot partition has been found on this disk, assign a letter
     to all of its primary partitions.

  2. Assign a letter to all (MBR) logical partitions for each hard disk.

  3. Assign a letter to all remaining partitions with recognized IDs on
     all disks.

  ****
  We observe that the algorithm 1-3 is tailored for MBR-partitioned disks,
  as it is inherited from the way MS-DOS did it. In addition, partitions
  on GPT disks acquire their drive letters early one, during step 1.
  ****

  4. Assign letters to floppy disks (see below), then to CD-ROMs.

  5. Finally, verify that the OS boot volume has got a drive letter; if
     not, get a free one (or delete the 'Z' drive letter and reassign it
     to the boot volume).

  (See also "Inside Storage Management, Part 1", Mark Russinovich,
   https://www.digiater.nl/openvms/decus/vmslt00b/nt/storage-mgt-nt_2.htm
   about the `IoAssignDriveLetters` function.)

- When assigning drive letters to floppy drives, first assign letters to
  legacy (non-MountMgr-aware) devices, and then to MountMgr-aware devices.
2026-04-11 18:16:27 +02:00
Hermès Bélusca-Maïto
750e463fb1 [NTOS:FSTUB] disksup.c: More simplifications
Addendum to commit 5ab1cfc553.

- Static const-ify the `FloppyString` and `CdString` constants, that are
  common to both `HalpNextDriveLetter()` and `xHalIoAssignDriveLetters()`.

- Improve code comments and variable names.

- In `xHalIoAssignDriveLetters()`:
  * One of the two "generic string buffers" can be thrown away, since
    we can already use the on-stack `Buffer`.

  * No need to `sprintf` + `RtlInitAnsiString` + `RtlAnsiStringToUnicodeString`
    with the risk of failing the conversion (that also allocates memory).
    Instead, just invoke `swprintf` + `RtlInitUnicodeString` as already
    done elsewhere in this function.

  * Replace some '0' to 'FALSE' where applicable.
  * Reduce indentation level of two for-loops.
2026-04-11 18:16:25 +02:00
Hermès Bélusca-Maïto
f2e0e63ee5 [NTOS:FSTUB] Simplify GUID comparisons and partition info saving 2026-04-11 18:16:24 +02:00
Hermès Bélusca-Maïto
bb30c56d6f [NTOS:FSTUB] Improve output of the FstubDbg* helpers + fix a bug
- Compile their contents only when NDEBUG is _NOT_ defined.

- Only keep the first DPRINT in these functions in order to keep the
  file path and line number, but replace the others with DbgPrint in
  order to have a clearer printout.

- Fix a bug in FstubDbgPrintSetPartitionEx(), where PartitionNumber has
  to be used as an indicator parameter but MUST NOT be used to index the
  PartitionEntry pointer. (PartitionEntry already points to the data for
  setting the partition specified by PartitionNumber.)
  The bug certainly came from a copy-pasting error from FstubDbgPrintPartitionEx().
2026-04-11 18:16:23 +02:00
Hermès Bélusca-Maïto
2e610aa9df [NTOS:FSTUB/IO] Unhardcode some values 2026-04-11 18:16:22 +02:00
Hermès Bélusca-Maïto
0bbb12f991 [NTOS:FSTUB] Make some macros more "conforming"
i.e. parenthesized parameters; parenthesize compound macros, etc.
2026-04-11 18:16:21 +02:00
Hermès Bélusca-Maïto
ff751cfa35 [NTOS:FSTUB] Minor formatting improvement for disksup.c internal functions
In addition, add SAL2 annotations to them, some comments fixes,
and remove old unused definitions.
2026-04-11 18:16:20 +02:00
Hermès Bélusca-Maïto
44f06398e2 [NTOS:FSTUB] Fix old-annotations for the *IoReadPartitionTable* routines 2026-04-11 18:16:19 +02:00
Hermès Bélusca-Maïto
c498d0930a [SMSS] "BootDir" value creation: Use a fallback if no drive letter was assigned to the SystemPartition
In `SmpTranslateSystemPartitionInformation()`, fall back to using the
OS boot drive letter if none was found to be assigned to the SystemPartition.
Otherwise, just fail if any other error was encountered.
(This behaviour has been introduced in a post-SP1 Windows 7 update.)

Additionally, simplify very slightly the code.
2026-04-11 18:16:13 +02:00
Sylas Hollander
5af4c8df82 [GITIGNORE] Add .idea directory to git ignore list (#8851)
This prevents IntelliJ IDEA/CLion configuration from being synced to git.
2026-04-11 14:40:22 +03:00
Katayama Hirofumi MZ
215d409f52 [IMM32][NTUSER][SDK] Implement ImmSendIMEMessageExA/W (#8850)
Supporting Win3.x IMM.
JIRA issue: CORE-19268
- Move <wine/ime.h> to psdk <ime.h>.
- Add some constants to
  <imm32_undoc.h>.
- Implement ImmSendIMEMessageExA
  and ImmSendIMEMessageExW
  functions.
2026-04-11 09:45:38 +09:00
Katayama Hirofumi MZ
61fb4db34c [SDK][IMM32][NTUSER] Delete <jpnvkeys.h> and use <wine/ime.h> instead (#8847)
Follow-up of #8846. Now <jpnvkeys.h>
is useless. Minor refactoring and
standardation.
JIRA issue: CORE-19268
- Replace <jpnvkeys.h> usage with
  <wine/ime.h> and fix
  VK_DBE_ENTERIMECONFIGMODE
  naming.
- Remove duplicated
  WM_IME_REPORT/IR_* and
  UNDETERMINESTRUCT definitions
  now provided by wine/ime.h.
- Introduce win3send.c half-
  implementing
  ImmSendIMEMessageExA/W.
- Add CMake option
  IMM_WIN3_SUPPORT (default: ON).
2026-04-10 08:30:56 +09:00
Katayama Hirofumi MZ
ce73ba4426 [IMM32][SDK] ImmGetCompositionString: Support GCS_PRIVATE (#8844)
Prepare for CTF IME support.
JIRA issue: CORE-19268
- Add GCS_PRIVATE (0x8000) constant,
  COMPSTR_PRIVATE structure, and
  CtfImmIsGuidMapEnable prototype
  to <imm32_undoc.h>.
- Implement GCS_PRIVATE index in
  ImmGetCompositionStringA/W.
2026-04-10 07:10:11 +09: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
f3c1d644ec [NTOS:IO] IopCreateArcNames(): Remove unused variable and improve comments
This has been forgotten since the split of `IopCreateArcNames()`
in commit 6d0861e9ed (r49131).

Also, improve comments regarding `ArcHalDeviceName` vs. `ArcBootDeviceName`.
2026-04-09 22:21:06 +02:00
Hermès Bélusca-Maïto
7f433ed74d [NTOS:CM] CmpSetSystemValues(): Export the Vista+ "FirmwareBootDevice" registry value
In the `HKLM\SYSTEM\CurrentControlSet\Control` registry key,
the `FirmwareBootDevice` value specifies the firmware boot
(i.e. system partition) device in ARC format, obtained from
`LoaderBlock->ArcHalDeviceName`.
For some reason it is exposed only on Windows Vista and later.

This value is similar to the `SystemBootDevice` one, which specifies
instead the OS boot device in ARC format, obtained from
`LoaderBlock->ArcBootDeviceName`.

In addition: check the value returned by `RtlCreateUnicodeStringFromAsciiz()`
and fail if so.
2026-04-09 22:16:35 +02:00
Hermès Bélusca-Maïto
9336919fec [NTOS:KD64] Improve the ARC Paths output in the KdpPrintBanner()
Instead of mixing the paths order (ArcBoot, NtHal, ArcHal, NtBoot),
show them in a meaningful order: ArcHal, NtHal, ArcBoot, NtBoot.

- The `ArcHalDeviceName` + `NtHalPathName` is the path to the system
  loader started by the firmware (and the HAL in old non-x86 Windows
  versions).

- The `ArcBootDeviceName` + `NtBootPathName` is the operating system
  boot partition and directory ("system root").
2026-04-09 22:16:34 +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
Dmitry Borisov
655d3ee756 [VCRUNTIME] Fix string I/O inline asm (#8743)
Avoid clobbering buffer operands when performing string I/O operations.

CORE-20078, CORE-16216, CORE-17977
2026-04-08 19:22:24 +03: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
Katayama Hirofumi MZ
a5722b9096 [SDK] Borrow <ime.h> from Wine (#8846)
Prepare for Win3 IME support.
JIRA issue: CORE-19268
- Copy file ime.h from
  https://github.com/wine-mirror/wine/blob/master/include/ime.h
  to our sdk/include/wine/.
2026-04-08 18:03:42 +09:00
Hermès Bélusca-Maïto
474348fcb4 [NTOS:IO] IopCheckDeviceAndDriver(): Improve DPRINT trace 2026-04-07 20:23:56 +02:00
Hermès Bélusca-Maïto
9a6dfe313d [NTOS:IO] Use IoGetDevObjExtension/IoGetDrvObjExtension macros instead of unreadable casts 2026-04-07 20:23:55 +02:00
Hermès Bélusca-Maïto
b364f702d2 [NTOS:IO] IoGetAttachedDeviceReference/IoGetDeviceAttachmentBaseRef: Retrieve attached device under lock
As implicitly implied by the MSDN description for `IoGetAttachedDevice()`:
https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-iogetattacheddevice

> IoGetAttachedDevice differs from IoGetAttachedDeviceReference in the
> following respects:
>
> [...]
>
> - Callers of IoGetAttachedDevice must ensure that no device objects are
>   added to or removed from the stack while IoGetAttachedDevice is executing.
>   Callers that cannot do this must use IoGetAttachedDeviceReference instead.

the `IoGetAttachedDeviceReference()` has to acquire the device list lock
to ensure that no device objects get added to or removed from the device
stack during its invocation.

Similarly, `IoGetDeviceAttachmentBaseRef()` has to do the same.
2026-04-07 20:23:54 +02:00
Hermès Bélusca-Maïto
cea19d2e0f [NTOS:IO] IopAttachDeviceToDeviceStackSafe(): Attach the device to the device list UNDER lock!
This function is the internal helper for the `IoAttachDevice*()` functions,
in particular for `IoAttachDeviceToDeviceStackSafe()`.

Because the function modifies the chained list of stacked devices, it must
hold the device list lock (the I/O system database lock) while doing the
devices attachment.
In particular, modifying the `SourceDevice`'s extension `AttachedTo` field,
but also modifying its other fields and the `AttachedDevice` ones as well.

This fix is similar to the one already committed in f8cbc3e48c (r70496).

----

In MSDN [^1] it is indicated (although not as clearly as it could be) that
`IoAttachDeviceToDeviceStackSafe()` sets the returned `AttachedToDeviceObject`
pointer under the device list lock. The reason is best spelled in [^2][^3].
Indeed, when a filter attaches to a lower PDO (`PhysicalDevice`) by doing:
```c
myDeviceExtension->LowerDevice =
    IoAttachDeviceToDeviceStack(myFilterDevice, PhysicalDevice);
```
there exists a time window where the function finished attaching the filter
device to the PDO, but hasn't yet returned the device at the top of the
stack to be stored in `myDeviceExtension->LowerDevice` (which gets used
later internally by the filter to pass IRPs down the device stack).
During this time, the filter device may receive some IRPs and its
dispatch routine would use a not-yet initialized `LowerDevice` member.

The IoAttachDeviceToDeviceStackSafe() allows doing:
```c
Status = IoAttachDeviceToDeviceStackSafe(
    myFilterDevice, PhysicalDevice, &myDeviceExtension->LowerDevice);
```
and forbidding the IRPs to be delivered to the filter device, while the
`LowerDevice` member is being initialized with the device list lock held.

----

[^1]: "IoAttachDeviceToDeviceStackSafe function (ntddk.h)"
https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-ioattachdevicetodevicestacksafe#remarks

[^2]: "IoAttachDeviceToDeviceStack gotcha" (Satya Das, Winprogger)
https://winprogger.com/ioattachdevicetodevicestack-gotcha/

[^3]: Community OSR answer (by Tony Mason)
https://community.osr.com/t/attach-filter-driver/9450/3
2026-04-07 20:23:54 +02:00
Hermès Bélusca-Maïto
45687e82f3 [NTOS:IO] Minor formatting for IopAttachDeviceToDeviceStackSafe()
- Fix few comments;
- Mark the function static.
- SAL2-ify its parameters.
2026-04-07 20:23:49 +02:00
Mikhail Tyukin
7675017f60 [CMAKE] Add and use add_idl_reg_scripts (#8813)
* [CMAKE] Add add_idl_reg_scripts
* [WINDOWSCODECS] use add_idl_reg_scripts
* [OLE32] use add_idl_reg_scripts
* [ACTXPRXY] use add_idl_reg_scripts
2026-04-07 16:56:14 +00:00
Katayama Hirofumi MZ
4671b481a3 [NTGDI][FREETYPE] FontLink: Request sub-font sizes (#8806)
A bug fix of FontLink'ed glyph size.
JIRA issue: CORE-20470
- Add FONTLINK_ENTRY structure
  and g_FontLinkEntries variable.
- Delete font-link cache mechanism.
- Don't access the registry while
  rendering is in progress.
- Request sub-font sizes while
  drawing FontLink text.
2026-04-07 14:06:50 +09:00
Eric Kohl
10092f8466 [DHCPCSVC] Load and update the alternate configuration data 2026-04-07 00:55:32 +02:00
Eric Kohl
b2e9439a53 [NETCFGX] Call DhcpFallbackRefreshParams when the alternate configuration has been changed 2026-04-06 14:13:07 +02:00
Eric Kohl
4b9adaa971 [DHCPCSVC] Add the client code and server stub for DhcpFallbackRefreshParams
DhcpFallbackRefreshParams is called by the TCPIP notification object after the alternate configuration has been changed.
2026-04-06 13:42:03 +02:00
Mark Jansen
a409e5dcd8 [EXPLORER-OLD] Retire explorer-old 2026-04-05 21:31:08 +02:00
Eric Kohl
b481fb5674 [PSDK][UUID] Add the INetCfgSysPrep, INetCfgComponentSysPrep and INetCfgComponentUpperEdge interfaces 2026-04-05 18:23:19 +02:00
Eric Kohl
1ae75e00ae [NETCFGX] Replace calls to MessageBox by TRACE 2026-04-05 15:03:56 +02:00
Eric Kohl
1a04259951 [NETCFGX] Fix gateway and name server data management in the basic dialog 2026-04-05 14:58:33 +02:00
Eric Kohl
22f1afe4ea [PSDK] Fix typos in INetCfgComponentSetup macros 2026-04-05 13:35:00 +02:00
Eric Kohl
68d1570859 [NETCFGX] The IPAddress, SubnetMas and DefaultGateway values must be of type REG_MULTI_SZ 2026-04-05 12:46:47 +02:00
Eric Kohl
2a40a01d4a [NETCFGX] Call the ApplyProperties or CancelProperties method
Call the ApplyProperties or CancelProperties method when the user clicks the OK or Cancel button of the property sheet.
2026-04-05 12:43:04 +02:00
Doug Lyons
2a2aaf98d4 [CHKDSK][VFATLIB] Chkdsk should not write unless using "-F" switch. (#8826)
CORE-20539

Before calling "fs_write" test if we are in a read-write mode by checking "rw".
I intend to re-evaluate this to try and reduce the difference to dosfschk in the future.

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2026-04-04 23:01:35 -05:00
Doug Lyons
57664f1c1e [CHKDSK][VFATLIB] Chkdsk, fix writes to wrong disk offsets (#8840)
CORE-20546

When an alignment is needed and a new read is required,
 make sure we seek back to the read position for our write.
2026-04-04 18:30:52 -05: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