Commit Graph

443 Commits

Author SHA1 Message Date
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
44f06398e2 [NTOS:FSTUB] Fix old-annotations for the *IoReadPartitionTable* routines 2026-04-11 18:16:19 +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
a4621bb280 [NTOS:PS][NTDLL_APITESTS] Implement ThreadNameInformation for NtQuery/SetInformationThread() (#8484)
The `ThreadNameInformation` (#38) class is the Windows 10.1607+ way
of assigning a human-readable name (i.e. description) to a given
thread object, that is visible to debuggers and diagnostic tools
(e.g. WinDbg `!thread` command, Process Explorer ...), which is
useful for debugging scenarios.[^1]

Before this, the only way to assign a name to a thread for debugging
purposes was to raise a specific exception, that had to be caught and
interpreted by a supported debugger.[^2][^3]

When the thread object is being deleted (`kill.c!PspDeleteThread()`),
free the thread name if set (courtesy of Ahmed Arif, PR #8796).

References:
[^1]: https://learn.microsoft.com/en-us/visualstudio/debugger/tips-for-debugging-threads
[^2]: https://learn.microsoft.com/en-us/archive/blogs/stevejs/naming-threads-in-win32-and-net
[^3]: https://ofekshilon.com/2009/04/10/naming-threads/
2026-03-29 19:35:34 +02:00
Hermès Bélusca-Maïto
2e1a0b73c9 [NTDLL_APITEST][NTOS:PS] Adjust probelib.c test code to skip non-implemented Win7+ thread information classes
Re-enable in ps_i.h the stubbed probing info values for thread information
classes, that were disabled in commit 60aad33ed0 (PR #8487), and adjust
the test code in probelib.c so that the failures for these non-implemented
classes are correctly taken into account.
2026-03-29 16:52:07 +02:00
Hermès Bélusca-Maïto
a2a434e8d5 [NTDLL_APITEST] Minor formatting for probelib.c 2026-03-29 16:52:06 +02:00
Hermès Bélusca-Maïto
2593cea230 [NTOS:IO] Remove last remnants of IoCreateDriverList() and IoDestroyDriverList()
These two functions were removed as part of the boot/system drivers
loading support rewrite in commit 959116f521 (r46693).
2026-03-22 15:39:54 +01:00
Timo Kreuzer
2d5371e078 [NTOSKRNL] Fix GCC 13 stringop-overflow warnings regarding KiNtVdmState
GCC 13 thinks that a global 'const PULONG' that is initialized to a non-NULL value points to an object that is "likely at address zero".
- Turn the macros that cause the issue into inline functions and wrap them with a GCC diagnostic pragma to silence the warning
- Use KiNtVdmState in vdm/vdmexec.c
- Remove the (duplicated) VdmState macro

In function '_InterlockedAnd',
    inlined from 'KiVdmOpcodePOPF' at C:/ReactOS/reactos/ntoskrnl/ke/i386/v86vdm.c:164:5:
C:/ReactOS/reactos/sdk/include/vcruntime/mingw32/intrin_x86.h:245:16: error: '__sync_fetch_and_and_4' writing 4 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  245 |         return __sync_fetch_and_and(value, mask);
      |                ^~~~~~~~~~~~~~~~~~~~
In function 'KiVdmOpcodePOPF':
cc1.exe: note: destination object is likely at address zero
2026-03-18 17:29:12 +02:00
Hermès Bélusca-Maïto
9833d3d8c8 [FREELDR][NTOS:INBV] Simplify headless-support initialization code
Also address few observations made by Serge Gautherie in PR #7885.
2026-03-16 18:42:57 +01:00
Hermès Bélusca-Maïto
50cb29ad4a [FREELDR][NTOS:INBV] SAL2-annotate headless-support functions 2026-03-16 16:49:53 +01:00
Hermès Bélusca-Maïto
d61f7e5cd0 [NTOS:PS] Implement Vista+ NtQueryInformationThread(ThreadHideFromDebugger) support (#8486)
https://ntquery.wordpress.com/2014/03/29/anti-debug-ntsetinformationthread/
indicates that starting Vista, `NtQueryInformationThread()` supports
querying the `ThreadHideFromDebugger` information.

This was noticed by contributor Mikhail Tyukin, while testing anti-cheat
protected NT6+ games written with Unity.

See also
https://ntdoc.m417z.com/threadinfoclass#threadhidefromdebugger-17
for the buffers descriptions.
2026-03-08 18:51:42 +01:00
Justin Miller
4cba65d760 [NTOS:ARM3] Change calculation for more system PTEs (#8613)
* [NTOSKRNL] Increase MI_NUMBER_SYSTEM_PTES for AMD64
* [NTOS:MM] Move the system PTE space on x86 to a different spot
* [KMTESTS] Adjust KmTest
2026-03-05 14:57:09 +00:00
Timo Kreuzer
6051564fcd [NTOS:PS] Fix some alignment values in PsProcessInfoClass[] 2026-01-28 12:59:20 +02:00
Hermès Bélusca-Maïto
d4ffcf81be [BOOTVID][NTOS:INBV] Improve SAL annotations for *BufferToScreenBlt() and *ScreenToBufferBlt() 2026-01-03 14:19:25 +01:00
Adam Słaboń
afbadf5c44 [NTOS:MM][KMTESTS] MmMapViewOfSection: Handle PAGE_NOCACHE and PAGE_WRITECOMBINE flags (#8502)
- Remove the hack for PAGE_NOCACHE flag that was introduced in commits aa52dc7498 (r68611) and 33d53d44da (r68612) for CORE-9808. The test case for PAGE_NOCACHE, introduced in 7346aece52 (r68351), did not expose any additional problems without it anymore.
- Allow a PAGE_WRITECOMBINE flag. Fixes a regression introduced in 59ae6b3e15 (CORE-20298) that caused the OpenGL ICD in Nvidia 78.05 driver to not use GPU hardware to accelerate OpenGL anymore (reported and tested by winterhell on Discord).
- Add a test case for MmMapViewOfSection with PAGE_WRITECOMBINE. The test passes on Windows 2003 SP2 and Vista RTM.
- Fix ASSERTs in MI_MAKE_HARDWARE_PTE functions.
2025-12-18 12:30:40 +03:00
George Bișoc
0f30e8163e [NTOS:PS] Annotate the Query/Set related functions with SAL2
- Annotate the functions in query.c file with SAL2 of which they weren't annotated before
- Use _Out_writes_bytes_to_opt_ to further clarify the output parameter is being written to it based on the length size provided.
This is so the code analyzer understands such a parameter is being written into only the specific amount of bytes.
2025-12-01 22:22:00 +01:00
Timo Kreuzer
60aad33ed0 [NTOS:PS] Fix test breakage after Hermès
Fixes test failures in ntdll_apitest NtQueryInformationThread and NtSetInformationThread
2025-12-01 08:39:22 +02:00
Hermès Bélusca-Maïto
17419ab4a2 [NDK][NTOS:PS] Add missing THREADINFOCLASS values 2025-11-28 22:08:42 +01:00
Serge Gautherie
f6346c6228 [NTOS:KE] Fix X86_FEATURE_MTTR typo (#8330)
"MTTR" should read: "MTRR".
2025-08-13 12:25:43 +02:00
Ratin Gao
49e652b7b7 [NTOS:PS] Implement ProcessImageFileNameWin32 information class 2025-07-17 18:18:47 +03:00
Timo Kreuzer
61b6cd9d28 [NTOS:KE] Implement KiGetTrapContextInternal 2025-07-10 14:57:09 +03:00
Timo Kreuzer
1a11aa059f [NTOS:MM] Fix section related test failures
Fixes all failures, except pointer counts.
2025-06-21 18:19:01 +00:00
Timo Kreuzer
d6874fe7b9 [NTOS:KE/x64] Implement KiSave/RestoreXState 2025-06-21 07:55:06 +00:00
Timo Kreuzer
72fbbdf854 [NTOS:KE/x64] Implement KiInitializeXStateConfiguration 2025-06-21 07:55:06 +00:00
Timo Kreuzer
946f17e93d [NTOS] Fix x64 definition of MMPFN
Adjust the definition of COLORED_LIST_HEAD to always match the new MI_PTE_FRAME_BITS define.
2025-05-04 07:28:41 +00:00
Hermès Bélusca-Maïto
a7d86fe3a7 [NTOS][RTL] Remove unused deprecated ReactOS-only DbgBreakPointNoBugCheck()
This helper was introduced in commit b041530f2d (r8551), and its
last remaining usage removed in commit f038f4a895 (r23636).
2025-04-19 20:01:06 +02:00
Timo Kreuzer
8851d86847 [NTOS:MM] Remove Vad pointer from MEMORY_AREA 2025-04-17 22:22:08 +00:00
Timo Kreuzer
d0a7e496aa [NTOS:MM] Mark RosMm memory areas
This is to distinguish them from ARM³ memory areas, which we use for some kernel regions, like paged pool.
2025-04-17 22:22:08 +00:00
Timo Kreuzer
42c7e4f66a [NTOS:MM] Add macros to determine whether a VAD is a MEMORY_AREA 2025-04-17 22:22:08 +00:00
Timo Kreuzer
d27f5971c5 [NTOS:MM] Add MmIsAddressRangeFree helper function
Use this instead of MmLocateMemoryAreaByRegion to determine whether we can inert a section at the requested base address. This will be required to get rid of fake memory areas allocated for each ARM³ VAD.
2025-04-17 22:22:08 +00:00
Timo Kreuzer
31a693a035 [NTOS:MM] Remove some obsolete declarations 2025-04-17 22:22:08 +00:00
Hermès Bélusca-Maïto
125f94d8ab [NTOS:EX] Check whether the boot-time drivers are safe to use on MP systems (#7744)
Invoke the MmVerifyImageIsOkForMpUse() helper. If the boot-time driver
only supports a uniprocessor system, bugcheck with UP_DRIVER_ON_MP_SYSTEM.

https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x92--up-driver-on-mp-system

Note that we don't do this check very soon at boot time (e.g. in
MiReloadBootLoadedDrivers or MiInitializeLoadedModuleList), but only
after loading the drivers' debug symbols (if any).
The reason is simply to ease debugging in case we bugcheck: this allows
having the debugger set up with the symbols for this driver.

For automatic and manual driver loading, MmVerifyImageIsOkForMpUse()
is invoked by MmCheckSystemImage() but in this case, there is graceful
failure and no bugcheck.
2025-04-04 13:05:22 +02:00
Hermès Bélusca-Maïto
3022d74beb [NTOS:EX/KE][HALX86] Add support for NUMPROC, BOOTPROC, MAXPROC, ONECPU boot switches (#6024)
These SMP-specific switches allow to test and control configurations
with various number of CPUs on multiprocessor systems.

- NUMPROC: maximum number of logical processors that can be started
  (including dynamically, not currently supported by ReactOS) at run-time.

- BOOTPROC: maximum number of logical processors that can be started at
  boot-time.

- MAXPROC: forces the OS to report the maximum possible number of CPUs
  as existing on the system.

- ONECPU (MP HAL-only boot switch): causes the HAL to only use one
  (the boot) CPU on a multiprocessor system. Attempting to start other
  processors will fail.

For more information, see:
https://www.geoffchappell.com/notes/windows/boot/bcd/osloader/numproc.htm
https://www.geoffchappell.com/notes/windows/license/processors.htm
https://rmscrypt.wordpress.com/2011/02/
https://codeinsecurity.wordpress.com/2022/04/07/cpu-socket-and-core-count-limits-in-windows-10-and-how-to-remove-them/

Generic references about BOOT.INI switches:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/boot-options-in-a-boot-ini-file
https://www.itprotoday.com/cloud-computing/what-switches-can-be-used-bootini
http://franck.kiechel.free.fr/dbr_eng/BootIni.htm

References about BCD options:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set
http://www.mistyprojects.co.uk/documents/BCDEdit/files/commands.6.1.7601.htm#TYPES%20OSLOADER
2025-04-04 12:51:49 +02:00
Timo Kreuzer
9292cad39a [NTOS:KE] Implement KiFindIdealProcessor 2025-03-24 21:33:48 +00:00
Hermès Bélusca-Maïto
f37138ce91 [NTOS:OB] Allow ObpCaseInsensitive to be configured via registry (#7751)
This feature can be controlled by the system policy:
"System objects: Require case insensitivity for non-Windows subsystems"
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/jj852277(v=ws.11)

It is also used in conjunction with NTFS to get system-wide filesystem case-sensitivity:
https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/929110

This is controlled with a REG_DWORD value named `ObCaseInsensitive`
inside the registry key
`HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Kernel` .

Object case (in)sensitivity check is done in the ObpLookupObjectName() helper.
The `ObpCaseInsensitive` variable is used to retrieve the data,
hence it needs to be a ULONG.
2025-03-11 19:15:02 +01:00
Hermès Bélusca-Maïto
c71845ee8c [NTOS:OB] ObpLookupEntryDirectory(): SearchShadow is a BOOLEAN 2025-03-11 19:12:36 +01:00
Ratin Gao
4d605ec26f [NTOS:MM:PS] Little fixes for NTDLL loading (#7707)
- [NTOS:PS] `STATUS_INVALID_IMAGE_PROTECT` returned by `MmCheckSystemImage` should be a fatal error too.
- [NTOS:PS] Fix object attributes for opening NTDLL.
- [NTOS:MM] Remove `MmCheckSystemImage` unused parameter.
- [NTOS:MM] Inline `MmVerifyImageIsOkForMpUse` in `MmCheckSystemImage`, reducing a call to `RtlImageNtHeader`.
2025-03-03 20:36:21 +01:00
Timo Kreuzer
9b002025d4 [NTOS:KE/x86] Detect more KeFeatureBits 2025-02-01 19:45:21 +02:00
Timo Kreuzer
be3dde7698 [NTOS] Make KeFeatureBits 64 bit 2025-02-01 19:45:21 +02:00
Hermès Bélusca-Maïto
5d78952024 [NTOS:KD64] Simplify some code in debugging helpers 2025-01-28 22:00:34 +01:00
Hermès Bélusca-Maïto
1c61d4ce90 [NTOS:KD64] Add annotations to debugger control routines used in Kd/Nt/ZwSystemDebugControl 2025-01-28 22:00:33 +01:00
Hervé Poussineau
d8e25f06b1 [NTOS:EX] Add prototypes for ExLockUserBuffer/ExUnlockUserBuffer 2025-01-28 22:00:29 +01: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
Vincent Franchomme
6ada5978d0 [NTOS:MM] Do not use PAGE_ROUND_DOWN for LONGLONG values (#7603)
PAGE_ROUND_DOWN macro seems to not work correctly with LONGLONG values. It creates some random freezes in the 1st-stage setup after commit 69bf140506.
It's fixed by creating PAGE_ROUND_UP_64 and PAGE_ROUND_DOWN_64 macros for 64-bit only data types.

---------

Co-authored-by: Thamatip Chitpong <thamatip.chitpong@reactos.org>
2025-01-16 10:30:38 +07:00
Hermès Bélusca-Maïto
e4748fe448 [NTOS:IO] IoVolumeDeviceToDosName(): Add SAL2 annotations, fix pool tag (#6989)
The DEV2DOS tag value is from the official Windows pooltag.txt file.
2025-01-05 22:06:59 +01:00
Hermès Bélusca-Maïto
7a05b393c5 [NTOS:IO] TAG_KINTERRUPT -> TAG_IO_INTERRUPT and change its value.
Change its value, as per the official Windows pooltag.txt file.
2025-01-05 21:16:56 +01:00
Hermès Bélusca-Maïto
02cff5abc1 [NTOS:IO] tag.h: Remove duplicated TAG_SYSB/TAG_SYS_BUF and rename it to TAG_IOBUF 2025-01-05 21:09:08 +01:00
Hermès Bélusca-Maïto
a18424267b [NTOS:CM] Add some more configuration options.
Add support for configuring the CM lazy-flush and delay-close variables:

  `CmpLazyFlushIntervalInSeconds`, `CmpLazyFlushHiveCount`,
  and `CmpDelayedCloseSize`,

using REG_DWORD values named respectively:

  `RegistryLazyFlushInterval`, `RegistryLazyFlushHiveCount`,
  and `DelayCloseSize`,

in the registry key
`HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager` .

Extra observations:
- While delay-close support exists in Windows 2003, configuring
  the delay-close size is possible only in Windows Vista and later.
- The possibility of configuring the lazy-flush hive count has been
  removed in Windows 8+.

See the comparison tables at:
https://redplait.blogspot.com/2011/07/cmcontrolvector.html
https://redplait.blogspot.com/2012/06/cmcontrolvector-for-w8.html
https://redplait.blogspot.com/2016/03/cmcontrolvector-from-windows-10-build.html

In addition:
Remove `CmpDelayedCloseIndex` from cm.h as it is not used anymore in our code.
2024-12-19 11:52:13 +01:00
Thamatip Chitpong
1e06829961 [NTOS:PS] Add query support for QUOTA_LIMITS_EX 2024-12-18 09:53:21 +07:00
Timo Kreuzer
5ebd478325 [NTOS][HAL:APIC] Call HalBegin/EndSystemInterrupt from clock handler 2024-12-16 16:21:44 +02:00