Commit graph

161 commits

Author SHA1 Message Date
Jérôme Gardou 1c528cbf84 Revert "[NTOS/MM]
- Fix PFNs tracing
     - Add private pages to the process working set"

This reverts commit 4c5351bf55.
Not ready for prime time
2020-10-20 15:56:21 +02:00
Jérôme Gardou 4c5351bf55 [NTOS/MM]
- Fix PFNs tracing
 - Add private pages to the process working set
2020-10-20 15:20:59 +02:00
Serge Gautherie 90a6086f17
[NTOSKRNL] include/config.h: Sync it to current code (#3263)
* SERIALIZE_DBGPRINT: Removed on c15e04c (r18078).
* ENABLE_VALIDATE_POOL: Removed on 5899e14 (r42249).
* TAG_STATISTICS_TRACKING: Removed on 5899e14 (r42249).
* POOL_DEBUG_APIS: Removed on 5899e14 (r42249).
* R_RZ: Removed on 7d21cf7 (r48999).
* R_STACK: Removed on 7d21cf7 (r48999).
* WHOLE_PAGE_ALLOCATIONS: Removed on b431563 (r17306).
+
* _GLOBAL_PAGES_ARE_AWESOME_: Move it here.
2020-10-17 18:09:11 +02:00
Serge Gautherie 7790670dd8 [NTOS:EX] ExUuidCreate(): Correctly fill Uuid->Data4
ROSTESTS-359

Co-authored-by: Nguyen Trung Khanh <nguyentrungkhanh97@gmail.com>
2020-10-17 15:00:19 +02:00
Victor Perevertkin f7c58468f1
[XDK] Move UNREACHABLE macro definition to ntbasedef.h 2020-09-24 05:35:43 +03:00
Timo Kreuzer cb22d5f697 [NTOS:PS] On x64 don't fail in NtSetInformationProcess with ProcessUserModeIOPL information class, instead just don't do anything.
For NT6+ appcompat setting return STATUS_NOT_IMPLEMENTED
2020-09-20 23:08:17 +02:00
Timo Kreuzer 26484eea9f [NTOS:MM] Fix MiSubsectionPteToSubsection 2020-09-20 23:08:17 +02:00
Victor Perevertkin acd07e725e
[NTOS:IO] Do device reset inside the PipDeviceActionWorker
This make the operation synchonized with the other device tree actions

CORE-10456 CORE-17150
2020-08-21 08:20:59 +03:00
Victor Perevertkin 2839c85092
[NTOS:IO] Enumerate devices only inside the PipDeviceActionWorker
Introduce the PiPerformSyncDeviceAction routine for queuing
synchronous device actions
Change all kernel code to use PiPerformSyncDeviceAction and
PiQueueDeviceAction for device enumeration

CORE-10456
2020-08-21 08:02:26 +03:00
Victor Perevertkin 2ed132e90e
[NTOS:IO] change DEVICE_ACTION values and rename functions 2020-08-21 07:48:56 +03:00
Serge Gautherie a3669fdef7
[NTOS:KD64] Fix 'MAX_KD_COMPONENT_TABLE_ENTRIES' value (#2992)
Addendum to ceb58c8.
2020-07-18 19:42:30 +02:00
Hermès Bélusca-Maïto ceb58c821a [NTOS][SDK] Add new kernel debug filters that have been added in Win8 and Win10; they can be useful for us. 2020-07-18 17:45:40 +02:00
Victor Perevertkin b5815efe83
[NTOS:IO] Move device node functions from pnpmgr/pnpmgr.c to pnpmgr/devnode.c
Add SAL2 annotations to functions while moving
Convert IopCreateDeviceNode description to a Doxygen format
2020-06-21 09:39:13 +03:00
Thomas Faber 4f49a9c792
[NTOS:KE] Save ExceptionList in the assembly version of KiEnterTrap. CORE-15723
If SEH is used in a C trap handler, the exception frame will be
registered before the call to KiEnterTrap, which means we save
the wrong trap handler. We'll therefore also restore this wrong
frame for the excepting code, resulting in a stale SEH chain.

We avoid this problem by saving the handler in the assembly
trap entry code instead of from C. While SEH in a C trap handler
should now theoretically be safe, we still forbid it through
asserts in the C KiEnterTrap variants to make any potential
future problems more obvious. Should this functionality be
needed at some point and deemed safe, these asserts can then be
removed.
2020-06-06 08:44:30 +02:00
Thomas Faber 60346a5732
[NTOS] Prohibit use of MAX_PATH in the kernel. Use MAX_WIN32_PATH if you really mean it. CORE-15882 2020-05-17 21:30:08 +02:00
Timo Kreuzer b82bf8ce16
[NTOS:IO] Fix parsing of resource lists
Also add a hack to avoid failing on now occurring resource conflict detection and try to fix at least one resource in ACPI hal.

CORE-10146
CORE-12892
2020-04-24 13:58:09 +03:00
Hervé Poussineau 033102fdb1 [NTOS] Add a #define __ROS_ROSSYM__ when using rossym
Use it where needed.
2020-04-09 23:00:57 +02:00
Vadim Galyant 374f2b4d98
[NTOS][SDK:LIB] Add a Resources Arbiter library, to be used by bus drivers (acpi, pci), kernel and legacy hal (PIC HAL). (#2471) 2020-04-09 19:41:11 +02:00
Dmitry Borisov 1610367fe2
[BOOTVID][NTOSKRNL][HALX86] Move hardcoded coordinates of bootvid into one place. (#2504)
Co-Authored-By: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2020-04-09 15:17:48 +02:00
Vadim Galyant ac843d7b82
[NTOS:MM] Make the definitions and macros for x86 more human-readable. (#2487)
- Move also PDE_MAPPED_VA definition from common miarm.h to ..arch/mm.h.
- Add assert "PAE not yet implemented".
2020-04-04 14:26:15 +02:00
Hervé Poussineau 38e53eea4f [NTOS:KD] Fix compilation with CMAKE_BUILD_TYPE=Release
This was broken by commit f7ec84eea0
2020-03-30 15:23:25 +02:00
Victor Perevertkin 99f9c1666d
[NTOS:MM] Make _X86PAE_ the only define for PAE-enabled kernel 2020-03-28 18:11:42 +03:00
Eric Kohl 9a07cde37f [NTOS:IO] Improve the device action worker
- Improve the device action worker to support more than just a single action
- Move the action queue code from IoInvalidateDeviceRelations to a new function IopQueueDeviceAction.
2020-03-01 23:32:25 +01:00
Hervé Poussineau 8314c8eeba [NTOS] Move FORCEINLINE specifier where appropriate 2020-01-22 20:57:01 +01:00
Timo Kreuzer 7523a7b138 [NTOS:KE] Rename some locking functions to reflect the IRQL level changes
* KiAcquireApcLock -> KiAcquireApcLockRaiseToSynch
* KiAcquireApcLockAtDpcLevel -> KiAcquireApcLockAtSynchLevel
* KiReleaseApcLockFromDpcLevel -> KiReleaseApcLockFromSynchLevel
* KiAcquireApcLockAtApcLevel -> KiAcquireApcLockRaiseToDpc
* KiAcquireProcessLock -> KiAcquireProcessLockRaiseToSynch
* KiReleaseProcessLockFromDpcLevel -> KiReleaseProcessLockFromSynchLevel
* KiAcquireDispatcherLockAtDpcLevel -> KiAcquireDispatcherLockAtSynchLevel
* KiReleaseDispatcherLockFromDpcLevel -> KiReleaseDispatcherLockFromSynchLevel
* Add some ASSERTs
2019-12-31 15:30:27 +01:00
Thomas Faber 2a91ea855a
[NTOS] Make RtlFindCharInUnicodeString available in the kernel. 2019-12-31 15:17:59 +01:00
Hermès Bélusca-Maïto 28b77a40ca
[NDK][NTOS:INBV] Remove non-exported INBV functions from NDK; do some cleanup in INBV headers; label both InbvSetProgressBarSubset() and InbvSetProgressBarCoordinates() as INIT_FUNCTION since they are used only for the boot splash. And fix MSVC build. 2019-11-25 15:54:45 +01:00
Hermès Bélusca-Maïto a890fc64d1
[NTOS:KD/KD64/KDBG] Share some code between our legacy KD/KDBG and KD64.
Our legacy KD module is slowly being phased out for the more recent KD64
Kernel Debugger that supports WinDbg, but at the same time we must retain
support for GCC debugging and the KDBG interface.

For the time being few #ifdef _WINKD_ have been introduced in KD64 so that
some of its code/data does not completely get shared yet with the legacy KD,
until the latter becomes phased out.

KD Modifications:
=================
- Remove the implementation of NtQueryDebugFilterState() /
  NtSetDebugFilterState() that now comes entirely from KD64.

- Remove KD variables that are now shared with KD64.

- Share common code with KD64: KdpMoveMemory(), KdpZeroMemory(),
  KdpCopyMemoryChunks(), KdpPrint(), KdpPrompt().

- KDBG: Remove the duplicated KdpCopyMemoryChunks() function.

- In KdpServiceDispatcher() and KdpEnterDebuggerException(), call the
  KdpPrint() worker function that correctly probes and captures its arguments.

- Temporarily stub out KdEnterDebugger() and KdExitDebugger() that is used
  by the shared code, until KD is removed and only the KD64 version of these
  functions remain.

- Re-implement the KD/KDBG KdpPrompt() function using a custom KdpPromptString()
  helper compatible with KD64, that is called by the KD64 implementation of
  KdpPrompt(). This KdpPromptString() helper now issues the prompt on all
  the KD loggers: e.g. if you use both at the same time COM-port and SCREEN
  debugging, the prompt will appear on both. Before that the prompt was always
  being displayed on COM port even if e.g. a SCREEN-only debug session was used...

- ppc_irq.c: Fix the prototype of KdpServiceDispatcher().

KD64 Fixes:
===========
- Initialize the MaximumLength member of the counted STRING variables
  before using them elsewhere.

- Get rid of alloca() within SEH block in KdpPrint() (addendum to 7b95fcf9).

- Add the ROS-specific handy dump commands in KdSystemDebugControl().
2019-11-17 23:21:54 +01:00
Hermès Bélusca-Maïto 54c03f6965
[NTOS:KD64] Some code formatting + add SAL2 annotations to the functions that are going to be involved in the next commit.
+ s/ReturnStatus/Status/ , and get rid of Win32 LPSTR and replace by
  PCHAR (since the concerned code deals with counted strings).
2019-11-17 23:21:53 +01:00
Hermès Bélusca-Maïto 6c1aac6948
[NTOS] Complete the support of Debug Filters. CORE-13529
- KD64: Update the list of supported Debug Filter Masks (KdComponentTable)
  with the more up-to-date one from KDBG, that includes some components
  that have been added in Vista+, but some of which we also use in ReactOS.

- NtQueryDebugFilterState(), NtSetDebugFilterState() and KdpPrint():
  Add the Vista+ behaviour or falling back to the DEFAULT component ID
  settings for unknown Components (compiled in only wheen NTDDI_VERSION >= NTDDI_VISTA).
  + Remove redundant comments and update these functions with SAL2 annotations.

- KDBG: Add extra documentation for the debug filter components list.

- CONFIG: Load all the supported Debug Filter Masks settings from the
  registry.
2019-11-17 23:21:53 +01:00
Hermès Bélusca-Maïto 9537653ee7
[NTOS:KD/KDBG] Code enhancements for KDBG/KD.
- Introduce KdpScreenAcquire() / KdpScreenRelease() helpers that allow
  to correctly acquire or release the screen when using INBV for
  "Screen-Mode" debugging.

- Introduce KdpAcquireLock() / KdpReleaseLock() helpers so as to reduce
  the copy-pasted code required when acquiring spin-locks in the KD debug
  logger functions.

- Close the opened KdpLogFileHandle file in the KdpInitDebugLog() logger
  in case we failed to create the logger writer thread.
  Also use explicit kernel-mode handle when opening the log file.

- static-ify some local variables, remove few hardcoded values, and
  minor formatting.

- Correctly define the INIT_FUNCTION's.
2019-11-17 23:21:50 +01:00
Hermès Bélusca-Maïto 3b2f158593
[NTOS][CLASS2][FFS][WIN32SS] Fix some pool tags so that they correctly appear in pool dump lists.
Reminder: in the code they are defined using reverse byte order
(Windows/ReactOS are little-endian OSes).
2019-11-01 19:12:27 +01:00
Pierre Schweitzer 5ab1cfc553
[NTOSKRNL] Rewrite IoAssignDriveLetters to make NT5 compliant
The major change with this rewrite is the support for the mount
manager. Fstub will now assume that most of the devices are PnP
and that they are already registered to the mount manager.
It will thus ask the mount manager to assign the drive letter.
Fstub will keep assigning drive letters non mission critical devices
such as CDs, floppies and other removable devices.

See MountMgr:QueryPoints API test that will now return mount points :-).
2019-10-21 18:28:40 +02:00
Pierre Schweitzer 11db7c9e5d
[NTOSKRNL] Define TAG_FSTUB in the dedicated internal header 2019-10-21 14:26:00 +02:00
Pierre Schweitzer 80cc287cf6
[NTOSKRNL] Declare IoRemoteBootClient in internal headers 2019-10-21 14:16:58 +02:00
Hervé Poussineau 7390376753 Revert "[NTOS:KDBG] Use CONTEXT instead of KTRAP_FRAME"
This reverts commit e5bffe49da.

CORE-16231
2019-10-19 00:14:12 +02:00
Serge Gautherie e413df4f4e [NTOS:MM] i386: Fix '_MI_NO_EXECUTE' typo
Addendum to 65dbfc2868.
2019-09-30 10:46:58 +03: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
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
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 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 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
Pierre Schweitzer 651ba03c6d
[NTOSKRNL] Taggify some allocs 2019-06-10 14:54:55 +02:00
Pierre Schweitzer 7c618faa32
[NTOSKRNL] Implement SeGetLogonIdDeviceMap 2019-06-01 21:09:20 +02:00
Pierre Schweitzer 59806f7eb0
[NTOSKRNL] Stub SeGetLogonIdDeviceMap 2019-06-01 18:37:47 +02:00
Pierre Schweitzer 46b90ccb96
[NTOSKRNL] Add support for LUID mappings in ObQueryDeviceMapInformation 2019-06-01 17:40:18 +02:00
Pierre Schweitzer 1074a9aaff
[NTOSKRNL] Implement support for PROCESS_DEVICEMAP_INFORMATION_EX in NtQueryInformationProcess 2019-06-01 15:18:52 +02:00