Commit graph

605 commits

Author SHA1 Message Date
Serge Gautherie e413df4f4e [NTOS:MM] i386: Fix '_MI_NO_EXECUTE' typo
Addendum to 65dbfc2868.
2019-09-30 10:46:58 +03:00
Pierre Schweitzer 3b78ca210e
[NTOSKRNL] Simplify buffer definition in MiQueryMemorySectionName().
Also take into account the UNICODE_STRING structure while computing whole size
This is based on Thomas' patch.

CORE-12043
2019-09-29 14:16:44 +02:00
Pierre Schweitzer 96ee4509e5
[NTOSKRNL] Implement NtQuerySystemInformation(SystemLogicalProcessorInformation) 2019-09-27 20:36:59 +02:00
Thomas Faber 934484ea3e
[NTOS:PNP] When traversing the device tree, keep a reference to the current device. CORE-15874 2019-09-26 10:26:10 +02:00
Serge Gautherie 0339245859 [NTOS:KE] Fix 'Sert' typo, in a comment (#1929) 2019-09-23 01:13:07 +02:00
Timo Kreuzer 41250d1028 [NTOS:MM] Fix MmspCompareSegments
On x64 the previous implementation would only compare the upper 32 bits and ignore the lower 32 bits.
2019-09-01 14:15:07 +02:00
Eric Kohl 0b129da05c [NTOSKRNL] Fix indentation. No code changes! 2019-08-24 10:02:55 +02:00
Mark Jansen 1539fb1414
[NTOSKRNL] Demote some noisy dprints 2019-08-23 13:03:36 +02:00
Yaroslav Kibysh 238ea69ca0 [NTOS:INBV] Refactor boot screen code and resources (#1649)
* [NTOS:INBV] Move typedefs to the only single file where they are used.

* [NTOS:INBV] Refactor code & resources

Remove garbage

* [NTOS:INBV] Reduce fade time and remove wait for animation.
2019-08-20 01:52:25 +02:00
Pierre Schweitzer e12abf63c5
[NTOSKRNL] Handle symlink parsing when it's bound to a specific object 2019-08-19 10:45:50 +02:00
Serge Gautherie 87a625bd6c [NTOS:IO] iomgr.c: Add a missing '#if defined(KDBG)' 2019-08-17 17:36:49 +02:00
Serge Gautherie 66bf74d228 [NTOSKRNL] Move DPRINT1("Thread wants too much stack\n") around
To KiUserModeCallout() from MmGrowKernelStackEx().

As suggested by Thomas Faber:
"MmGrowKernelStackEx really shouldn't be DPRINT'ing."

CORE-14494
2019-08-15 18:18:59 +02:00
Timo Kreuzer de679e8f33 [NTOS:MM] MmSizeOfSystemCacheInPages is ULONG_PTR, not ULONG
Fixes failed assertion on x64.
2019-08-15 18:04:57 +02:00
Timo Kreuzer adcae016c5 [NTOS:KE:I386] Fix parameter description for KiSwapContext 2019-08-15 18:04:57 +02:00
Timo Kreuzer 98a8e8f862 [NTOS:IO] In IopSynchronousCall first check IrpStack->MajorFunction before checking minor
Minor function indices are not unique, they are subfunctions, so without first checking the major function, they are ambiguous.
2019-08-15 18:04:57 +02:00
Timo Kreuzer fffe4f6385 [NTOS:EX] Use InterlockedExchangeAdd64 instead of InterlockedCompareExchange64 loop in ExAllocateLocallyUniqueId 2019-08-15 18:04:57 +02:00
Timo Kreuzer e50873376d [NTOS:IO] Improve an alignment 2019-08-15 18:04:57 +02:00
Timo Kreuzer 7611cc2b12 [REACTOS] Fix SIZE_T related warnings 2019-08-15 14:20:00 +02:00
Andrew Boyarshin b607e0119f [NTOSKRNL][PS] Implement NtQueueApcThreadEx and use it in NtQueueApcThread
Actually rename NtQueueApcThread to NtQueueApcThreadEx and ignore one additional parameter for now.
2019-08-15 12:32:09 +02:00
Eric Kohl 4614c5b57c [NTOSKRNL] Implement SeRegisterLogonSessionTerminatedRoutine() and SeUnregisterLogonSessionTerminatedRoutine(). 2019-08-04 14:01:26 +02:00
Timo Kreuzer 3af7cb825f [NTOSKRNL] Replace overlapping strcopy with memmove
Fixes 4 GCC 8 warnings of the kind:
ntoskrnl/kdbg/kdb_cli.c:3015:21: error: 'strcpy' accessing 1 byte at offsets 0 and [0, 2147483647] may overlap 1 byte at offset 0 [-Werror=restrict]
                     strcpy(p2, p2 + j);
                     ^~~~~~~~~~~~~~~~~~
2019-07-20 13:56:18 +02:00
Hermès Bélusca-Maïto e2d6f61085
[NTOS:INBV] Fix the bitmaps' palette and recompress them in RLE. (#1649)
They don't need to have a zeroed-out palette now that we can
automatically reset it from within the code.

Co-authored-by: Yaroslav Kibysh <yanet.prod@gmail.com>
2019-07-14 22:23:52 +02:00
Hermès Bélusca-Maïto 64a53b304e
[NTOS:INBV] Express some coordinates in terms of screen size. (#1649) 2019-07-14 22:23:51 +02:00
Yaroslav Kibysh dc2eb409c1
[NTOS:INBV] Implement BitBltPalette() and BitBltAligned() and use them for aligning bitmaps. (#1649)
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2019-07-14 22:23:50 +02:00
Hermès Bélusca-Maïto 3625238ecb
[NTOS:MM] Add a MmChangeKernelResourceSectionProtection() helper. (#1649)
This allows setting the memory protection of the kernel's resource
section as will. MmMakeKernelResourceSectionWritable() is re-implemented
around this helper.
2019-07-14 22:23:49 +02:00
Hermès Bélusca-Maïto a3e22b99a4
[NTOS:INBV] Classify the bitmap resources. (#1649)
See "How to change Windows XP boot logo" at
http://www.reversing.be/article.php?story=20061209171938444
as well as the "Boot Editor for WinXP" program for more details.
2019-07-14 22:23:48 +02:00
Serge Gautherie ccf8bff3ec [NTOS:MM] Fix MmGetFileNameForAddress() callers. (#1723)
MmGetFileNameForAddress() calls RtlCreateUnicodeString().
This also fixes a leak in MiQueryMemorySectionName().
2019-07-14 00:32:23 +02:00
Thomas Faber 2d419e90f9
[NTOS:PNP] Reduce the default buffer size in EnumerateDevices. CORE-15882 2019-07-10 10:58:47 +02:00
Thomas Faber b8e091a44c
[NTOS:PNP] Handle arbitrary subkey name lengths in EnumerateDevices. CORE-15882
This also makes it necessary to fix a bug in the previous code:
ZwEnumerateKey will not account for space for a null terminator, so to
ensure we have space, we must allocate the additional WCHAR, but not
include it in the buffer size passed to the function.
2019-07-10 10:58:45 +02:00
Thomas Faber 36e9a6f8dd
[CMAKE] Disable INIT section ld scripts for now. CORE-16183 ROSBE-154 2019-07-07 16:06:43 +02:00
Thomas Faber c4d8e2a6e9
[CMAKE] Ensure the INIT section is placed at the end of a module. CORE-14683
For MSVC, marking the section as discardable will do this automatically.
For GCC, we use a linker script that places it after the .reloc section
(which should be the last "real" section, check ld --verbose output for the
default linker script).

This fixes what seems to be a regression from r55835 (!).
2019-07-07 08:18:10 +02:00
Serge Gautherie 6ba611f39e [NTOS:MM] Fix MmSizeOfSystemCacheInPages value on AMD64
And add 'ASSERT(MmSystemCacheEnd == ...);'.

Addendum to d56a249089.
CORE-14259
2019-07-06 09:55:38 +02:00
Serge Gautherie a0d2170729 [NTOS:CC] CcWriteVirtualAddress(): Do not round 'Size'
Revert 'Properly align VACB writes' part of 2a80ae2bb6.

CORE-15384 CORE-16018
2019-07-01 21:30:25 +02:00
Pierre Schweitzer 4fd223729b [NTOSKRNL] When looping again in ObpLookupEntryDirectory, properly init root entry
This fixes looking in global directory for DOS drives that are globally mounted
(such as C: drive)

CORE-16114
2019-06-30 23:07:54 +02:00
Pierre Schweitzer f13b6e025f [NTOSKRNL] Implement support for device maps in ObpLookupObjectName
This allows getting rid of the ?? hack in the kernel but this doesn't
allow enabling LUID device maps as ReactOS can no longer open a
session with them enabled. So, we must remain with device maps at
root

CORE-16114
2019-06-30 23:07:54 +02:00
Hermès Bélusca-Maïto 05616105a5
[NTOS:MM] Fix MiLocateKernelSections() and MmMakeKernelResourceSectionWritable().
- MiLocateKernelSections(): Fix the calculation of MiKernelResourceEndPte,
  MmPoolCodeEnd and MmPteCodeEnd.

- MmMakeKernelResourceSectionWritable(): Fix PTE looping upper limit;
  use MI_MAKE_HARDWARE_PTE_KERNEL to build the updated read-write PTE.
2019-06-26 00:57:53 +02:00
Hermès Bélusca-Maïto f694d12f0c
[NTOS:KE/MM] Some bug-fixes in the bugcheck code.
- Introduce the MmMakeKernelResourceSectionWritable() helper for
  making the kernel resource memory section writable, and use it
  in KeGetBugMessageText(). Indeed, this latter function patches
  in place the bugcheck resource message to trim any trailing
  newlines before displaying the message on screen.

  See also https://github.com/osresearch/uxen/blob/83bad53/dm/introspection-win7.c#L286
  that mentions it too.

  This fixes bugcheck text display (e.g. the MANUALLY_INITIATED_CRASH one)
  when using (at least) MSVC-built ReactOS, avoiding a Page-Fault
  exception during the bugcheck.

- Cover KeGetBugMessageText() in SEH since we are accessing kernel
  resources that could also be corrupted in bugcheck scenarii, and we
  don't want to further bugcheck.

- Fix newline trimming loop.

- KiDoBugCheckCallbacks():
  * Wrap the bugcheck CallbackRoutine call in SEH.
  * Add a FIXME concerning the need of further memory validation of CurrentRecord.

- Add a FIXME concerning the need to run the bugcheck-reason callbacks
  with the KbCallbackReserved1 reason, in KeBugCheckWithTf().
  Mentioned in http://blog.ptsecurity.com/2012/06/customizing-blue-screen-of-death.html
2019-06-25 21:01:49 +02:00
Hermès Bélusca-Maïto 35f800c6e2
[NTOS] Minor formatting enhancements only + typo fixes. 2019-06-25 21:01:48 +02:00
Bișoc George 42ce8519b6 [FASTFAT][FLTMGR][NTOS] Do not explicitly call ObfDereferenceObject() (#1636)
"Most code should not directly call the platform-specific ObfDereferenceObject() function but use the ObDereferenceObject() macro instead."

CORE-16081
2019-06-22 16:20:58 +02:00
Hermès Bélusca-Maïto 4d5a2dd0f3
[NTOS:KE] Use multi-processor-aware KeGetPcr() instead of the legacy PCR. 2019-06-20 19:39:49 +02:00
Hermès Bélusca-Maïto 04906f2abb
[NTOS:KE] Fixup for the NMI task handler: handle NMI recursion. -- Code was lost in commit 2efed8ef (r45040). 2019-06-20 19:39:44 +02:00
Hermès Bélusca-Maïto 3c8f19eb21
[NTOS:KE] Improvements for the Trap02 (NMI) and Trap08 (double-fault) exception handlers.
- Add FRAME_TSS FPO debug information for Trap02 and Trap08.
- Switch the active TSS in Trap08 in the very same way as is done in Trap02.

This allows to correctly debug NMI and double-fault exceptions with WinDbg,
by following the different TSS contexts, as described in:
https://blogs.msdn.microsoft.com/debuggingtoolbox/2008/02/22/special-command-analyzing-and-reconstructing-the-stack-using-the-k-command-and-its-variations/
https://blogs.msdn.microsoft.com/ntdebugging/2009/11/25/part-1-got-stack-no-we-ran-out-of-kernel-mode-stack-and-kv-wont-tell-me-why/
http://www.osronline.com/article.cfm?article=254 and http://www.osronline.com/article.cfm?article=328
2019-06-20 19:38:56 +02:00
Hermès Bélusca-Maïto d15e36a1f1
[NTOS:KE][SDK:ASM] Code formatting/styling only.
- Un-hardcode the RPL_MASK value.
- s/KiUnexpectedInterrupt&Number/KiUnexpectedInterrupt&Vector/
- Use C-style comments in traphdlr.c as everywhere else in the file.
- Update the URLs for the MSDN "FPO" macro documentation.
2019-06-20 18:07:59 +02:00
Eric Kohl 6866c0aede [NTOSKRNL][USETUP][UMPNPMGR] Pass user response data to NtPlugPlayControl(PlugPlayControlUserResponse).
- Windows requires 16 bytes of response data.
- Add the PLUGPLAY_CONTROL_USER_RESPONSE_DATA type.
- Usetup and Umpnpmgr must fail if NtPlugPlayControl(PlugPlayControlUserResponse) does not return STATUS_SUCCESS.
2019-06-12 13:48:27 +02:00
Hermès Bélusca-Maïto 9060b0cb7a
Fix build (forgot a comma ;) 2019-06-11 22:36:10 +02:00
Hermès Bélusca-Maïto 41e7c818d1
[NTOS] IoSetHardErrorOrVerifyDevice(): Check whether the IRP is not associated with any thread. 2019-06-11 22:29:34 +02:00
Pierre Schweitzer f6eb13a969
[NTOSKRNL] Rework ObpDeleteSymbolicLinkName and ObpCreateSymbolicLinkName
So that they handle LUID mappings and process device maps.

Get rid of the ObpParseSymbolicLinkToIoDeviceObject helper and introduce a
new helper ObpProcessDosDeviceSymbolicLink that will do the same things
but also handle name creation/deletion as well as device map handling.
All this is based on previous code (hence the same comments :-)).

What's left to do now is to add support for device maps in ObpLookupObjectName
2019-06-11 21:21:52 +02:00
Pierre Schweitzer 33604e0147
[NTOSKRNL] Fix ObpLUIDDeviceMapsEnabled initialization 2019-06-10 21:17:21 +02:00
Pierre Schweitzer 651ba03c6d
[NTOSKRNL] Taggify some allocs 2019-06-10 14:54:55 +02:00
Pierre Schweitzer a5daa8894d
[NTOSKRNL] Implement SepCleanupLUIDDeviceMapDirectory
This will clean up all the links (drive letters) created
by an user on session deletion once LUID device maps are
in use
2019-06-10 14:49:50 +02:00