Commit graph

1298 commits

Author SHA1 Message Date
Stanislav Motylkov 77fd33c99c
[NTOS:CM] Refactor full CPU identifier values
Dedicated to Victor Perevertkin.
2022-01-05 18:28:40 +03:00
Stanislav Motylkov 84cc81ee29
[NTOS:KE/x64] Detect CPU vendor properly and store value in PRCB
Also generate processor identifier properly based on this value
on the Configuration Manager machine-dependent initialization.

Update processor driver INF file accordingly.

CORE-17970 CORE-14922
2022-01-05 18:28:40 +03:00
Thomas Faber a4b2c80853
[NTOS:KE] Fix buffer overflow when displaying x64 bug checks 2022-01-03 13:25:09 -05:00
Hermès Bélusca-Maïto 10a976e78f
🎊 🍾 🥳 Happy New Year 2022 to the ReactOS Community! 🎆 ⚛️ ☢️
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:
 __,  ,__)            __,  ,__)       __, ,__)        ░▄████▄░▄███▄░▄████▄░▄████▄░
(--|__| _ ,_ ,_      (--|\ | _       (--\ | _  _ ,_   ░▀▀░▄██░██░██░▀▀░▄██░▀▀░▄██░
  _|  |(_||_)|_)(_|    _| \|(/_(_|_)     \|(/_(_||    ░░▄██▀░░██░██░░▄██▀░░░▄██▀░░
 (        |  |  ,_|   (                (__|           ░██████░▀███▀░██████░██████░
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:
2022-01-01 00:00:00 +01:00
Stanislav Motylkov f18fb7da09
[NTOS:MM] Unrefernece some dereferences 2021-12-30 01:54:09 +03:00
Victor Perevertkin fd9436d768
[NTOS:PNP] Remove excessive error messages 2021-12-28 04:23:51 +03:00
George Bișoc 3bc2d590a1
[NTOSKRNL] Regroup the pool allocation tags in one dedicated place
We have a special file, tag.h, which serves as a place to store whatever kernel pool allocation tag yet we still have some tags sparse over the kernel code... So just re-group them in one unique place.
2021-12-27 18:57:03 +01:00
Hervé Poussineau 0358fcf9e4 [NTOS:PNP] Let pnproot only report already detected devices
Ignore devices which have DeviceReported=1 in instance key
and not DeviceReported=1 in Control key.

CORE-17874
2021-12-16 16:14:21 +01:00
Hervé Poussineau d380e9777c [NTOS:PNP] Set DeviceReported=1 in Instance key and Control key of legacy devices at report time
CORE-17874
2021-12-16 16:14:21 +01:00
Eric Kohl 990ba54537 [NTOS:LPC] NtReplyWaitReceivePortEx returns the correct TotalLength for connect messages
This fixes the NtAcceptConnectPort apitest.
2021-11-24 18:59:16 +01:00
Eric Kohl 07e19a5e09 [NTOS:IO] Fail, if io completion port and an apc routine are used at the same time
Add checks to NtNotifyChangeDirectoryFile, NtLockFile, NtReadFile and NtWriteFile.
This fixes two ntdll tests.
2021-11-24 13:34:26 +01:00
Thomas Faber 88e3ef5fa0
[NTOS:SE] Don't assert on levels that don't allow impersonation. 2021-11-21 17:19:03 -05:00
Eric Kohl 3e5dcf7937 [NTOS:EX] Fix version specific return value for NtSetSystemInformation:SystemFlagsInformation 2021-11-21 21:42:04 +01:00
Thomas Faber d84022d7fd
[NTOS:SE] Fix always-true assert in SeTokenCanImpersonate.
Courtesy of VS analysis warning C6289:
Incorrect operator:  mutual exclusion over || is always a non-zero constant.  Did you intend to use && instead?
2021-11-21 12:57:50 -05:00
Thomas Faber 0af3689c2e
[REACTOS] Fix traces with missing arguments.
Courtesy of VS Code Analysis warning C6064:
Missing integer argument to 'DbgPrint' that corresponds to conversion specifier 'N'.
2021-11-21 12:57:35 -05:00
Thomas Faber a7b2703479
[NTOS] Fix broken SAL annotations on MmDereferenceSegmentWithLock. 2021-11-21 12:47:46 -05:00
Thomas Faber 2e76fb9fe1
[NTOS:IO] Use a guarded region in IopQueueIrpToThread.
We're protecting against IopCompleteRequest, which is a special
kernel APC. So this is a little bit faster than raising the IRQL.
2021-11-20 14:58:51 -05:00
Hermès Bélusca-Maïto 712f469671
[NTOS:EX] Clarify the situation with the SystemPathInformation class. (#4065)
Since NT 3.51, this information class is trivially implemented.
The path to the NT directory is now stored in KUSER_SHARED_DATA
as the NtSystemRoot member.
Windows Checked builds show the following message and break to
the debugger before failing the function as not implemented:

EX: SystemPathInformation now available via SharedUserData

See https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/sysinfo/query.htm
and https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/ntexapi_x/kuser_shared_data/index.htm
for more information.
2021-11-18 22:37:54 +01:00
Hermès Bélusca-Maïto 1200561fcc
[NTOS:EX] NtQuerySystemInformation: Use same parameter names as documentation. FStatus --> Status. (#4064) 2021-11-18 22:36:07 +01:00
Hermès Bélusca-Maïto d484a68ccb
[NDK][NTOS:EX] Add/fix SAL annotations for Nt/ZwSetSystemInformation + last parameter type. (#4064) 2021-11-18 22:36:07 +01:00
Hermès Bélusca-Maïto 7692a620e7
[NDK][NTOS:EX] Minor formatting. 2021-11-18 22:36:06 +01:00
George Bișoc f909e8762d
[NTOS:SE] Validate the SID lengths when capturing them
SIDs are variadic by nature which means their lengths can vary in a given amount of time and certain factors that allow for this happen. This also especially can lead to issues when capturing SIDs and attributes because SeCaptureSidAndAttributesArray might end up overwriting the buffer during the time it's been called.

Therefore when we're copying the SIDs, validate their lengths. In addition to that, update the documentation header accordingly and add some debug prints in code.
2021-11-16 10:55:44 +01:00
Thomas Faber e8b79e89eb
[NTOS:PS] Fix copypasta in NtQueryInformationJobObject. CID 1441354 2021-11-13 21:23:40 -05:00
Thomas Faber 34f2b7830d
[NTOS:IO] Correctly deal with exceptions when handling FileFsDriverPathInformation. CID 1476847 2021-11-13 21:23:39 -05:00
Thomas Faber a74ff5be17
[NTOS:IO] Don't call IopCompleteRequest with uninitialized context values. CID 716761
NormalContext and NormalRoutine are just for good measure, but
SystemArgument2 is actually used by the function.
And yes, this appears to be a bug in Win 2003.
2021-11-13 21:23:39 -05:00
Thomas Faber 8254585be5
[NTOS:EX] Assert some AcquireResource return values. CID 1321882 2021-11-13 21:23:39 -05:00
Thomas Faber aa9a098196
[NTOS:EX] Correctly handle OOM in NtFindAtom. CID 1237072 2021-11-13 21:23:36 -05:00
George Bișoc 53db5377e2
[NTOS:SE] Implement token filtering
This implements the support of token filtering within the kernel, where the kernel can create restricted tokens of regular ones on demand by the caller. The implementation can be accessed thorough a NT syscall, NtFilterToken, and a kernel mode routine, SeFilterToken.
2021-11-07 14:14:18 +01:00
George Bișoc 05d52aba2b
[NTOS:SE] Partially revert 0129de2
The continue statements do not server any useful purpose in these loops so they're basically pointless. These have been introduced by mistake so my bad.
2021-11-05 10:13:45 +01:00
Serge Gautherie 8110a66b08 [NTOS:MM] MI_IS_*(): Improve documentation
Intel 64 and IA-32 Architectures Software Developer’s Manual
version 075 (June 2021)
2021-11-04 23:20:21 +03:00
Serge Gautherie 94b8095ba2 [NTOS:KE] KiTrap0EHandler(): Use MI_IS_WRITE_ACCESS() 2021-11-04 23:20:21 +03:00
George Bișoc 0129de218b
[NTOS:SE] Mark the token as no longer belonging to admin group upon effective duplication
A scenario where it happens that an access token belongs to an administrators group but it's disabled (that is, SeAliasAdminsSid has no attributes or it doesn't have SE_GROUP_ENABLED turn ON), the function removes this group from the token but still has TOKEN_HAS_ADMIN_GROUP flag which can lead to erratic behavior across the kernel and security modules -- implying that the token still belongs to administrators group.

This is an oversight from my part.
2021-11-04 09:30:00 +01:00
Hervé Poussineau 22d1e7a4e4 [NTOS:IO] Create non volatile registry keys for root devices (as for other devices) 2021-11-01 18:16:25 +01:00
Hervé Poussineau 9967d9aa4c [NTOS:IO] Do not crash when calling IopLegacyResourceAllocation with NULL ResourceRequirements 2021-11-01 18:16:25 +01:00
George Bișoc fdb4205061
[NTOS:SE] Minor cleanup on SepDuplicateToken
The current code that searches for the primary group of token upon duplication is OK as is, remove whatever rest that's no longer needed.
2021-10-23 17:55:12 +02:00
Hervé Poussineau 46fbc6f432 [NTOS:PNP] Fix crash when removing a device without resources
This fixes commit 89fd2b86e4
2021-10-18 22:23:49 +02:00
Hervé Poussineau 89fd2b86e4 [NTOS:PNP] HACK: release resources when device is removed
CORE-17789
2021-10-14 23:39:31 +02:00
Hervé Poussineau 49358f3416 [NTOS:PNP] Fix resource conflict detection
Only resources of HAL were checked against conflicts, not those of PnP Manager

Let IoReportResourceForDetection() make a silent conflict check.
Otherwise IopCheckResourceDescriptor() will always return 'no conflict'.

CORE-17789
2021-10-14 23:39:31 +02:00
Hervé Poussineau a86c3794a6 [NTOS:IO] Remove final NULL char of PDO name before writing to registry
Otherwise, if a PDO has no name (bad!), you'll see two "(Default)" entries
in HKLM\HARDWARE\RESOURCEMAP\PnP Manager\PnpManager
2021-10-14 23:39:30 +02:00
Victor Perevertkin 43f1d91687
[NTOS:PNP] Fix resource conflict detection
Previous code did not detect equal resource ranges as conflicting.
Thanks Hervé Poussineau for pointing this out!

Meanwhile, simplify the code to make it more readable.
2021-10-13 00:00:25 +03:00
Rafał Mikrut 54d5ad7533
[NTOS:KE] Fix copy paste bug in exception helper routine for ARM (#4005) 2021-10-07 23:04:19 +03:00
George Bișoc 9c1c88de3e
[NTOS:SE] Define a name macro for the threshold value
Instead of having this magic value as is, describe it within a macro for readability purposes.
2021-09-27 09:39:23 +02:00
George Bișoc 199f575342
[NTOS:SE] Check the privilege count against the maximum threshold
In SeCaptureLuidAndAttributesArray we must ensure that we don't go onto a potential integer overflow scenario by checking against the maximum limit threshold the kernel states. In addition, write an explicit name macro for the value.
2021-09-27 09:37:28 +02:00
Hermès Bélusca-Maïto 9462350a92
[NTOS:RAWFS] LE JOKE! - Commit 7716bddd (r24564) claimed to "actually create the \\Device names so that user-mode can even talk to it", yet didn't bother to do that!
Certainly due to copy-pasta error from the original code.

A consequence of this oversight, was that the IoGetDeviceObjectPointer()
calls on these device names, in fltmgr!DriverEntry() couldn't work.
(See drivers/filters/fltmgr/Interface.c, line 1880 and below.)
2021-09-26 03:02:58 +02:00
Hermès Bélusca-Maïto 5ccd45ea58
[NTOS:RAWFS] Delete the previously-created devices in case the IoCreateDevice() calls fail. 2021-09-26 03:02:57 +02:00
Hermès Bélusca-Maïto 74513a75ab
[NTOS:OB] Minor refactoring.
- NtQuerySymbolicLinkObject(): Use an intermediate variable for the object header.
- Simplify code in ObpLookupEntryDirectory() by calling ObpReleaseLookupContextObject() instead.
- Use TAG_OBJECT_TYPE instead of hardcoded tag values.
2021-09-25 01:09:01 +02:00
Hermès Bélusca-Maïto 4c63ed5a7a
[NTOS:OB] Clarify and fix the usage of the Obp*DirectoryLock*() and ObpReleaseLookupContextObject() functions.
- Disentangle the usage of ObpAcquireDirectoryLockExclusive() when it's
  used only for accessing a directory structure, or as part of a lookup
  operation.

  The Obp*DirectoryLock*() -- both shared and exclusive -- functions
  are only for locking an OB directory, for reading or writing its
  structure members.

  When performing lookup operations (insertions/deletions of entries
  within a directory), use a ObpAcquireLookupContextLock() function that
  exclusively locks the directory and saves extra lock state, that can
  be used by ObpReleaseLookupContextObject() for cleanup.

- Add documentation for these functions.
2021-09-25 00:47:43 +02:00
George Bișoc 19cdb521d2
[NTOS:OB] Acquire the lock before setting directory's session ID 2021-09-24 19:49:40 +02:00
George Bișoc 0b4763f1b1
[NTOS:SE] Do not set SE_DACL_PRESENT flag that early
The function might assign the flag yet it could possibly fail on creating a DACL and insert an "access allowed" right to the access entry within the DACL. In this case, make sure we actually succeeded on all the tasks and THEN assign the flag that the DACL is truly present.

Also, make sure that the Current buffer size variable gets its new size so that we avoid overidding the memory of the DACL if the security descriptor wants both a DACL and SACL and so that happens that the DACL memory gets overwritten by the SACL.
2021-09-24 19:39:30 +02:00
George Bișoc f341b9080b
[NTOS:SE] Set the SACL to the World security descriptor
Implement the portion chunk of code that is responsible for setting the system access control list (SACL) to the World security descriptor, based from SeWorldSid (World security identifier).
2021-09-24 19:13:16 +02:00