mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 00:54:18 +00:00
- 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. svn path=/trunk/; revision=26891
This commit is contained in:
parent
e0d8bd0a65
commit
5f53b128c9
1 changed files with 14 additions and 11 deletions
|
@ -83,7 +83,7 @@ IopDeleteDriver(IN PVOID ObjectBody)
|
||||||
if (DriverObject->DriverExtension->ServiceKeyName.Buffer)
|
if (DriverObject->DriverExtension->ServiceKeyName.Buffer)
|
||||||
{
|
{
|
||||||
/* Free it */
|
/* Free it */
|
||||||
//ExFreePool(DriverObject->DriverExtension->ServiceKeyName.Buffer);
|
ExFreePool(DriverObject->DriverExtension->ServiceKeyName.Buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,6 +443,7 @@ IopInitializeDriverModule(
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
DPRINT1("DriverEntry() returned Status=0x%08X\n", Status);
|
||||||
ObMakeTemporaryObject(Driver);
|
ObMakeTemporaryObject(Driver);
|
||||||
ObDereferenceObject(Driver);
|
ObDereferenceObject(Driver);
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1119,8 +1120,9 @@ IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
UNICODE_STRING ServiceKeyName;
|
UNICODE_STRING ServiceKeyName;
|
||||||
HANDLE hDriver;
|
HANDLE hDriver;
|
||||||
ULONG i;
|
ULONG i, RetryCount = 0;
|
||||||
|
|
||||||
|
try_again:
|
||||||
/* First, create a unique name for the driver if we don't have one */
|
/* First, create a unique name for the driver if we don't have one */
|
||||||
if (!DriverName)
|
if (!DriverName)
|
||||||
{
|
{
|
||||||
|
@ -1201,21 +1203,22 @@ IopCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL,
|
||||||
&ServiceKeyName,
|
&ServiceKeyName,
|
||||||
sizeof(UNICODE_STRING));
|
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 */
|
/* Add the Object and get its handle */
|
||||||
Status = ObInsertObject(DriverObject,
|
Status = ObInsertObject(DriverObject,
|
||||||
NULL,
|
NULL,
|
||||||
FILE_READ_DATA,
|
FILE_READ_DATA,
|
||||||
0,
|
OBJ_KERNEL_HANDLE,
|
||||||
NULL,
|
NULL,
|
||||||
&hDriver);
|
&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;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Now reference it */
|
/* Now reference it */
|
||||||
|
|
Loading…
Reference in a new issue