mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 15:11:41 +00:00
Don't call DriverEntry more than once. Fix suggested by Filip Navara.
svn path=/trunk/; revision=14594
This commit is contained in:
parent
9a3b51ea9a
commit
40c9a57fa2
3 changed files with 51 additions and 15 deletions
|
@ -478,6 +478,7 @@ NTSTATUS FASTCALL
|
||||||
IopCreateDriverObject(
|
IopCreateDriverObject(
|
||||||
PDRIVER_OBJECT *DriverObject,
|
PDRIVER_OBJECT *DriverObject,
|
||||||
PUNICODE_STRING ServiceName,
|
PUNICODE_STRING ServiceName,
|
||||||
|
ULONG CreateAttributes,
|
||||||
BOOLEAN FileSystemDriver,
|
BOOLEAN FileSystemDriver,
|
||||||
PVOID DriverImageStart,
|
PVOID DriverImageStart,
|
||||||
ULONG DriverImageSize);
|
ULONG DriverImageSize);
|
||||||
|
|
|
@ -199,6 +199,7 @@ NTSTATUS FASTCALL
|
||||||
IopCreateDriverObject(
|
IopCreateDriverObject(
|
||||||
PDRIVER_OBJECT *DriverObject,
|
PDRIVER_OBJECT *DriverObject,
|
||||||
PUNICODE_STRING ServiceName,
|
PUNICODE_STRING ServiceName,
|
||||||
|
ULONG CreateAttributes,
|
||||||
BOOLEAN FileSystem,
|
BOOLEAN FileSystem,
|
||||||
PVOID DriverImageStart,
|
PVOID DriverImageStart,
|
||||||
ULONG DriverImageSize)
|
ULONG DriverImageSize)
|
||||||
|
@ -240,7 +241,7 @@ IopCreateDriverObject(
|
||||||
InitializeObjectAttributes(
|
InitializeObjectAttributes(
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&DriverName,
|
&DriverName,
|
||||||
OBJ_PERMANENT,
|
CreateAttributes | OBJ_PERMANENT,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@ -265,9 +266,14 @@ IopCreateDriverObject(
|
||||||
Object->DriverSize = DriverImageSize;
|
Object->DriverSize = DriverImageSize;
|
||||||
if (Buffer)
|
if (Buffer)
|
||||||
{
|
{
|
||||||
Object->DriverName.Buffer = Buffer;
|
if (!Object->DriverName.Buffer)
|
||||||
Object->DriverName.Length = Object->DriverName.MaximumLength = DriverName.Length;
|
{
|
||||||
RtlCopyMemory(Object->DriverName.Buffer, DriverName.Buffer, DriverName.Length);
|
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;
|
*DriverObject = Object;
|
||||||
|
@ -479,7 +485,7 @@ IopLoadServiceModule(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT("Module already loaded\n");
|
DPRINT("Module already loaded\n");
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_IMAGE_ALREADY_LOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlFreeUnicodeString(&ServiceImagePath);
|
RtlFreeUnicodeString(&ServiceImagePath);
|
||||||
|
@ -538,6 +544,7 @@ IopInitializeDriverModule(
|
||||||
Status = IopCreateDriverObject(
|
Status = IopCreateDriverObject(
|
||||||
DriverObject,
|
DriverObject,
|
||||||
ServiceName,
|
ServiceName,
|
||||||
|
0,
|
||||||
FileSystemDriver,
|
FileSystemDriver,
|
||||||
ModuleObject->Base,
|
ModuleObject->Base,
|
||||||
ModuleObject->Length);
|
ModuleObject->Length);
|
||||||
|
@ -614,13 +621,29 @@ IopAttachFilterDriversCallback(
|
||||||
|
|
||||||
/* Load and initialize the filter driver */
|
/* Load and initialize the filter driver */
|
||||||
Status = IopLoadServiceModule(&ServiceName, &ModuleObject);
|
Status = IopLoadServiceModule(&ServiceName, &ModuleObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (Status != STATUS_IMAGE_ALREADY_LOADED)
|
||||||
continue;
|
{
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
continue;
|
||||||
|
|
||||||
Status = IopInitializeDriverModule(DeviceNode, ModuleObject, &ServiceName,
|
Status = IopInitializeDriverModule(DeviceNode, ModuleObject, &ServiceName,
|
||||||
FALSE, &DriverObject);
|
FALSE, &DriverObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
continue;
|
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);
|
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -1499,10 +1499,22 @@ IopActionInitChildServices(
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
|
|
||||||
Status = IopLoadServiceModule(&DeviceNode->ServiceName, &ModuleObject);
|
Status = IopLoadServiceModule(&DeviceNode->ServiceName, &ModuleObject);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED)
|
||||||
{
|
{
|
||||||
Status = IopInitializeDriverModule(DeviceNode, ModuleObject,
|
if (Status != STATUS_IMAGE_ALREADY_LOADED)
|
||||||
&DeviceNode->ServiceName, FALSE, &DriverObject);
|
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))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Attach lower level filter drivers. */
|
/* Attach lower level filter drivers. */
|
||||||
|
@ -1787,7 +1799,7 @@ PnpInit(VOID)
|
||||||
* Create root device node
|
* Create root device node
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Status = IopCreateDriverObject(&IopRootDriverObject, NULL, FALSE, NULL, 0);
|
Status = IopCreateDriverObject(&IopRootDriverObject, NULL, 0, FALSE, NULL, 0);
|
||||||
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