Author: fireball
Date: Fri May 25 17:52:58 2007
New Revision: 26891
URL:
http://svn.reactos.org/svn/reactos?rev=26891&view=rev
Log:
- Remove a hack from IopCreateDriver(), no boot hang happens in VMWare without it
anymore.
- Uncomment a ExFreePool() in a Delete routine for Driver object type, should prevent a
possible memory leak (was commented due to the previous hack).
- Added a small piece of a new logic into IopCreateDriver(). In ReactOS it's being
called two times almost immediately, which results in a non-unique driver object name,
since KeTickCount is the same. In order to prevent this situation a loop is added, having
100 iterations as max.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/driver.c
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 Fri May 25 17:52:58 2007
@@ -83,7 +83,7 @@
if (DriverObject->DriverExtension->ServiceKeyName.Buffer)
{
/* Free it */
- //ExFreePool(DriverObject->DriverExtension->ServiceKeyName.Buffer);
+ ExFreePool(DriverObject->DriverExtension->ServiceKeyName.Buffer);
}
}
@@ -443,6 +443,7 @@
if (!NT_SUCCESS(Status))
{
+ DPRINT1("DriverEntry() returned Status=0x%08X\n", Status);
ObMakeTemporaryObject(Driver);
ObDereferenceObject(Driver);
return Status;
@@ -1119,8 +1120,9 @@
PDRIVER_OBJECT DriverObject;
UNICODE_STRING ServiceKeyName;
HANDLE hDriver;
- ULONG i;
-
+ ULONG i, RetryCount = 0;
+
+try_again:
/* First, create a unique name for the driver if we don't have one */
if (!DriverName)
{
@@ -1201,21 +1203,22 @@
&ServiceKeyName,
sizeof(UNICODE_STRING));
- if (!DriverName)
- {
- /* HACK: Something goes wrong in next lines in this case.
- * Just leave to prevent a freeze */
- *pDriverObject = DriverObject;
- return Status;
- }
-
/* Add the Object and get its handle */
Status = ObInsertObject(DriverObject,
NULL,
FILE_READ_DATA,
- 0,
+ OBJ_KERNEL_HANDLE,
NULL,
&hDriver);
+
+ /* Eliminate small possibility when this function is called more than
+ once in a row, and KeTickCount doesn't get enough time to change */
+ if (!DriverName && (Status == STATUS_OBJECT_NAME_COLLISION) &&
(RetryCount < 100))
+ {
+ RetryCount++;
+ goto try_again;
+ }
+
if (!NT_SUCCESS(Status)) return Status;
/* Now reference it */