508 Commits

Author SHA1 Message Date
Hermès Bélusca-Maïto
437759f505 [SMSS][CSRSRV] Improve debug tracing on subsystem session-related callbacks (#9477)
Note: The debug-logged API names corresponding to the callbacks come
from the SMSS and CSRSRV Windows checked builds, and cross-checked
with the System Informer phnt headers[^1][^2].

[^1]: https://ntdoc.m417z.com/smapinumber
[^2]: https://github.com/winsiderss/systeminformer/blob/master/phnt/include/ntsmss.h
2026-09-02 22:30:56 +02:00
Hermès Bélusca-Maïto
39a1f3a8f4 [SMSS] SmpApiLoop(): SEH-wrap the SmpApiDispatch[] routine calls (#9477)
If any one of them crashes, this will emit a diagnostic message
before taking down SMSS.

SAL2-annotate `SmpUnhandledExceptionFilter()`.
2026-09-02 22:30:55 +02:00
Hermès Bélusca-Maïto
f255c9f046 [SMSS] Improve the SmpTerminate() routine a bit (#9477)
- Use SAL2 annotations.

- When terminating the process if the hard error did not already,
  prefer using `Parameters[1]` that contains the actual failure code,
  instead of what `NtRaiseHardError()` returned.
2026-09-02 22:30:39 +02:00
Hermès Bélusca-Maïto
8f5a60b287 [SMSS] SAL2-annotate SmpApiLoop() 2026-09-01 21:45:46 +02:00
Hermès Bélusca-Maïto
b6bdcab9d0 [SMSS] Centralize some Windows-specific hardcoded strings. 2026-09-01 14:20:24 +02:00
Hermès Bélusca-Maïto
f69f04bc67 [USERINIT] Rewrite and fix GetLayoutName() (#9431)
- Allow specifying the length of the output `pszName` buffer.

- Reduce the number of character buffers required.

- Simplify parsing the "Layout Display Name" value, of the form:
  "@file_path,-resID" . Positive resource ID isn't handled.

- Use `LoadLibraryExW(..., LOAD_LIBRARY_AS_DATAFILE)` for loading
  the specified DLL for retrieving its resources.

- Don't leak the loaded DLL when the `LoadStringW()` call succeeds.

- Don't leak the opened registry key when the "Layout Text" value
  retrieval fails.
2026-08-28 15:02:18 +02:00
Hermès Bélusca-Maïto
badbcd2844 [USERINIT] Improve default keyboard layout fallback when changing the language (#9431)
In `SelectKeyboardForLanguage()`, fall back to "English (United States)"
keyboard layout if no other suitable layout is found.
2026-08-28 15:02:16 +02:00
Hermès Bélusca-Maïto
c45c83a4dc [USERINIT] Fix the current KLID matching in CreateKeyboardLayoutList() (#9431)
Use case-insensitive matching for comparing the current KLID with
the enumerated ones.

For example on my machine, `GetKeyboardLayoutNameW()` would return
"0000040C" (French AZERTY layout) in capital hex number, while the
registry `HKLM\System\CurrentControlSet\Control\Keyboard Layouts`
subkeys specify the layouts in lowercase hex, which is of course
perfectly valid: the French AZERTY layout would be "0000040c".

Without the fix, there wouldn't be any matching, and as a result,
the correct keyboard layout wouldn't be selected.
2026-08-28 15:02:14 +02:00
Hermès Bélusca-Maïto
82d0c38495 [USERINIT] Minor refactor for keyboard-layout-related functions (#9431)
- `WCHAR szLayoutId[9]` --> `WCHAR szKLID[KL_NAMELENGTH]`

- Don't use the `LCID` type for unrelated things: namely,
  keyboard layout IDs.

- Simplify `CreateKeyboardLayoutList()` a little.
2026-08-28 15:02:06 +02:00
Hermès Bélusca-Maïto
b299049410 [USERINIT] livecd.c: Change default actions in unattended mode, or if the installer cannot be found (#9363)
- Just after initially caching the path to the ReactOS installer, check
  whether an unattend.inf file can be found in its directory; otherwise,
  fall back to an unattend file in the current ReactOS directory.

- If this unattend.inf file specifies to run an unattended setup
  (`UnattendSetupEnabled` value set to `"yes"`), automatically start the
  ReactOS installer -- instead of starting the live environment desktop.

- If the user presses Ctrl+Shift+F10 however, disable unattended setup
  (suggestion to override the behaviour with a keypress from Whindmar Saksit).

NOTE: in the `WM_INITDIALOG` dialog handlers, use `SendMessageW`
to simulate the button presses. This also allows the invocation
of `EndDialog()` (from the button command handlers) while the
`WM_INITDIALOG` message is handled, so that the USER dialog manager
can then directly close the dialog without showing it first.
2026-08-14 20:05:29 +02:00
Hermès Bélusca-Maïto
1721f743ec [SMSS] Minor code cleanup
- Use `ValueBuffer` explicitly in the `NtQueryValueKey()` calls.

- When any of the `NtQueryValueKey()` calls fail and we print an error,
  avoid debug-printing an uninitialized `PartialInfo->Type` value.

- Remove unused dead code that was invoked in `SmpInvokeAutoChk()`.
  The "dots" that AUTOCHK may want to display instead of its usual
  messages (depending on whether /SOS is given in the boot options),
  is decided by AUTOCHK itself instead of SMSS.
2026-08-10 18:42:25 +02:00
Hermès Bélusca-Maïto
41dadd942f [SMSS] Skip empty commands when loading the "*Execute" Session Manager values
When loading the Session Manager "BootExecute", "SetupExecute",
..., "Execute" REG_MULTI_SZ/REG_SZ registry values, verify that each
NUL-terminated command string contained in these values is valid and
non-empty. Only then, add the command string into the suitable Execute
list. If not (the string is empty), just skip it.

Introduce a specific `SmpConfigureExecute()` handler for this purpose,
while the existing `SmpConfigureMemoryMgmt()` is kept for dealing with
(unrelated) page files values.

By skipping empty command strings, we avoid invoking `SmpExecuteCommand()`
on empty commands, and having `SmpParseCommandLine()` failing and showing
the following debug print:
```
(base\system\smss\smss.c:231) SMSS: SmpParseCommandLine(  ) failed - Status == c0000001
```
2026-08-10 18:42:20 +02:00
Hermès Bélusca-Maïto
5178c3913e [SMSS] Improve the SmpUnhandledExceptionFilter() routine a bit
- Compile the extended diagnostics messages + breakpoint only
  in DBG builds.

- Trigger the breakpoint only if SMSS is being debugged (the
  `BeingDebugged` flag is set in the current PEB). This will
  avoid any unhandled breakpoint exceptions when running
  debug builds of ReactOS without any debugger attached.

- Use a `ExceptionRecord` local variable that captures the
  `ExceptionInfo->ExceptionRecord` member, and use it in the
  code to shorten lines a bit.

- Print the "Memory Address" and "Read/Write" values only for
  specific exceptions (`STATUS_ACCESS_VIOLATION`, `STATUS_GUARD_PAGE_VIOLATION`,
  `STATUS_STACK_OVERFLOW`, and `STATUS_IN_PAGE_ERROR`), whose
  parameters actually specify these values.

  Additionally, print the "I/O Error" code in case of the
  `STATUS_IN_PAGE_ERROR` exception.

- In all of these specific exceptions, the `ExceptionInformation[0]`
  specifies the "Read/Write" (or "Execute") value, while the
  `ExceptionInformation[1]` specifies the virtual address of the
  inaccessible data. And not the reverse, as we did previously.
2026-08-09 17:05:16 +02:00
Jose Carlos Jesus
9abb0c4d82 [FORMAT] Add Portuguese (pt-PT) translation (#9168) 2026-07-30 19:50:44 +03:00
Jose Carlos Jesus
bd891b6e27 [DISKPART] Update Portuguese (pt-PT) translation (#9159) 2026-07-30 19:30:43 +03:00
Hermès Bélusca-Maïto
064dd8f832 [USERINIT] Locate and cache early the path to the ReactOS installer when starting in livecd mode
- Move `ExpandInstallerPath()` from userinit.c to livecd.c, and update
  its SAL2 annotations and Doxygen comment.

- Make `StartInstaller()` directly use the cached ReactOS installer path.

- This avoids invoking yet again `ExpandInstallerPath()` when trying to
  locate the installer also for the aim of determining whether to disable
  the "Install" button.
2026-07-27 20:06:02 +02:00
Hermès Bélusca-Maïto
d524789ed0 [USERINIT] Simplify the LiveMedium check
Use the standard way of checking for the existence of
the `HKLM\SYSTEM\CurrentControlSet\Control\MiniNT` key.
Addendum to commit 8c9a41db96 (r70607).
2026-07-27 19:32:27 +02:00
Jose Carlos Jesus
fbfe8321ef [CHKDSK] Update Portuguese (pt-PT) translation (#9162) 2026-06-28 20:32:46 +02:00
Carl J. Bialorucki
2263c9ca0f [USERINIT] Start shell from profile path
When the shell is assigned to cmd.exe, open to the logged in user's profile path. This appears to match the behavior of Windows Server 2003 userinit. It is also a prerequisite for ReactOS Server Core.
2026-06-08 10:11:57 -05:00
Doug Lyons
71540fda3c [CHKDSK][FMIFS]Improve chkdsk output messages (#8946)
CORE-20573

Improve chkdsk output when failing to complete successfully by adding the returned error code.
Return status code from fmifs/chkdsk.c in the "modifier" parameter.
If the error returned is STATUS_DISK_CORRUPT_ERROR then display a message that running again may fix it.
2026-05-23 19:46:24 -05:00
Jose Carlos Jesus
9a9f312f88 [WINLOGON] Update Portuguese (pt-PT) translation (#8976) 2026-05-20 18:26:18 +03:00
Katayama Hirofumi MZ
4e2cca167d [WINLOGON] Optimize StartLsass and StartServicesManager (#9016)
Optimize for speed.
JIRA issue: N/A
Do not initialize the STARTUPINFO member, which is already
filled with zeros, with zeros, in StartLsass and
StartServicesManager functions.
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2026-05-17 08:42:32 +09:00
Hermès Bélusca-Maïto
eec8c97708 [USERINIT] In LiveCD/"MiniNT" mode, start the shell with a suitable environment block
Using `userenv!CreateEnvironmentBlock()` when starting the shell ensures
that, even if it's started as LocalSystem, its environment inherits the
"dynamical" environment variables created by SMSS at runtime (stored in
`HKLM\SYSTEM\CurrentControlSet\Session Manager\Environment`).

In ReactOS/Windows PE "MiniNT" mode, the Winlogon environment doesn't
contain these values, and doesn't start the Setup with this augmented
environment. (This is compatible with what Windows does, on WinPE or
during a clean installation.)
Winlogon creates an augmented environment only when a user logs in and
starts its shell (standard boot), which isn't the case in "MiniNT" mode.
It is thus the responsibility of the module that starts the shell instead
to do it: in ReactOS' case, userinit.exe in LiveCD mode.

As a result, we get access to the `COMPUTERNAME`, `NUMBER_OF_PROCESSORS`,
`OS`, and `PROCESSOR_*` environment variables, amongst others.
2026-05-15 19:16:59 +02:00
Hermès Bélusca-Maïto
9f5b0f1761 [USERINIT] Minor nits for StartShell() and friends; remove shell32 dependency 2026-05-15 19:16:58 +02:00
Timo Kreuzer
d2dc9355ab [CMAKE] Remove obsolete remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS) 2026-05-07 06:27:58 +00:00
Timo Kreuzer
b13e568d99 [CMAKE] Remove global _CRT_NON_CONFORMING_SWPRINTFS
Instead define it only in 3rd-party code where required.
Most of these will go away with future wine-syncs.
2026-05-07 06:27:58 +00:00
Timo Kreuzer
1cf31524d5 [REACTOS] Stop using non-conforming swprintf / vswprintf
Use the underscored versions instead.
2026-05-07 06:27:58 +00:00
Hermès Bélusca-Maïto
aa8d624253 [SMSS] "BootDir" value creation: Fix fallback code
Addendum to commit c498d0930a.

`SmpTranslateSystemPartitionInformation()`: Reset the `DirInfo->Name.Buffer`
to use the `DirInfoBuffer` scratch area, before doing the OS boot drive letter
fallback. Otherwise, writing directly to `DirInfo->Name.Buffer` would
use its old value, that is going to be `NULL` when the calls to
`NtQueryDirectoryObject()` failed, and this would induce a memory access
crash.

Take also the opportunity to use structures embedding the
`KEY_VALUE_PARTIAL_INFORMATION` and `OBJECT_DIRECTORY_INFORMATION`
data headers, instead of straight `CHAR` arrays. This allows the
structures to use the correct memory alignments required by these
data headers.
2026-04-16 16:11:55 +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
Doug Lyons
c2f56643b6 [VFATLIB][FMIFS][CHKDSK] Chkdsk fixes and improvements (#8810)
CORE-18432

Co-authored-by: Carl J. Bialorucki <carl.bialorucki@reactos.org>
2026-03-31 13:13:31 -05:00
Hermès Bélusca-Maïto
d3a6aed771 [FORMAT] Improve imports, simplify code 2026-03-30 16:08:36 +02:00
Hermès Bélusca-Maïto
cab720aa2c [CMDUTILS][NETWORK][LOGOFF][RUNAS][CMD][SYSTEM] Improve imports and headers for some tools 2026-03-30 13:55:07 +02:00
Katayama Hirofumi MZ
c33672648f [CONIME] Follow-up of #8678 (#8692)
Follow-up of #8678.
JIRA issue: CORE-20243
- Rename conime_res.rc as conime.rc.
- Rename Icon_2.ico as conime.ico.
2026-03-01 10:21:35 +09:00
Katayama Hirofumi MZ
80bd460836 [SDK][KBSWITCH][CONIME][IMM32][NTUSER][MSCTFIME][MSUTB] Define LANGID_... (#8691)
Follow-up of #8678. Commonize the definition of
LANGID_... values.
JIRA issue: CORE-20243
- Define LANGID_... values for CJK in <cjkcode.h> and
  use it.
2026-02-27 10:02:23 +09:00
Katayama Hirofumi MZ
423d7031fe [CONIME][BOOTDATA][GITHUB][SDK] Add conime.exe (#8678)
Prepare for Console IME Input for East Asian.
JIRA issue: CORE-20243
- Modify .github/labeler.yml.
- Add base/system/conime/ .
- Modify boot/bootdata/hivesft.inf for Console
  settings.
- Add imm32!ImmCallImeConsoleIME prototype
  into <imm32_undoc.h>.
- Add IMS_CONSOLEIME_1A and IMS_CONSOLEIME_1B
  values into <imm32_undoc.h>, for WM_IME_SYSTEM
  message.
2026-02-26 09:28:22 +09:00
Eric Kohl
d144fe350a [DISKPART] Refactor the GPT partition creation code
- Move common partition creation code to a separate function.
2026-02-15 16:26:08 +01:00
Eric Kohl
b03c40f440 [DISKPART] Disable all unimplemented commands 2026-02-08 12:38:34 +01:00
Eric Kohl
44609d1398 [DISKPART] Ignore non-mounted GPT partitions in DismountVolume 2026-02-07 14:44:05 +01:00
Eric Kohl
ece92ee517 [DISKPART] Improve the PrintSize function
- Pass the output buffer size to the PrintSize function.
- Use StringCchPrintfW instead of swprintf.
2026-02-07 12:24:22 +01:00
Eric Kohl
b2c1dd83d5 [DISKPART] Fix the drive letter deletion code
The remove and assign commands work properly now.
2026-02-02 22:11:05 +01:00
Eric Kohl
5fd860b383 [DISKPART] Print proper success message in the assign command 2026-02-01 23:53:41 +01:00
Hermès Bélusca-Maïto
8c9039bbd4 [WINLOGON] Workaround buggy 3rd-party DLLs that use a wrong notification handler calling convention (#8640)
CORE-20279

PRELIMINARY REMARK: The described bug and code workaround only applies
for x86 32-bit builds.

----

While the Winlogon notification handlers[^1] actually use a `STDCALL`
calling convention, which can be trivially verified by debugging the
official Windows <= 2003 winlogon.exe and its notification extensions,
there exist 3rd-party Winlogon notification DLLs, like the `Ati2evxx.dll`
one from AMD/ATI XP video drivers, that use a `CDECL` calling convention,
or an invalid number (zero) of parameters.

I think the reason why this happens is as follows.
The official documentation[^1] indicates that the handlers have the
following prototype:
```c
void Event_Handler_Function_Name(
  _In_ PWLX_NOTIFICATION_INFO pInfo
);
```
The documentation (and possibly the internal header Windows is using for
Winlogon) is sloppy, because it doesn't tell whether the convention is
`STDCALL` or `CDECL`. When compiling routines with such a signature, the
compiler will employ whatever default convention it is set to use.

Windows code is typically compiled with `STDCALL` convention as the default
(see e.g. how the Windows Development Kit is set up), thus, such a
function signature would default to `STDCALL`. Observation (with debugger)
shows that it is what Windows' winlogon.exe is indeed expecting.

However, 3rd-party code using a different development environment, could
set the compiler to use `CDECL` as the default calling convention. As a
result, the function signature from above would use `CDECL` instead.

The difference between the `STDCALL` and `CDECL` conventions is how the
function parameters are passed on the stack and how the stack is cleaned
at the end (`STDCALL`: the function unwinds the stack; `CDECL`: the caller
does it). A calling convention mismatch would therefore corrupt the stack,
and this is exactly what happens with the `Ati2evxx.dll` from the AMD/ATI
drivers, see CORE-20279.

The ReactOS Winlogon crashes from the `_RTC_Failure()` handler just after
the 3rd-party handler returns, since we compile our code with runtime checks
enabled. Windows' winlogon.exe doesn't apparently crash, because neither
in Release nor in Checked/Debug mode did they compile winlogon.exe with
RTC enabled. However, its stack would become more corrupt with time.

In order to alleviate this in ReactOS' winlogon.exe, I decided to use
a "generic" workaround, manually calling the handler with inline ASM
(which is OK since the problem and solution is x86-specific only).
It does something similar to what the RTC support does: it checks the
stack pointer after the call and restores it if needed.
An informative message is then emitted in the debugger telling which DLL
is buggy and needs to be fixed.

[^1]: https://learn.microsoft.com/en-us/windows/win32/secauthn/event-handler-function-prototype
2026-01-29 21:04:44 +01:00
Hermès Bélusca-Maïto
9c0efba4b3 [USERINIT] Hide install option on LiveCD when no installer is available (#8614)
RELEASE-8
2026-01-22 21:48:32 +01:00
Hermès Bélusca-Maïto
d46372ef1a [USERINIT] Cleanup some traces and some code 2026-01-22 21:48:16 +01:00
Eric Kohl
e7de59ba45 [DISKPART] Add missing trailing CRLF 2026-01-18 09:12:12 +01:00
Eric Kohl
6da5483392 [DISKPART] Make size units translatable 2026-01-18 01:23:20 +01:00
Eric Kohl
df01aa6241 [DISKPART] Replace the hardcoded volume type strings 2026-01-13 23:30:42 +01:00
Eric Kohl
b5097211c8 [DISKPART] Replace hardcoded strings and fix typos 2026-01-13 21:16:37 +01:00
Eric Kohl
702f9c6f77 [DISKPART] Prevent drive letter changes on boot or system volumes 2026-01-12 19:35:38 +01:00
Eric Kohl
a40bd103fc [DISKPART] Prevent deletion of boot and system partitions 2026-01-12 15:30:19 +01:00