Author: hpoussin
Date: Fri Aug 22 12:47:13 2008
New Revision: 35532
URL:
http://svn.reactos.org/svn/reactos?rev=35532&view=rev
Log:
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
Modified:
trunk/reactos/ntoskrnl/include/internal/io.h
trunk/reactos/ntoskrnl/io/iomgr/driver.c
trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] Fri Aug 22 12:47:13 2008
@@ -553,8 +553,7 @@
NTSTATUS
IopActionInitChildServices(
IN PDEVICE_NODE DeviceNode,
- IN PVOID Context,
- IN BOOLEAN BootDrivers
+ IN PVOID Context
);
NTSTATUS
@@ -579,8 +578,7 @@
NTSTATUS
IopInitializePnpServices(
- IN PDEVICE_NODE DeviceNode,
- IN BOOLEAN BootDrivers);
+ IN PDEVICE_NODE DeviceNode);
NTSTATUS
NTAPI
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Fri Aug 22 12:47:13 2008
@@ -782,10 +782,6 @@
LPWSTR FileExtension;
PUNICODE_STRING ModuleName = &LdrEntry->BaseDllName;
UNICODE_STRING ServiceName;
-#if 1 // Disable for FreeLDR 2.5
- UNICODE_STRING ServiceNameWithExtension;
- PLDR_DATA_TABLE_ENTRY ModuleObject;
-#endif
/*
* Display 'Loading XXX...' message
@@ -804,19 +800,6 @@
{
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
@@ -844,7 +827,6 @@
/*
* Initialize the driver
*/
- DeviceNode->Flags |= DN_DRIVER_LOADED;
Status = IopInitializeDriverModule(DeviceNode, LdrEntry,
&DeviceNode->ServiceName, FALSE, &DriverObject);
@@ -1729,9 +1711,6 @@
/* Store its DriverSection, so that it could be unloaded */
DriverObject->DriverSection = ModuleObject;
-
- /* We have a driver for this DeviceNode */
- DeviceNode->Flags |= DN_DRIVER_LOADED;
}
IopInitializeDevice(DeviceNode, DriverObject);
Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] Fri Aug 22 12:47:13 2008
@@ -14,6 +14,7 @@
#include <internal/debug.h>
ULONG IopTraceLevel = 0;
+BOOLEAN PnpSystemInit = FALSE;
// should go into a proper header
VOID
@@ -535,9 +536,10 @@
#endif
/* Load services for devices found by PnP manager */
- IopInitializePnpServices(IopRootDeviceNode, FALSE);
+ IopInitializePnpServices(IopRootDeviceNode);
/* Load system start drivers */
+ PnpSystemInit = TRUE;
IopInitializeSystemDrivers();
/* Destroy the group driver list */
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/plugpla…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] Fri Aug 22 12:47:13 2008
@@ -576,7 +576,7 @@
Status = IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent);
if (NT_SUCCESS(Status))
- Status = IopActionInitChildServices(DeviceNode, DeviceNode->Parent, FALSE);
+ Status = IopActionInitChildServices(DeviceNode, DeviceNode->Parent);
ObDereferenceObject(DeviceObject);
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Fri Aug 22 12:47:13 2008
@@ -24,6 +24,7 @@
RTL_AVL_TABLE PpDeviceReferenceTable;
extern ULONG ExpInitializationPhase;
+extern BOOLEAN PnpSystemInit;
/* DATA **********************************************************************/
@@ -139,16 +140,13 @@
IO_STATUS_BLOCK IoStatusBlock;
IO_STACK_LOCATION Stack;
ULONG RequiredLength;
- PDEVICE_OBJECT Fdo;
NTSTATUS Status;
-
- Fdo = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
IopDeviceNodeSetFlag(DeviceNode, DNF_ASSIGNING_RESOURCES);
DPRINT("Sending IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device stack\n");
Stack.Parameters.FilterResourceRequirements.IoResourceRequirementList =
DeviceNode->ResourceRequirements;
Status = IopInitiatePnpIrp(
- Fdo,
+ DeviceNode->PhysicalDeviceObject,
&IoStatusBlock,
IRP_MN_FILTER_RESOURCE_REQUIREMENTS,
&Stack);
@@ -190,7 +188,7 @@
KeEnterCriticalRegion();
Status = IopInitiatePnpIrp(
- Fdo,
+ DeviceNode->PhysicalDeviceObject,
&IoStatusBlock,
IRP_MN_START_DEVICE,
&Stack);
@@ -213,10 +211,8 @@
}
}
- ObDereferenceObject(Fdo);
-
if (NT_SUCCESS(Status))
- DeviceNode->Flags |= DN_STARTED;
+ IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
return Status;
}
@@ -1784,7 +1780,6 @@
* device is started */
DPRINT1("%wZ is using NULL driver\n",
&DeviceNode->InstancePath);
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
- DeviceNode->Flags |= DN_STARTED;
}
return STATUS_SUCCESS;
}
@@ -1805,8 +1800,6 @@
* Pointer to device node.
* Context
* Pointer to parent node to initialize child node services for.
- * BootDrivers
- * Load only driver marked as boot start.
*
* Remarks
* If the driver image for a service is not loaded and initialized
@@ -1819,14 +1812,13 @@
NTSTATUS
IopActionInitChildServices(PDEVICE_NODE DeviceNode,
- PVOID Context,
- BOOLEAN BootDrivers)
+ PVOID Context)
{
PDEVICE_NODE ParentDeviceNode;
NTSTATUS Status;
-
- DPRINT("IopActionInitChildServices(%p, %p, %d)\n", DeviceNode, Context,
- BootDrivers);
+ BOOLEAN BootDrivers = !PnpSystemInit;
+
+ DPRINT("IopActionInitChildServices(%p, %p)\n", DeviceNode, Context);
ParentDeviceNode = (PDEVICE_NODE)Context;
@@ -1900,8 +1892,6 @@
/* Driver is loaded and initialized at this point */
if (NT_SUCCESS(Status))
{
- /* We have a driver for this DeviceNode */
- DeviceNode->Flags |= DN_DRIVER_LOADED;
/* Attach lower level filter drivers. */
IopAttachFilterDrivers(DeviceNode, TRUE);
/* Initialize the function driver for the device node */
@@ -1946,34 +1936,6 @@
}
/*
- * 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
*
* Initialize services for discovered children
@@ -1982,37 +1944,21 @@
* DeviceNode
* 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
* Status
*/
NTSTATUS
-IopInitializePnpServices(IN PDEVICE_NODE DeviceNode,
- IN BOOLEAN BootDrivers)
+IopInitializePnpServices(IN PDEVICE_NODE DeviceNode)
{
DEVICETREE_TRAVERSE_CONTEXT Context;
- DPRINT("IopInitializePnpServices(%p, %d)\n", DeviceNode, BootDrivers);
-
- if (BootDrivers)
- {
- IopInitDeviceTreeTraverseContext(
- &Context,
- DeviceNode,
- IopActionInitBootServices,
- DeviceNode);
- }
- else
- {
- IopInitDeviceTreeTraverseContext(
- &Context,
- DeviceNode,
- IopActionInitAllServices,
- DeviceNode);
- }
+ DPRINT("IopInitializePnpServices(%p)\n", DeviceNode);
+
+ IopInitDeviceTreeTraverseContext(
+ &Context,
+ DeviceNode,
+ IopActionInitChildServices,
+ DeviceNode);
return IopTraverseDeviceTree(&Context);
}
@@ -3051,12 +2997,11 @@
if (!NT_SUCCESS(Status))
{
- DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status,
*ResultLength);
ExFreePool(ValueInformation);
if (Status == STATUS_BUFFER_OVERFLOW)
return STATUS_BUFFER_TOO_SMALL;
- else
- return Status;
+ DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status,
*ResultLength);
+ return Status;
}
/* FIXME: Verify the value (NULL-terminated, correct format). */
@@ -3339,10 +3284,6 @@
IO_STATUS_BLOCK IoStatusBlock;
PDEVICE_NODE ChildDeviceNode;
IO_STACK_LOCATION Stack;
- BOOLEAN BootDrivers;
- OBJECT_ATTRIBUTES ObjectAttributes;
- UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot");
- HANDLE Handle;
NTSTATUS Status;
ULONG i;
@@ -3437,36 +3378,9 @@
}
/*
- * Get the state of the system boot. If the \\SystemRoot link isn't
- * created yet, we will assume that it's possible to load only boot
- * drivers.
+ * Initialize services for discovered children.
*/
- InitializeObjectAttributes(
- &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);
+ Status = IopInitializePnpServices(DeviceNode);
if (!NT_SUCCESS(Status))
{
DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n",
Status);