Commit graph

152 commits

Author SHA1 Message Date
Thomas Faber ae1d272add
[NTOS:PNP] Avoid recursion in IopTraverseDeviceTree(Node). CORE-17215 2020-11-27 10:31:41 +01:00
Hervé Poussineau 129e009a2c [NTOS:IO] Do not translate resources of type CmResourceTypeDevicePrivate
CmResourceTypeDevicePrivate resources are created the the bus driver, for its own later use,
when children devices will receive the IRP_MN_START_DEVICE.

Do not translate them, as they have no meaning outside bus driver.
2020-11-15 18:38:37 +01:00
Victor Perevertkin d6ef8f97e9
[NTOS:PNP] Enumerate the device tree after loading boot drivers and HAL 2020-11-10 01:59:49 +03:00
Hermès Bélusca-Maïto 3c722e35b1
[CMD][SERVMAN][SHELL32][WINSPOOL][ROSAPPS][NTOS:PNP] Fix my build. 2020-11-06 01:06:11 +01:00
Victor Perevertkin 5c7ce4475e
[REACTOS] Cleanup INIT and some PAGE section allocations
- Change INIT_FUNCTION and INIT_SECTION to CODE_SEG("INIT") and DATA_SEG("INIT") respectively
- Remove INIT_FUNCTION from function prototypes
- Remove alloc_text pragma calls as they are not needed anymore
2020-11-02 21:45:31 +03:00
Hermès Bélusca-Maïto bd2a40d57b
[NTOS:IO] Some fixes for IoRaiseHardError(). (#3302)
CORE-14037

- Fix buggy retrieval of the current calling Irp->Tail.Overlay.Thread.

- The 4th argument (KernelRoutine) to the KeInitializeApc() is **NOT**
  optional; however its 5th argument (RundownRoutine) is.
  So use the mandatory routine for freeing the allocated APC instead.
  We don't use the rundown routine yet.

- Check whether the ExAllocatePoolWithTag() call failed or not before
  queueing the allocated APC.
2020-10-17 16:13:05 +02:00
Dmitry Borisov c464b02c90
[NTOS:PNP] Install mouse driver on NEC PC-98 series (#3173)
The current implementation of device tree enumeration does not distinguish
between possible identifier strings. This change is not a hack,
NT 5.2 still creates a new device node for this hardware ID.
The entire function should be rewritten to match Windows implementation.
2020-10-10 16:24:17 +03:00
Timo Kreuzer f2e3e8a1eb [NTOS] Remove an old hack 2020-09-28 00:27:30 +02:00
Victor Perevertkin 32c7c1157d
[NTOS:IO] Fix a reference leak in IopSynchronousCall on failure case
Co-authored-by: Vadim Galyant <vgal@rambler.ru>
2020-09-08 14:51:20 +03:00
Victor Perevertkin f562f9c5c6
[NTOS:IO] Fix IRP stack location check in IoForwardIrpSynchronously
We are doing IoCallDriver here, so the valid stack location should be
CurrentLocation <= Irp->StackCount (just a check for a completly incorrect value)
&& CurrentLocation > 1 (ensure that we have a place for another call)

CORE-17189

Co-authored-by: Thomas Faber <thomas.faber@reactos.org>
2020-09-07 04:57:17 +03:00
Victor Perevertkin 162d614cc1
[NTOS:IO] Queue device tree enumeration inside IoReportDetectedDevice
Without that, a DeviceNode is not created for a reported device and thus
it is not being attached to the device tree

CORE-17132
2020-08-21 08:53:33 +03:00
Victor Perevertkin dc1d717b22
[NTOS:IO] Do not raise an unknown bugcheck inside the PiQueueDeviceAction 2020-08-21 08:50:12 +03: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
Nguyen Trung Khanh 37c63770d7
[NTOS:IO] Fix pool memory disclosure in IopQueueTargetDeviceEvent (#2966) 2020-07-04 15:41:18 +02:00
Victor Perevertkin 21e9e2baa5
[NTOS:IO] Move device manipulation functions from pnpmgr/pnpmgr.c to pnpmgr/devaction.c
And rearrange them in more logical order.

This effectively splits the file, leaving public "Io" functions in
pnpmgr.c along with some things not related do device object management.
Functions which manipulate the device tree are left in devaction.c.
In future all these functions will only be accessed from
DeviceActionWorker.
While being public API, IoRequestDeviceEject and IoInvalidateDeviceState
have been moved to devaction.c as well. In next commits they will be
converted to DeviceActionWorker routines and their callers will be put
in pnpmgr.c
2020-06-24 04:03:35 +03: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
Serge Gautherie b20f815126
[NTOSKRNL] Place INIT_FUNCTION before the return type (#2823)
(but after 'static' or SAL 2 annotation.)
Follow-up to 71fefa32, which mentions that it's actually required by the compiler in some circumstances.
2020-05-23 15:56:10 +02:00
Thomas Faber c60d25fb26
[NTOS:PNP] Directly accept a UNICODE_STRING in LocateChildDevice. CORE-15882 2020-05-17 20:56:16 +02:00
Thomas Faber 2242ca6920
[NTOS:PNP] Avoid an unnecessary stack buffer in PnpRootCreateDevice. CORE-15882 2020-05-17 20:56:16 +02:00
Thomas Faber 1b0fe76d0d
[NTOS:PNP] Avoid an unnecessary stack buffer in EnumerateDevices. CORE-15882 2020-05-17 20:56:16 +02:00
Thomas Faber ac52401d74
[NTOS:PNP] Move child device creation into its own function
Also fix some leaks and a DPRINT format string.
2020-05-17 20:56:11 +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
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
Vadim Galyant 7db342f8a1
[NTOS:PNP] Add set functions for debugging PNP and IO managers. (#2457)
Useful functions for debugging IO and PNP managers:

PipDumpDeviceNodes() - displays information about a node(s) in the device tree;
PipDumpResourceRequirementsList() - displays information about a Io List;
PipDumpCmResourceList() - displays information about a Cm List

The tree list of devices (DEVICE_NODE structures) is perhaps the main one in the PnP manager. They also store information about the hardware resources required and assigned to devices.
These functions can help with debugging. For example, you can call PipDumpDeviceNodes() before and after device enumeration and compare the resulting information.

For PipDumpDeviceNodes() it is possible to optionally output:
- allocated resources and boot configuration resources
- resources required
- translated resources
It is possible to displays both a single node and the entire tree.
Optionally, you can display child nodes.

The information output format for resource lists is maximally compressed, since often the only debugging port is a monitor.

The DebugLevel parameter allows dumping in two modes:
0 - unconditional;
1 - if NDEBUG is not defined in "debug.c".
2020-04-04 14:30:40 +02:00
Eric Kohl 93e72ed3d6 [NTOS:IO] Fix indentation. No code changes! 2020-03-21 14:32:18 +01:00
Eric Kohl 52d22630f5 [NTOS:PNP] Fix indentation. No code changes! 2020-03-21 13:23:23 +01:00
Eric Kohl a8846037e1 [NTOS:PNP] Map device capabilities to capability flags
This fixes a devices Capabilities value in the registry.
2020-03-21 13:23:22 +01:00
Thomas Faber 72c51aabba
[NTOS:IO][GDI32][CMD] Fix some under-sized variables. CORE-14922
Fixes x64 boot with RTC.
2020-03-13 20:45:06 +01:00
Eric Kohl 7a7212f984 [NTOS:IO] Fix indentation. No code changes! 2020-03-01 23:34:30 +01: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
Eric Kohl a05051f554 [NTOS:IO] Move IopRemovePlugPlayEvent around and add the ResponseData parameter (not used yet) 2020-02-29 14:26:16 +01:00
Eric Kohl 9538c3ccd7 [NTOS:IO] Fix indentation. No code changes! 2020-01-02 23:25:26 +01:00
Thomas Faber c904983b49
[NTOS:IO] Use UNICODE_STRING operations in IopUnloadDriver.
Fixes several overflow vulnerabilities.
2019-12-31 15:18:17 +01:00
Timo Kreuzer 53f8cbad97 [NTOS:IO] Fix list enumeration in IopShutdownBaseFileSystems 2019-12-30 15:48:38 +01:00
Eric Kohl 8faf38ed22 [NTOS:IO] Fix indentation. No code changes! 2019-12-29 14:37:13 +01:00
Victor Perevertkin 3d046e0ed2 [NTOS:IO] Fix result length for DevicePropertyRemovalPolicy request
in IoGetDeviceProperty.
Classpnp expects it to be sizeof(DEVICE_REMOVAL_POLICY)
see ClasspInitializeHotplugInfo in classpnp.sys

CORE-6264
2019-11-17 18:36:28 +03:00
Pierre Schweitzer 80cc287cf6
[NTOSKRNL] Declare IoRemoteBootClient in internal headers 2019-10-21 14:16:58 +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
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
Serge Gautherie 87a625bd6c [NTOS:IO] iomgr.c: Add a missing '#if defined(KDBG)' 2019-08-17 17:36:49 +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 e50873376d [NTOS:IO] Improve an alignment 2019-08-15 18:04:57 +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
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
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