mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[NTOS:IO]
- Correctly set DRIVER_EXTENSION::ServiceKeyName CORE-8566 #resolve svn path=/trunk/; revision=64343
This commit is contained in:
parent
f2bc2ef5ed
commit
22a86674c9
2 changed files with 30 additions and 24 deletions
|
@ -1058,6 +1058,7 @@ 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 PCUNICODE_STRING ServiceName,
|
||||||
PLDR_DATA_TABLE_ENTRY ModuleObject,
|
PLDR_DATA_TABLE_ENTRY ModuleObject,
|
||||||
OUT PDRIVER_OBJECT *pDriverObject);
|
OUT PDRIVER_OBJECT *pDriverObject);
|
||||||
|
|
||||||
|
|
|
@ -90,14 +90,12 @@ IopDeleteDriver(IN PVOID ObjectBody)
|
||||||
ExFreePool(DriverObject->DriverName.Buffer);
|
ExFreePool(DriverObject->DriverName.Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* See a bit of hack in IopCreateDriver */
|
|
||||||
/* Check if it has a service key name */
|
/* Check if it has a service key name */
|
||||||
if (DriverObject->DriverExtension->ServiceKeyName.Buffer)
|
if (DriverObject->DriverExtension->ServiceKeyName.Buffer)
|
||||||
{
|
{
|
||||||
/* Free it */
|
/* Free it */
|
||||||
ExFreePool(DriverObject->DriverExtension->ServiceKeyName.Buffer);
|
ExFreePool(DriverObject->DriverExtension->ServiceKeyName.Buffer);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
|
@ -516,6 +514,7 @@ IopInitializeDriverModule(
|
||||||
DriverName.Length > 0 ? &DriverName : NULL,
|
DriverName.Length > 0 ? &DriverName : NULL,
|
||||||
DriverEntry,
|
DriverEntry,
|
||||||
&RegistryKey,
|
&RegistryKey,
|
||||||
|
ServiceName,
|
||||||
ModuleObject,
|
ModuleObject,
|
||||||
&Driver);
|
&Driver);
|
||||||
RtlFreeUnicodeString(&RegistryKey);
|
RtlFreeUnicodeString(&RegistryKey);
|
||||||
|
@ -1479,6 +1478,7 @@ 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 PCUNICODE_STRING ServiceName,
|
||||||
PLDR_DATA_TABLE_ENTRY ModuleObject,
|
PLDR_DATA_TABLE_ENTRY ModuleObject,
|
||||||
OUT PDRIVER_OBJECT *pDriverObject)
|
OUT PDRIVER_OBJECT *pDriverObject)
|
||||||
{
|
{
|
||||||
|
@ -1550,9 +1550,9 @@ try_again:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the service key name buffer */
|
/* Set up the service key name buffer */
|
||||||
ServiceKeyName.Buffer = ExAllocatePoolWithTag(PagedPool,
|
ServiceKeyName.MaximumLength = ServiceName->Length + sizeof(UNICODE_NULL);
|
||||||
LocalDriverName.Length +
|
ServiceKeyName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
sizeof(WCHAR),
|
ServiceKeyName.MaximumLength,
|
||||||
TAG_IO);
|
TAG_IO);
|
||||||
if (!ServiceKeyName.Buffer)
|
if (!ServiceKeyName.Buffer)
|
||||||
{
|
{
|
||||||
|
@ -1562,21 +1562,26 @@ try_again:
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill out the key data and copy the buffer */
|
/* Copy the name and set it in the driver extension */
|
||||||
ServiceKeyName.Length = LocalDriverName.Length;
|
RtlCopyUnicodeString(&ServiceKeyName,
|
||||||
ServiceKeyName.MaximumLength = LocalDriverName.MaximumLength;
|
ServiceName);
|
||||||
RtlCopyMemory(ServiceKeyName.Buffer,
|
|
||||||
LocalDriverName.Buffer,
|
|
||||||
LocalDriverName.Length);
|
|
||||||
|
|
||||||
/* Null-terminate it and set it */
|
|
||||||
ServiceKeyName.Buffer[ServiceKeyName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
|
||||||
DriverObject->DriverExtension->ServiceKeyName = ServiceKeyName;
|
DriverObject->DriverExtension->ServiceKeyName = ServiceKeyName;
|
||||||
|
|
||||||
/* Also store it in the Driver Object. This is a bit of a hack. */
|
/* Make a copy of the driver name to store in the driver object */
|
||||||
RtlCopyMemory(&DriverObject->DriverName,
|
DriverObject->DriverName.MaximumLength = LocalDriverName.Length;
|
||||||
&ServiceKeyName,
|
DriverObject->DriverName.Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(UNICODE_STRING));
|
DriverObject->DriverName.MaximumLength,
|
||||||
|
TAG_IO);
|
||||||
|
if (!DriverObject->DriverName.Buffer)
|
||||||
|
{
|
||||||
|
/* Fail */
|
||||||
|
ObMakeTemporaryObject(DriverObject);
|
||||||
|
ObDereferenceObject(DriverObject);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlCopyUnicodeString(&DriverObject->DriverName,
|
||||||
|
&LocalDriverName);
|
||||||
|
|
||||||
/* Add the Object and get its handle */
|
/* Add the Object and get its handle */
|
||||||
Status = ObInsertObject(DriverObject,
|
Status = ObInsertObject(DriverObject,
|
||||||
|
@ -1678,7 +1683,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, NULL, &DriverObject);
|
return IopCreateDriver(DriverName, InitializationFunction, NULL, DriverName, NULL, &DriverObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue