Commit Graph

87773 Commits

Author SHA1 Message Date
Hermès Bélusca-Maïto
b6e732ec71 [NTDLL_APITEST] Add simple tests for RtlUnhandledExceptionFilter(2) (#8353)
Based on an example from Whindmar Saksit.
2025-09-21 18:17:27 +02:00
Hermès Bélusca-Maïto
fa7eca6cd9 [NDK] Expose RtlUnhandledExceptionFilter2() (#8353) 2025-09-21 15:18:15 +02:00
Hermès Bélusca-Maïto
db69a9a7e1 [RTL][NDK] Improve RtlUnhandledExceptionFilter(2) (#8353)
- Reimplement `RtlUnhandledExceptionFilter()` by just calling
  `RtlUnhandledExceptionFilter2()`.

- Return an adequate exception filter value `EXCEPTION_CONTINUE_SEARCH`
  from `RtlUnhandledExceptionFilter2()`, instead of some random error.
  If `ExceptionCode` is `STATUS_POSSIBLE_DEADLOCK` however, return
  `EXCEPTION_CONTINUE_EXECUTION` instead, as shown by a test from Whindmar Saksit.

- The second parameter of `RtlUnhandledExceptionFilter2()` is not
  a flag, but a pointer to string `PCSTR` !
  See https://skanthak.hier-im-netz.de/download/NTDLL.H
  who is the only one online who has the correct definition,
  whose usage I've double-checked on Win7 ntdll.dll.

  This is used in the `<function_name>` slot in the displayed
  debugger message:
  ```
  *** An Access Violation occurred in <program_command_line>:<function_name>
  The instruction at <address> tried to write to a NULL pointer
  ```
  For example, see: https://community.osr.com/t/access-violation/33435
2025-09-21 15:18:14 +02:00
Hermès Bélusca-Maïto
92f680dddb [NDK] Fix the RTLP_UNHANDLED_EXCEPTION_FILTER type (#8353)
Confirmed with the System Informer phnt headers.
2025-09-21 15:18:13 +02:00
Eric Kohl
f0a29c9e9c [NETSH] Improve MatchToken and implement MatchEnumTag 2025-09-21 14:00:00 +02:00
Hermès Bélusca-Maïto
13d70840ff [CTFMON] Some fixes for event handles management (#8392)
- Validate the opened `WinSta0_DesktopSwitch` handle;

- Don't pass the `ahEvents` array containing a NULL pointer to
  `MsgWaitForMultipleObjects()`, but provide the correct number
  of non-NULL handles, otherwise the function fails and the code
  ends up busy-looping.

- Validate the `MsgWaitForMultipleObjects()` result: bail out if
  `WAIT_FAILED` is returned.

- Validate the event index passed to `CRegWatcher::InitEvent()`
  and `CRegWatcher::OnEvent()`.

- Rename `WATCHENTRY_MAX` to `WI_REGEVTS_MAX` and add it in the
  `WATCH_INDEX` enumeration.

- Fix some code comments.
2025-09-20 22:01:34 +02:00
Hermès Bélusca-Maïto
d524fd8e4b [POWERCFG] Various enhancements (#8389)
- Don't hardcode buffer sizes.
- `ShowWindow()` 2nd parameter is an `SW_*` flag, not `TRUE`/`FALSE`.
- The "FIXME: Add battery page" comment is outdated since commit 4bdbb3092c
- Use standard `IDC_STATIC` instead of `-1` for resource control IDs.
- `AUTOCHECKBOX` already contains `WS_TABSTOP`, no need to add it explicitly.
- Reformat file headers.
2025-09-20 18:28:21 +02:00
Eric Kohl
f9458d9e40 [NETSH] Add stubs for undocumented exported functions 2025-09-20 11:10:52 +02:00
Timo Kreuzer
9ab8761f2c [NTDLL] Improve x64 KiUserExceptionDispatcher
Add Wow64PrepareForException handler, which is well documented as a hook for KiUserExceptionDispatcher (see e.g. https://github.com/brew02/KiUserExceptionDispatcherHook) and used by ntdll_winetest.
This also reloads rcx and rdx for the call to RtlDispatchException from the stack instead of relying on the registers to be set up by the kernel, which again is a feature used by ntdll_winetest, which calls this function from a hook with zeroed registers.
2025-09-17 15:48:26 +03:00
Justin Miller
9f78833b4a [OPENGL32] Fix GL_GETINFO ExtEscape call based on mesa MR (#8351)
Just pulls some information from:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4305

Fixes AMD's OpenGL loading when the ctl is made for pulling this information.
2025-09-16 13:39:05 +00:00
Timo Kreuzer
11bb8e4ed0 [RTL] Fix dynamic function tables 2025-09-16 16:23:37 +03:00
Serge Gautherie
9aaa898319 [GITHUB] build-msvc-arm: Limit ARM to windows-2022 (#8363)
Needed SDK support is not available on windows-2025.
Also, tweak toolset line.

CORE-20325 CORE-17604
2025-09-16 13:04:28 +03:00
Eric Kohl
e5b2d5c51e [IFMON] Add option to select an interface to the show commands 2025-09-15 22:59:34 +02:00
Eric Kohl
b6c202c4c8 [NETSH] Set proper error code for internal commands 2025-09-15 22:37:22 +02:00
Hermès Bélusca-Maïto
0f105936cb [POWERCFG] Use the IS_PWR_* macros (#8386) 2025-09-15 16:41:00 +02:00
Hermès Bélusca-Maïto
103c81849f [POWRPROF] Use the IS_PWR_* macros (#8386) 2025-09-15 16:40:59 +02:00
Hermès Bélusca-Maïto
ae4c5b9a8d [NDK] potypes.h: Add useful macros for SYSTEM_POWER_CAPABILITIES (#8386)
Add useful macros, similar to the powrprof.dll `IsPwr*()` functions,
but that are suitable when one has a `SYSTEM_POWER_CAPABILITIES`
structure initialized from `NtPowerInformation(SystemPowerCapabilities)`.

- `IS_PWR_SUSPEND_ALLOWED()`, equivalent to `IsPwrSuspendAllowed()`,
  indicating whether any of the S1, S2, S3 sleep states are supported.

- `IS_PWR_HIBERNATE_ALLOWED()`, equivalent to `IsPwrHibernateAllowed()`,
  indicating whether the S4 sleep state is supported and the
  hibernation file is present.

- `IS_PWR_POWEROFF_ALLOWED()`, equivalent to `IsPwrShutdownAllowed()`,
  indicating whether the S5 "soft-off" state is supported.
2025-09-15 16:40:49 +02:00
Hermès Bélusca-Maïto
1af29a66ca [CMBATT] Inform when a discovered battery doesn't support the _BTP trip-point method (#8384) 2025-09-15 16:26:06 +02:00
Hermès Bélusca-Maïto
b73159fecf [BATTC][COMPBATT] Move the IOCTL_BATTERY_QUERY_STATUS wait hack to BATTC (#8384)
CORE-20343

The 3-second timeout FIXME (instead of waiting indefinitely), made in the
COMPBATT worker thread for the `IOCTL_BATTERY_QUERY_STATUS` case, was done
because _*our*_ BATTC handler expects the batteries to always support the
BTP (Battery Trip Point) feature for signaling a change of battery status,
but in the cases where it isn't supported, any waits it tried for the
battery to notify about a status change would never happen.

Furthermore, following commit 3a6e0d4b65, the `SetStatusNotify()` call
(_which always fails if the battery doesn't support the BTP feature_)
would now always exit the `IOCTL_BATTERY_QUERY_STATUS` handling without
any waiting nor battery polling [^1], and this would cause the COMPBATT
worker thread to busy-poll again forever.

The timeout FIXME is now moved to BATTC, instead of COMPBATT, since the
actual fixes should be in BATTC. In particular, it should queue all the
query IOCTLs and then serve them, either using the StatusNotify (BTP)
functionality if the battery supports it, or if not, do a very-slow
battery polling.

I've also increased the timeout a little bit more (5 seconds and not 3).

[^1]: Per the ACPI specification, it is expected that the operating system
  performs battery polling if the battery doesn't support BTP, see:
  https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/10_Power_Source_and_Power_Meter_Devices/Power_Source_and_Power_Meter_Devices.html#btp-battery-trip-point
2025-09-15 16:25:14 +02:00
Hermès Bélusca-Maïto
54489d6cce [CMBATT] Fix a debug print 2025-09-15 16:25:13 +02:00
Eric Kohl
9e22156c50 [NETSH] Pass correct dwCurrentIndex parameter to context and group commands 2025-09-15 01:27:15 +02:00
Eric Kohl
3f4cee1790 [NETSH] Fix MatchToken to test for a real prefix 2025-09-14 22:33:00 +02:00
Eric Kohl
245bc3f44a [NETSH] Simplify the code by naming the root context 'netsh'
-
2025-09-14 22:14:21 +02:00
Hermès Bélusca-Maïto
20d7fd78ae [CMBATT] Fix "TripPpoint" typo 2025-09-13 21:34:18 +02:00
Hermès Bélusca-Maïto
13dc901d8c [KERNEL32][SVCHOST] LoadLibraryEx 2nd parameter is a handle, so, 0 -> NULL 2025-09-13 21:34:10 +02:00
Timo Kreuzer
571ac5e608 [NTOS:PO] Implement SystemBatteryState in NtPowerInformation
This should get us proper battery status display.
2025-09-13 11:38:38 +03:00
Timo Kreuzer
3a6e0d4b65 [BATTC] Fix IOCTL_BATTERY_QUERY_STATUS
Previously the function waited for the conditions *after* querying the status, and then returned the old status. Also, if querying failed, it waited and when the wait timed out it returned STATUS_SUCCESS without returning any data. If the call to SetStatusNotify failed and there was no timeout, it would wait forever.
This is all fixed now.
2025-09-13 11:38:38 +03:00
Eric Kohl
ae23b4dc8f [NETSH] Add the PreprocessCommand stub 2025-09-13 09:53:46 +02:00
Hermès Bélusca-Maïto
e92be1ede2 [MSGINA] Simplify GetRegistrySettings() (#8381) 2025-09-12 13:53:58 +02:00
Hermès Bélusca-Maïto
27db7ece88 [MSGINA] ReadRegDwordValue(): Support interpreting REG_SZ values as DWORDs when possible (#8381)
This is useful for numerical values that are documented as being stored
in string format as `REG_SZ` in the registry; the reason being that they
are still read or written via `GetProfileIntW()`/`WriteProfileStringW()`
by Windows' Winlogon, and these functions store `REG_SZ` values because
of the INI <-> Registry mapping mechanism.
2025-09-11 16:31:47 +02:00
Timo Kreuzer
01872b8495 [NPFS] Fix dereference of uninitialized variable
- Avoid uninitialized return variables
- Fix a parameter check
2025-09-11 12:31:14 +03:00
Timo Kreuzer
0b18dfe924 [WINETESTS] Move definition of __ROS_LONG64__ to individual tests
This is more explicit than defining it for all wine tests and it directly shows us which tests need to be synced to get rid of the hack.

Addendum to 381e224 (PR #7576)
2025-09-11 09:17:13 +03:00
Timo Kreuzer
570354e984 [ROSTESTS] Remove definitions of __ROS_LONG64__ in testlist.c 2025-09-11 09:17:13 +03:00
Timo Kreuzer
5a8c36d9a1 [SDK] Remove header definitions of __ROS_LONG64__
These were totally pointless, because the condition was never true.
2025-09-11 09:17:13 +03:00
Timo Kreuzer
fff6d96000 [WIN32K:NTGDI] Check for failure of PATH_CreatePath
Also use common cleanup path.
2025-09-10 16:39:22 +03:00
Timo Kreuzer
8a2a587e57 [WIN32K:NTGDI] Save and restore FP state in IntGdiWidenPath 2025-09-10 16:39:22 +03:00
Whindmar Saksit
3d70478560 [SHELL32] Implement the RunAs dialog and verb (#5787)
Implements the "run as another user" part.
2025-09-10 15:21:04 +02:00
Whindmar Saksit
69df57245c [SHELL32] Fix CompareIDs DISK_CAPACITY (#8376)
Addendum to PR #8361

CORE-20286
2025-09-09 17:52:40 +02:00
Eric Kohl
0793006523 [IFMON] Add first netsh helper dll
Run 'add helper ifmon.dll' in netsh to load the ifmon helper.
2025-09-08 02:00:34 +02:00
Eric Kohl
df01941faf [NETSH] Fix helper and context issues 2025-09-08 01:55:04 +02:00
Eric Kohl
1c1b8a2260 [NETSH] Print proper prompt 2025-09-08 01:11:22 +02:00
Doug Lyons
5d5e5d1a46 [NTGDI] Fix SAI Paint Tool Initial Graphics Display (#8348)
CORE-15002
2025-09-06 19:20:44 -05:00
Hermès Bélusca-Maïto
38398fbaf3 [MSGINA] Fix gcc x86 build
Addendum to commit 1499e7ef53.

Poor thing was crying that it was ignoring trigraph `??)`, even
though this whole thing was inside an `#if 0`-commented block...
Use something else instead.

```
msgina/shutdown.c: In function 'ShutdownDialog':
msgina/shutdown.c:1217:56: error: trigraph ??) ignored, use -trigraphs to enable [-Werror=trigraphs]
     pgContext->nShutdownAction = LoadShutdownSelState(???);

msgina/shutdown.c: At top level:
cc1: error: unrecognized command line option '-Wno-unknown-warning-option' [-Werror]
```
2025-09-05 11:55:40 +02:00
Hermès Bélusca-Maïto
a1bbcee5e8 [MSCOREE] Show a user popup if .NET is missing (#8374)
Otherwise, you wouldn't see anything at all when opening a .NET app, and
the only hint that a .NET runtime is needed would be to see the message
in the debug log, provided a debugger is connected to ReactOS ...

NOTE: `shell32!ShellMessageBoxA()` is used instead of
`user32!MessageBoxA`, because it turns out mscoree isn't importing
from user32 but from shell32 instead (as in Wine's), and I don't want
to modify the list of imported modules.

NOTE 2: This warning function has been gradually removed with Wine commits:
  c99754ef15
  6b889fe918
  5cd6db0349
  26c9bd9f15
Now, a mere `ERR("Wine Mono is not installed\n");` is emitted.
2025-09-04 23:02:20 +02:00
Hermès Bélusca-Maïto
9d3809febd [BOOTDATA] Disable logoff/password-change/workstation-lock in the LiveCD (#8373)
- Disable "Log Off" from the Start Menu and the C-A-D Security dialog;

- Disable the "Lock Workstation" and "Change Password" buttons in the
  Security dialog.

These are only "UI"-usability features to prevent the user from
logging off when running the LiveCD. (Logging off from the SYSTEM
account, and changing its password, don't make much sense.)

CORE-11397
2025-09-04 22:58:48 +02:00
Hermès Bélusca-Maïto
1499e7ef53 [MSGINA] Improve Security and Shutdown dialog features (#8372)
- Respect system policies for showing or hiding:

  * Security dialog "Lock Workstation", "Log Off", "Shut Down",
    "Change Password", "Task Manager" buttons;

  * "Log Off" entry in the Shutdown dialog;

- Disable the "Shut Down" Security dialog button, and the "Stand by",
  "Shut down" entries in the Shutdown dialog, if the logged user
  doesn't have the SeShutdownPrivilege.

- Add other missing `WLX_SHUTDOWN_STATE_*` shutdown flags that are
  supported by Windows.

- Improve the retrieval of shutdown options to be displayed in the
  "Shut Down" dialog. In particular, don't hardcode any sort of
  defaults, but let them come from what the user can do (Is logoff
  allowed? Does (s)he have the rights to shutdown/reboot? etc.).
  If no shutdown options are available, then simply don't display
  the dialog!

- Don't hardcode the default selected shutdown option. Either it comes
  from the user's registry and is valid (i.e. corresponds to an existing
  shutdown option in the dialog), otherwise, fall back to the first
  option in the dialog.

  In particular this means:
  * when opening the "Shut Down" dialog from the C-A-D Security
    dialog, by default we will select the "Log Off" option, or
    whatever the user last selected;
  * when opening the dialog from the "Turn Off" Start Menu item, default
    to the "Shut down" option, or whatever the user last selected.
  * when opening the dialog from the C-A-D "Log On" dialog (no user
    is logged in), the "Shut down" option will also be selected, or
    whatever the system operator last selected.

- For the shell-invokable `ShellShutdownDialog()` function, implement
  support for using a custom display user name, or the one in the
  `"Logon User Name"` registry value saved by `WlxActivateUserShell()`.
  Plus, the 3rd parameter specifies the list of shutdown options to
  *exclude* from the options list.
2025-09-04 22:57:23 +02:00
Whindmar Saksit
87df3ea3e1 [SHLWAPI][EXPLORER] Implement OS_SERVERADMINUI (#7051)
OS_SERVERADMINUI changes minor things in Explorer, the most visible is that the default folder view mode changes from large icons to details
2025-09-04 19:25:43 +02:00
Mark Jansen
db57e02d6b [APPCOMPAT] Add RendererFull3D flag
This flag will be used for DDraw experiments.
CORE-20322
2025-09-04 15:23:48 +02:00
Hermès Bélusca-Maïto
0b43959beb [MSGINA] OnInitSecurityDlg(): Remove unnecessary code (#8371)
The Security dialog can be displayed only when a user is logged.
When this is so, the `pgContext->bAutoAdminLogon` has already been
reset to `FALSE`, see `gui.c!DoLogon()`. Thus there is really no
reason to disable the "Log Off" button in that case.

Addendum to commit c633b79451 (r61622)
2025-09-04 11:55:07 +02:00
Hermès Bélusca-Maïto
b306f46e5b [MSGINA] Revisit WlxActivateUserShell(), add support for "Logon User Name" (#8370)
- Add SAL annotations;
- Avoid using hardcoded buffer sizes in function calls.

- If the start-application (Userinit) launched successfully, store
  in the logged-in user's Explorer key, value `"Logon User Name"`,
  the user name that was entered verbatim in the "Log On" dialog
  to log into the system. This value is used as a "convenience" to
  display the `"Log Off <username>"` item in the explorer's Start menu
  (see `explorer!util.cpp:GetCurrentLoggedOnUserName()`), and the
  corresponding item in the "Shut Down" dialog.

- utils.c: Introduce the `RegOpenLoggedOnHKCU()` helper, for opening
  the current logged-in user HKCU key.

  NOTE: Regarding the `.Default` registry key, see:
  https://devblogs.microsoft.com/oldnewthing/20070302-00/?p=27783
2025-09-04 11:47:01 +02:00