mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 05:35:06 +00:00
Clean up code by removing now useless parts
Replace 3rd arg of IopActionInitChildServices by a global variable (removes a pointer cast) IopStartDevice: no need to get top of stack, IopInitiatePnpIrp does it for us svn path=/trunk/; revision=35532
This commit is contained in:
parent
b129412701
commit
bf702f35f2
|
@ -553,8 +553,7 @@ IopActionConfigureChildServices(
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopActionInitChildServices(
|
IopActionInitChildServices(
|
||||||
IN PDEVICE_NODE DeviceNode,
|
IN PDEVICE_NODE DeviceNode,
|
||||||
IN PVOID Context,
|
IN PVOID Context
|
||||||
IN BOOLEAN BootDrivers
|
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -579,8 +578,7 @@ IopQueueTargetDeviceEvent(
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopInitializePnpServices(
|
IopInitializePnpServices(
|
||||||
IN PDEVICE_NODE DeviceNode,
|
IN PDEVICE_NODE DeviceNode);
|
||||||
IN BOOLEAN BootDrivers);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -782,10 +782,6 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
|
||||||
LPWSTR FileExtension;
|
LPWSTR FileExtension;
|
||||||
PUNICODE_STRING ModuleName = &LdrEntry->BaseDllName;
|
PUNICODE_STRING ModuleName = &LdrEntry->BaseDllName;
|
||||||
UNICODE_STRING ServiceName;
|
UNICODE_STRING ServiceName;
|
||||||
#if 1 // Disable for FreeLDR 2.5
|
|
||||||
UNICODE_STRING ServiceNameWithExtension;
|
|
||||||
PLDR_DATA_TABLE_ENTRY ModuleObject;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display 'Loading XXX...' message
|
* Display 'Loading XXX...' message
|
||||||
|
@ -805,19 +801,6 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
|
||||||
FileNameWithoutPath++;
|
FileNameWithoutPath++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Load the module.
|
|
||||||
*/
|
|
||||||
#if 1 // Remove for FreeLDR 2.5.
|
|
||||||
RtlCreateUnicodeString(&ServiceNameWithExtension, FileNameWithoutPath);
|
|
||||||
Status = LdrProcessDriverModule(LdrEntry, &ServiceNameWithExtension, &ModuleObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
CPRINT("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Strip the file extension from ServiceName
|
* Strip the file extension from ServiceName
|
||||||
*/
|
*/
|
||||||
|
@ -844,7 +827,6 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
|
||||||
/*
|
/*
|
||||||
* Initialize the driver
|
* Initialize the driver
|
||||||
*/
|
*/
|
||||||
DeviceNode->Flags |= DN_DRIVER_LOADED;
|
|
||||||
Status = IopInitializeDriverModule(DeviceNode, LdrEntry,
|
Status = IopInitializeDriverModule(DeviceNode, LdrEntry,
|
||||||
&DeviceNode->ServiceName, FALSE, &DriverObject);
|
&DeviceNode->ServiceName, FALSE, &DriverObject);
|
||||||
|
|
||||||
|
@ -1729,9 +1711,6 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
|
||||||
|
|
||||||
/* Store its DriverSection, so that it could be unloaded */
|
/* Store its DriverSection, so that it could be unloaded */
|
||||||
DriverObject->DriverSection = ModuleObject;
|
DriverObject->DriverSection = ModuleObject;
|
||||||
|
|
||||||
/* We have a driver for this DeviceNode */
|
|
||||||
DeviceNode->Flags |= DN_DRIVER_LOADED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IopInitializeDevice(DeviceNode, DriverObject);
|
IopInitializeDevice(DeviceNode, DriverObject);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
ULONG IopTraceLevel = 0;
|
ULONG IopTraceLevel = 0;
|
||||||
|
BOOLEAN PnpSystemInit = FALSE;
|
||||||
|
|
||||||
// should go into a proper header
|
// should go into a proper header
|
||||||
VOID
|
VOID
|
||||||
|
@ -535,9 +536,10 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Load services for devices found by PnP manager */
|
/* Load services for devices found by PnP manager */
|
||||||
IopInitializePnpServices(IopRootDeviceNode, FALSE);
|
IopInitializePnpServices(IopRootDeviceNode);
|
||||||
|
|
||||||
/* Load system start drivers */
|
/* Load system start drivers */
|
||||||
|
PnpSystemInit = TRUE;
|
||||||
IopInitializeSystemDrivers();
|
IopInitializeSystemDrivers();
|
||||||
|
|
||||||
/* Destroy the group driver list */
|
/* Destroy the group driver list */
|
||||||
|
|
|
@ -576,7 +576,7 @@ IopResetDevice(PPLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData)
|
||||||
Status = IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent);
|
Status = IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent);
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
Status = IopActionInitChildServices(DeviceNode, DeviceNode->Parent, FALSE);
|
Status = IopActionInitChildServices(DeviceNode, DeviceNode->Parent);
|
||||||
|
|
||||||
ObDereferenceObject(DeviceObject);
|
ObDereferenceObject(DeviceObject);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ KGUARDED_MUTEX PpDeviceReferenceTableLock;
|
||||||
RTL_AVL_TABLE PpDeviceReferenceTable;
|
RTL_AVL_TABLE PpDeviceReferenceTable;
|
||||||
|
|
||||||
extern ULONG ExpInitializationPhase;
|
extern ULONG ExpInitializationPhase;
|
||||||
|
extern BOOLEAN PnpSystemInit;
|
||||||
|
|
||||||
/* DATA **********************************************************************/
|
/* DATA **********************************************************************/
|
||||||
|
|
||||||
|
@ -139,16 +140,13 @@ IopStartDevice(
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
IO_STACK_LOCATION Stack;
|
IO_STACK_LOCATION Stack;
|
||||||
ULONG RequiredLength;
|
ULONG RequiredLength;
|
||||||
PDEVICE_OBJECT Fdo;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Fdo = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
|
|
||||||
|
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_ASSIGNING_RESOURCES);
|
IopDeviceNodeSetFlag(DeviceNode, DNF_ASSIGNING_RESOURCES);
|
||||||
DPRINT("Sending IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device stack\n");
|
DPRINT("Sending IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device stack\n");
|
||||||
Stack.Parameters.FilterResourceRequirements.IoResourceRequirementList = DeviceNode->ResourceRequirements;
|
Stack.Parameters.FilterResourceRequirements.IoResourceRequirementList = DeviceNode->ResourceRequirements;
|
||||||
Status = IopInitiatePnpIrp(
|
Status = IopInitiatePnpIrp(
|
||||||
Fdo,
|
DeviceNode->PhysicalDeviceObject,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
IRP_MN_FILTER_RESOURCE_REQUIREMENTS,
|
IRP_MN_FILTER_RESOURCE_REQUIREMENTS,
|
||||||
&Stack);
|
&Stack);
|
||||||
|
@ -190,7 +188,7 @@ IopStartDevice(
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
Status = IopInitiatePnpIrp(
|
Status = IopInitiatePnpIrp(
|
||||||
Fdo,
|
DeviceNode->PhysicalDeviceObject,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
IRP_MN_START_DEVICE,
|
IRP_MN_START_DEVICE,
|
||||||
&Stack);
|
&Stack);
|
||||||
|
@ -213,10 +211,8 @@ IopStartDevice(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(Fdo);
|
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
DeviceNode->Flags |= DN_STARTED;
|
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -1784,7 +1780,6 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode,
|
||||||
* device is started */
|
* device is started */
|
||||||
DPRINT1("%wZ is using NULL driver\n", &DeviceNode->InstancePath);
|
DPRINT1("%wZ is using NULL driver\n", &DeviceNode->InstancePath);
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
|
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
|
||||||
DeviceNode->Flags |= DN_STARTED;
|
|
||||||
}
|
}
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1805,8 +1800,6 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode,
|
||||||
* Pointer to device node.
|
* Pointer to device node.
|
||||||
* Context
|
* Context
|
||||||
* Pointer to parent node to initialize child node services for.
|
* Pointer to parent node to initialize child node services for.
|
||||||
* BootDrivers
|
|
||||||
* Load only driver marked as boot start.
|
|
||||||
*
|
*
|
||||||
* Remarks
|
* Remarks
|
||||||
* If the driver image for a service is not loaded and initialized
|
* If the driver image for a service is not loaded and initialized
|
||||||
|
@ -1819,14 +1812,13 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopActionInitChildServices(PDEVICE_NODE DeviceNode,
|
IopActionInitChildServices(PDEVICE_NODE DeviceNode,
|
||||||
PVOID Context,
|
PVOID Context)
|
||||||
BOOLEAN BootDrivers)
|
|
||||||
{
|
{
|
||||||
PDEVICE_NODE ParentDeviceNode;
|
PDEVICE_NODE ParentDeviceNode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
BOOLEAN BootDrivers = !PnpSystemInit;
|
||||||
|
|
||||||
DPRINT("IopActionInitChildServices(%p, %p, %d)\n", DeviceNode, Context,
|
DPRINT("IopActionInitChildServices(%p, %p)\n", DeviceNode, Context);
|
||||||
BootDrivers);
|
|
||||||
|
|
||||||
ParentDeviceNode = (PDEVICE_NODE)Context;
|
ParentDeviceNode = (PDEVICE_NODE)Context;
|
||||||
|
|
||||||
|
@ -1900,8 +1892,6 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode,
|
||||||
/* Driver is loaded and initialized at this point */
|
/* Driver is loaded and initialized at this point */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* We have a driver for this DeviceNode */
|
|
||||||
DeviceNode->Flags |= DN_DRIVER_LOADED;
|
|
||||||
/* Attach lower level filter drivers. */
|
/* Attach lower level filter drivers. */
|
||||||
IopAttachFilterDrivers(DeviceNode, TRUE);
|
IopAttachFilterDrivers(DeviceNode, TRUE);
|
||||||
/* Initialize the function driver for the device node */
|
/* Initialize the function driver for the device node */
|
||||||
|
@ -1945,34 +1935,6 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* IopActionInitAllServices
|
|
||||||
*
|
|
||||||
* Initialize the service for all (direct) child nodes of a parent node. This
|
|
||||||
* function just calls IopActionInitChildServices with BootDrivers = FALSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
IopActionInitAllServices(PDEVICE_NODE DeviceNode,
|
|
||||||
PVOID Context)
|
|
||||||
{
|
|
||||||
return IopActionInitChildServices(DeviceNode, Context, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IopActionInitBootServices
|
|
||||||
*
|
|
||||||
* Initialize the boot start services for all (direct) child nodes of a
|
|
||||||
* parent node. This function just calls IopActionInitChildServices with
|
|
||||||
* BootDrivers = TRUE.
|
|
||||||
*/
|
|
||||||
NTSTATUS
|
|
||||||
IopActionInitBootServices(PDEVICE_NODE DeviceNode,
|
|
||||||
PVOID Context)
|
|
||||||
{
|
|
||||||
return IopActionInitChildServices(DeviceNode, Context, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IopInitializePnpServices
|
* IopInitializePnpServices
|
||||||
*
|
*
|
||||||
|
@ -1982,37 +1944,21 @@ IopActionInitBootServices(PDEVICE_NODE DeviceNode,
|
||||||
* DeviceNode
|
* DeviceNode
|
||||||
* Top device node to start initializing services.
|
* Top device node to start initializing services.
|
||||||
*
|
*
|
||||||
* BootDrivers
|
|
||||||
* When set to TRUE, only drivers marked as boot start will
|
|
||||||
* be loaded. Otherwise, all drivers will be loaded.
|
|
||||||
*
|
|
||||||
* Return Value
|
* Return Value
|
||||||
* Status
|
* Status
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopInitializePnpServices(IN PDEVICE_NODE DeviceNode,
|
IopInitializePnpServices(IN PDEVICE_NODE DeviceNode)
|
||||||
IN BOOLEAN BootDrivers)
|
|
||||||
{
|
{
|
||||||
DEVICETREE_TRAVERSE_CONTEXT Context;
|
DEVICETREE_TRAVERSE_CONTEXT Context;
|
||||||
|
|
||||||
DPRINT("IopInitializePnpServices(%p, %d)\n", DeviceNode, BootDrivers);
|
DPRINT("IopInitializePnpServices(%p)\n", DeviceNode);
|
||||||
|
|
||||||
if (BootDrivers)
|
IopInitDeviceTreeTraverseContext(
|
||||||
{
|
&Context,
|
||||||
IopInitDeviceTreeTraverseContext(
|
DeviceNode,
|
||||||
&Context,
|
IopActionInitChildServices,
|
||||||
DeviceNode,
|
DeviceNode);
|
||||||
IopActionInitBootServices,
|
|
||||||
DeviceNode);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IopInitDeviceTreeTraverseContext(
|
|
||||||
&Context,
|
|
||||||
DeviceNode,
|
|
||||||
IopActionInitAllServices,
|
|
||||||
DeviceNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return IopTraverseDeviceTree(&Context);
|
return IopTraverseDeviceTree(&Context);
|
||||||
}
|
}
|
||||||
|
@ -3051,12 +2997,11 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status, *ResultLength);
|
|
||||||
ExFreePool(ValueInformation);
|
ExFreePool(ValueInformation);
|
||||||
if (Status == STATUS_BUFFER_OVERFLOW)
|
if (Status == STATUS_BUFFER_OVERFLOW)
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
else
|
DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status, *ResultLength);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Verify the value (NULL-terminated, correct format). */
|
/* FIXME: Verify the value (NULL-terminated, correct format). */
|
||||||
|
@ -3339,10 +3284,6 @@ IoSynchronousInvalidateDeviceRelations(
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
PDEVICE_NODE ChildDeviceNode;
|
PDEVICE_NODE ChildDeviceNode;
|
||||||
IO_STACK_LOCATION Stack;
|
IO_STACK_LOCATION Stack;
|
||||||
BOOLEAN BootDrivers;
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot");
|
|
||||||
HANDLE Handle;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
|
@ -3437,36 +3378,9 @@ IoSynchronousInvalidateDeviceRelations(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the state of the system boot. If the \\SystemRoot link isn't
|
* Initialize services for discovered children.
|
||||||
* created yet, we will assume that it's possible to load only boot
|
|
||||||
* drivers.
|
|
||||||
*/
|
*/
|
||||||
InitializeObjectAttributes(
|
Status = IopInitializePnpServices(DeviceNode);
|
||||||
&ObjectAttributes,
|
|
||||||
&LinkName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
Status = ZwOpenFile(
|
|
||||||
&Handle,
|
|
||||||
FILE_ALL_ACCESS,
|
|
||||||
&ObjectAttributes,
|
|
||||||
&IoStatusBlock,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
BootDrivers = FALSE;
|
|
||||||
ZwClose(Handle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
BootDrivers = TRUE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize services for discovered children. Only boot drivers will
|
|
||||||
* be loaded from boot driver!
|
|
||||||
*/
|
|
||||||
Status = IopInitializePnpServices(DeviceNode, BootDrivers);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n", Status);
|
DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n", Status);
|
||||||
|
|
Loading…
Reference in a new issue