mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
Don't call DriverEntry more than once. Fix suggested by Filip Navara.
svn path=/trunk/; revision=14594
This commit is contained in:
@@ -478,6 +478,7 @@ NTSTATUS FASTCALL
|
||||
IopCreateDriverObject(
|
||||
PDRIVER_OBJECT *DriverObject,
|
||||
PUNICODE_STRING ServiceName,
|
||||
ULONG CreateAttributes,
|
||||
BOOLEAN FileSystemDriver,
|
||||
PVOID DriverImageStart,
|
||||
ULONG DriverImageSize);
|
||||
|
||||
@@ -199,6 +199,7 @@ NTSTATUS FASTCALL
|
||||
IopCreateDriverObject(
|
||||
PDRIVER_OBJECT *DriverObject,
|
||||
PUNICODE_STRING ServiceName,
|
||||
ULONG CreateAttributes,
|
||||
BOOLEAN FileSystem,
|
||||
PVOID DriverImageStart,
|
||||
ULONG DriverImageSize)
|
||||
@@ -240,7 +241,7 @@ IopCreateDriverObject(
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&DriverName,
|
||||
OBJ_PERMANENT,
|
||||
CreateAttributes | OBJ_PERMANENT,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
@@ -265,9 +266,14 @@ IopCreateDriverObject(
|
||||
Object->DriverSize = DriverImageSize;
|
||||
if (Buffer)
|
||||
{
|
||||
Object->DriverName.Buffer = Buffer;
|
||||
Object->DriverName.Length = Object->DriverName.MaximumLength = DriverName.Length;
|
||||
RtlCopyMemory(Object->DriverName.Buffer, DriverName.Buffer, DriverName.Length);
|
||||
if (!Object->DriverName.Buffer)
|
||||
{
|
||||
Object->DriverName.Buffer = Buffer;
|
||||
Object->DriverName.Length = Object->DriverName.MaximumLength = DriverName.Length;
|
||||
RtlCopyMemory(Object->DriverName.Buffer, DriverName.Buffer, DriverName.Length);
|
||||
}
|
||||
else
|
||||
ExFreePool(Buffer);
|
||||
}
|
||||
|
||||
*DriverObject = Object;
|
||||
@@ -479,7 +485,7 @@ IopLoadServiceModule(
|
||||
else
|
||||
{
|
||||
DPRINT("Module already loaded\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
Status = STATUS_IMAGE_ALREADY_LOADED;
|
||||
}
|
||||
|
||||
RtlFreeUnicodeString(&ServiceImagePath);
|
||||
@@ -538,6 +544,7 @@ IopInitializeDriverModule(
|
||||
Status = IopCreateDriverObject(
|
||||
DriverObject,
|
||||
ServiceName,
|
||||
0,
|
||||
FileSystemDriver,
|
||||
ModuleObject->Base,
|
||||
ModuleObject->Length);
|
||||
@@ -614,13 +621,29 @@ IopAttachFilterDriversCallback(
|
||||
|
||||
/* Load and initialize the filter driver */
|
||||
Status = IopLoadServiceModule(&ServiceName, &ModuleObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
if (Status != STATUS_IMAGE_ALREADY_LOADED)
|
||||
{
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
|
||||
Status = IopInitializeDriverModule(DeviceNode, ModuleObject, &ServiceName,
|
||||
FALSE, &DriverObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
Status = IopInitializeDriverModule(DeviceNode, ModuleObject, &ServiceName,
|
||||
FALSE, &DriverObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get existing DriverObject pointer */
|
||||
Status = IopCreateDriverObject(
|
||||
&DriverObject,
|
||||
&ServiceName,
|
||||
OBJ_OPENIF,
|
||||
FALSE,
|
||||
ModuleObject->Base,
|
||||
ModuleObject->Length);
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
||||
@@ -1499,10 +1499,22 @@ IopActionInitChildServices(
|
||||
PDRIVER_OBJECT DriverObject;
|
||||
|
||||
Status = IopLoadServiceModule(&DeviceNode->ServiceName, &ModuleObject);
|
||||
if (NT_SUCCESS(Status))
|
||||
if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED)
|
||||
{
|
||||
Status = IopInitializeDriverModule(DeviceNode, ModuleObject,
|
||||
&DeviceNode->ServiceName, FALSE, &DriverObject);
|
||||
if (Status != STATUS_IMAGE_ALREADY_LOADED)
|
||||
Status = IopInitializeDriverModule(DeviceNode, ModuleObject,
|
||||
&DeviceNode->ServiceName, FALSE, &DriverObject);
|
||||
else
|
||||
{
|
||||
/* get existing DriverObject pointer */
|
||||
Status = IopCreateDriverObject(
|
||||
&DriverObject,
|
||||
&DeviceNode->ServiceName,
|
||||
OBJ_OPENIF,
|
||||
FALSE,
|
||||
ModuleObject->Base,
|
||||
ModuleObject->Length);
|
||||
}
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Attach lower level filter drivers. */
|
||||
@@ -1787,7 +1799,7 @@ PnpInit(VOID)
|
||||
* Create root device node
|
||||
*/
|
||||
|
||||
Status = IopCreateDriverObject(&IopRootDriverObject, NULL, FALSE, NULL, 0);
|
||||
Status = IopCreateDriverObject(&IopRootDriverObject, NULL, 0, FALSE, NULL, 0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CPRINT("IoCreateDriverObject() failed\n");
|
||||
|
||||
Reference in New Issue
Block a user