mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 04:33:32 +00:00
Fill HardwareDatabase, DriverStart and DriverSize fields before calling init routine
svn path=/trunk/; revision=27120
This commit is contained in:
parent
65c877d142
commit
db153659fe
3 changed files with 22 additions and 14 deletions
|
@ -806,6 +806,8 @@ NTAPI
|
||||||
IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
|
IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
|
||||||
IN PDRIVER_INITIALIZE InitializationFunction,
|
IN PDRIVER_INITIALIZE InitializationFunction,
|
||||||
IN PUNICODE_STRING RegistryPath,
|
IN PUNICODE_STRING RegistryPath,
|
||||||
|
IN PVOID DllBase,
|
||||||
|
IN ULONG SizeOfImage,
|
||||||
OUT PDRIVER_OBJECT *pDriverObject);
|
OUT PDRIVER_OBJECT *pDriverObject);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -411,25 +411,26 @@ IopInitializeDriverModule(
|
||||||
|
|
||||||
RtlInitUnicodeString(&DriverName, NameBuffer);
|
RtlInitUnicodeString(&DriverName, NameBuffer);
|
||||||
DPRINT("Driver name: '%wZ'\n", &DriverName);
|
DPRINT("Driver name: '%wZ'\n", &DriverName);
|
||||||
Status = IopCreateDriver(&DriverName, DriverEntry, &RegistryKey, &Driver);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
DriverName.Length = 0;
|
||||||
Status = IopCreateDriver(NULL, DriverEntry, &RegistryKey, &Driver);
|
|
||||||
}
|
Status = IopCreateDriver(
|
||||||
|
DriverName.Length > 0 ? &DriverName : NULL,
|
||||||
|
DriverEntry,
|
||||||
|
&RegistryKey,
|
||||||
|
ModuleObject->DllBase,
|
||||||
|
ModuleObject->SizeOfImage,
|
||||||
|
&Driver);
|
||||||
RtlFreeUnicodeString(&RegistryKey);
|
RtlFreeUnicodeString(&RegistryKey);
|
||||||
|
|
||||||
*DriverObject = Driver;
|
*DriverObject = Driver;
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("IopCreateDriver() failed (Status 0x%08lx)\n", Status);
|
DPRINT("IopCreateDriver() failed (Status 0x%08lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Driver->HardwareDatabase = &IopHardwareDatabaseKey;
|
|
||||||
Driver->DriverStart = ModuleObject->DllBase;
|
|
||||||
Driver->DriverSize = ModuleObject->SizeOfImage;
|
|
||||||
|
|
||||||
/* Set the driver as initialized */
|
/* Set the driver as initialized */
|
||||||
Driver->Flags |= DRVO_INITIALIZED;
|
Driver->Flags |= DRVO_INITIALIZED;
|
||||||
DeviceObject = Driver->DeviceObject;
|
DeviceObject = Driver->DeviceObject;
|
||||||
|
@ -1093,6 +1094,8 @@ NTAPI
|
||||||
IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
|
IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
|
||||||
IN PDRIVER_INITIALIZE InitializationFunction,
|
IN PDRIVER_INITIALIZE InitializationFunction,
|
||||||
IN PUNICODE_STRING RegistryPath,
|
IN PUNICODE_STRING RegistryPath,
|
||||||
|
IN PVOID DllBase,
|
||||||
|
IN ULONG SizeOfImage,
|
||||||
OUT PDRIVER_OBJECT *pDriverObject)
|
OUT PDRIVER_OBJECT *pDriverObject)
|
||||||
{
|
{
|
||||||
WCHAR NameBuffer[100];
|
WCHAR NameBuffer[100];
|
||||||
|
@ -1225,6 +1228,10 @@ try_again:
|
||||||
/* Close the extra handle */
|
/* Close the extra handle */
|
||||||
ZwClose(hDriver);
|
ZwClose(hDriver);
|
||||||
|
|
||||||
|
DriverObject->HardwareDatabase = &IopHardwareDatabaseKey;
|
||||||
|
DriverObject->DriverStart = DllBase;
|
||||||
|
DriverObject->DriverSize = SizeOfImage;
|
||||||
|
|
||||||
/* Finally, call its init function */
|
/* Finally, call its init function */
|
||||||
DPRINT("RegistryKey: %wZ\n", RegistryKey);
|
DPRINT("RegistryKey: %wZ\n", RegistryKey);
|
||||||
DPRINT("Calling driver entrypoint at %p\n", InitializationFunction);
|
DPRINT("Calling driver entrypoint at %p\n", InitializationFunction);
|
||||||
|
@ -1256,7 +1263,7 @@ IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
|
||||||
IN PDRIVER_INITIALIZE InitializationFunction)
|
IN PDRIVER_INITIALIZE InitializationFunction)
|
||||||
{
|
{
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
return IopCreateDriver(DriverName, InitializationFunction, NULL, &DriverObject);
|
return IopCreateDriver(DriverName, InitializationFunction, NULL, 0, 0, &DriverObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2022,7 +2022,6 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
|
||||||
DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
|
DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextDescription to device stack\n");
|
DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextDescription to device stack\n");
|
||||||
|
|
||||||
Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextDescription;
|
Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextDescription;
|
||||||
|
@ -2275,7 +2274,7 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* FIXME: Log the error */
|
/* 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);
|
&DeviceNode->InstancePath, Status);
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
|
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -2297,7 +2296,7 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("Got Service %S\n", Service->Buffer);
|
DPRINT("Got Service %S\n", Service->Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -3315,7 +3314,7 @@ PnpInit(VOID)
|
||||||
* Create root device node
|
* Create root device node
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Status = IopCreateDriver(NULL, PnpDriverInitializeEmpty, NULL, &IopRootDriverObject);
|
Status = IopCreateDriver(NULL, PnpDriverInitializeEmpty, NULL, 0, 0, &IopRootDriverObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
CPRINT("IoCreateDriverObject() failed\n");
|
CPRINT("IoCreateDriverObject() failed\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue