Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NTOS:PNP] Implement PlugPlayControlStartDevice control class and use it #3481

Merged
merged 3 commits into from Mar 16, 2021

Conversation

Extravert-ir
Copy link
Member

@Extravert-ir Extravert-ir commented Feb 23, 2021

This adds another action for starting devices after usermode PnP service enables the driver for it.
PlugPlayControlResetDevice is wrong in this case, because it returns the device node back to DeviceNodeUninitialized state, which is an overkill here (initialization phase is completed successfully, no need to repeat it)

Should fix: CORE-17490, CORE-17463

@github-actions github-actions bot added the kernel&hal Code changes to the ntoskrnl and HAL label Feb 23, 2021
@binarymaster binarymaster added the bugfix For bugfix PRs. label Feb 23, 2021
@binarymaster binarymaster added this to New PRs in ReactOS PRs via automation Feb 23, 2021
Copy link
Member

@binarymaster binarymaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, achieved two improvements, one remains the same :)

CORE-17490

✔️ Tested on VirtualBox with LiveCD - ISAPNP read data port now appears in Device Manager.

CORE-17458

✔️ Networking works now both in LiveCD and in 2nd stage setup.

CORE-17463

✖️ PS/2 keyboard and mouse in 3rd stage with Standard HAL still not working for me, the same error code in Device Manager.

Status = NtPlugPlayControl(PlugPlayControlDeviceStatus, &PlugPlayData, sizeof(PlugPlayData));
if (NT_SUCCESS(Status))
{
return (_Bool)((PlugPlayData.DeviceStatus & DN_DRIVER_LOADED) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (_Bool)((PlugPlayData.DeviceStatus & DN_DRIVER_LOADED) &&
return (BOOLEAN)((PlugPlayData.DeviceStatus & DN_DRIVER_LOADED) &&

(you can use the same return type as the function.)

@Extravert-ir Extravert-ir force-pushed the pnp_control_start branch 2 times, most recently from f82c761 to 022499a Compare March 16, 2021 00:17
…l class

PlugPlayControlResetDevice shares the input structure with several other
control classes.
Source: ProcessHacker sources https://github.com/processhacker/phnt/blob/e9c8121f41b00cd24e31eb466c9795785096b764/ntpnpapi.h
This control class is triggered when a driver is being installed for a
non-critical device. The driver info should already be in the registry
so we just need to push the device through the state graph

Meanwhile, combine the code for similar control classes into
PiControlSyncDeviceAction routine

CORE-17463 CORE-17490
Instead of PlugPlayControlResetDevice, PlugPlayControlStartDevice should
be used for a newly installed device.
For usetup, add a device status check before starting attempt, so we're
not touching devices which are already started.

CORE-17463 CORE-17490
@Extravert-ir Extravert-ir merged commit abbc5ba into reactos:master Mar 16, 2021
ReactOS PRs automation moved this from New PRs to Done Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix For bugfix PRs. kernel&hal Code changes to the ntoskrnl and HAL
Projects
ReactOS PRs
  
Done
4 participants