Author: hpoussin
Date: Sun Jun 10 20:15:16 2007
New Revision: 27120
URL:
http://svn.reactos.org/svn/reactos?rev=27120&view=rev
Log:
Fill HardwareDatabase, DriverStart and DriverSize fields before calling init routine
Modified:
trunk/reactos/ntoskrnl/include/internal/io.h
trunk/reactos/ntoskrnl/io/iomgr/driver.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 (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h Sun Jun 10 20:15:16 2007
@@ -806,6 +806,8 @@
IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
IN PDRIVER_INITIALIZE InitializationFunction,
IN PUNICODE_STRING RegistryPath,
+ IN PVOID DllBase,
+ IN ULONG SizeOfImage,
OUT PDRIVER_OBJECT *pDriverObject);
VOID
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 (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Sun Jun 10 20:15:16 2007
@@ -411,24 +411,25 @@
RtlInitUnicodeString(&DriverName, NameBuffer);
DPRINT("Driver name: '%wZ'\n", &DriverName);
- Status = IopCreateDriver(&DriverName, DriverEntry, &RegistryKey,
&Driver);
}
else
- {
- Status = IopCreateDriver(NULL, DriverEntry, &RegistryKey, &Driver);
- }
+ DriverName.Length = 0;
+
+ Status = IopCreateDriver(
+ DriverName.Length > 0 ? &DriverName : NULL,
+ DriverEntry,
+ &RegistryKey,
+ ModuleObject->DllBase,
+ ModuleObject->SizeOfImage,
+ &Driver);
RtlFreeUnicodeString(&RegistryKey);
*DriverObject = Driver;
if (!NT_SUCCESS(Status))
{
- DPRINT1("IopCreateDriver() failed (Status 0x%08lx)\n", Status);
+ DPRINT("IopCreateDriver() failed (Status 0x%08lx)\n", Status);
return Status;
}
-
- Driver->HardwareDatabase = &IopHardwareDatabaseKey;
- Driver->DriverStart = ModuleObject->DllBase;
- Driver->DriverSize = ModuleObject->SizeOfImage;
/* Set the driver as initialized */
Driver->Flags |= DRVO_INITIALIZED;
@@ -1093,6 +1094,8 @@
IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
IN PDRIVER_INITIALIZE InitializationFunction,
IN PUNICODE_STRING RegistryPath,
+ IN PVOID DllBase,
+ IN ULONG SizeOfImage,
OUT PDRIVER_OBJECT *pDriverObject)
{
WCHAR NameBuffer[100];
@@ -1225,6 +1228,10 @@
/* Close the extra handle */
ZwClose(hDriver);
+ DriverObject->HardwareDatabase = &IopHardwareDatabaseKey;
+ DriverObject->DriverStart = DllBase;
+ DriverObject->DriverSize = SizeOfImage;
+
/* Finally, call its init function */
DPRINT("RegistryKey: %wZ\n", RegistryKey);
DPRINT("Calling driver entrypoint at %p\n", InitializationFunction);
@@ -1256,7 +1263,7 @@
IN PDRIVER_INITIALIZE InitializationFunction)
{
PDRIVER_OBJECT DriverObject;
- return IopCreateDriver(DriverName, InitializationFunction, NULL, &DriverObject);
+ return IopCreateDriver(DriverName, InitializationFunction, NULL, 0, 0,
&DriverObject);
}
/*
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 (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Sun Jun 10 20:15:16 2007
@@ -2022,7 +2022,6 @@
DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
}
-
DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextDescription to device
stack\n");
Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextDescription;
@@ -2275,7 +2274,7 @@
if (!NT_SUCCESS(Status))
{
/* FIXME: Log the error */
- DPRINT1("Could not retrieve configuration for device %wZ (Status
0x%08x)\n",
+ DPRINT("Could not retrieve configuration for device %wZ (Status
0x%08x)\n",
&DeviceNode->InstancePath, Status);
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
return STATUS_SUCCESS;
@@ -2297,7 +2296,7 @@
return STATUS_SUCCESS;
}
- DPRINT1("Got Service %S\n", Service->Buffer);
+ DPRINT("Got Service %S\n", Service->Buffer);
}
return STATUS_SUCCESS;
@@ -3315,7 +3314,7 @@
* Create root device node
*/
- Status = IopCreateDriver(NULL, PnpDriverInitializeEmpty, NULL,
&IopRootDriverObject);
+ Status = IopCreateDriver(NULL, PnpDriverInitializeEmpty, NULL, 0, 0,
&IopRootDriverObject);
if (!NT_SUCCESS(Status))
{
CPRINT("IoCreateDriverObject() failed\n");