mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Fixed the length calculation of some unicode strings.
svn path=/trunk/; revision=6417
This commit is contained in:
parent
9bb05f0dc5
commit
360e3be08a
1 changed files with 14 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: driver.c,v 1.27 2003/10/16 17:59:48 navaraf Exp $
|
/* $Id: driver.c,v 1.28 2003/10/23 19:16:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -149,6 +149,7 @@ IopCreateGroupListEntry(PWSTR ValueName,
|
||||||
if (!RtlCreateUnicodeString(&Group->GroupName,
|
if (!RtlCreateUnicodeString(&Group->GroupName,
|
||||||
(PWSTR)ValueData))
|
(PWSTR)ValueData))
|
||||||
{
|
{
|
||||||
|
ExFreePool(Group);
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,10 +731,10 @@ IopGetDriverNameFromServiceKey(
|
||||||
{
|
{
|
||||||
ServiceName++;
|
ServiceName++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImagePath->Length = sizeof(UNICODE_NULL) +
|
ImagePath->Length = (33 + wcslen(ServiceName)) * sizeof(WCHAR);
|
||||||
((33 + wcslen(ServiceName)) * sizeof(WCHAR));
|
ImagePath->MaximumLength = ImagePath->Length + sizeof(UNICODE_NULL);
|
||||||
ImagePath->Buffer = ExAllocatePool(NonPagedPool, ImagePath->Length);
|
ImagePath->Buffer = ExAllocatePool(NonPagedPool, ImagePath->MaximumLength);
|
||||||
if (ImagePath->Buffer == NULL)
|
if (ImagePath->Buffer == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
@ -744,9 +745,9 @@ IopGetDriverNameFromServiceKey(
|
||||||
} else
|
} else
|
||||||
if (RegistryImagePath.Buffer[0] != L'\\')
|
if (RegistryImagePath.Buffer[0] != L'\\')
|
||||||
{
|
{
|
||||||
ImagePath->Length = sizeof(UNICODE_NULL) +
|
ImagePath->Length = (12 + wcslen(RegistryImagePath.Buffer)) * sizeof(WCHAR);
|
||||||
((12 + wcslen(RegistryImagePath.Buffer)) * sizeof(WCHAR));
|
ImagePath->MaximumLength = ImagePath->Length + sizeof(UNICODE_NULL);
|
||||||
ImagePath->Buffer = ExAllocatePool(NonPagedPool, ImagePath->Length);
|
ImagePath->Buffer = ExAllocatePool(NonPagedPool, ImagePath->MaximumLength);
|
||||||
if (ImagePath->Buffer == NULL)
|
if (ImagePath->Buffer == NULL)
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&RegistryImagePath);
|
RtlFreeUnicodeString(&RegistryImagePath);
|
||||||
|
@ -758,6 +759,7 @@ IopGetDriverNameFromServiceKey(
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ImagePath->Length = RegistryImagePath.Length;
|
ImagePath->Length = RegistryImagePath.Length;
|
||||||
|
ImagePath->MaximumLength = RegistryImagePath.MaximumLength;
|
||||||
ImagePath->Buffer = RegistryImagePath.Buffer;
|
ImagePath->Buffer = RegistryImagePath.Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,11 +920,12 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
|
||||||
/*
|
/*
|
||||||
* Construct the driver object name
|
* Construct the driver object name
|
||||||
*/
|
*/
|
||||||
ObjectName.Length = wcslen(Start) + 8;
|
ObjectName.Length = (wcslen(Start) + 8) * sizeof(WCHAR);
|
||||||
ObjectName.Buffer = ExAllocatePool(NonPagedPool,
|
ObjectName.MaximumLength = ObjectName.Length + sizeof(WCHAR);
|
||||||
ObjectName.Length * sizeof(WCHAR));
|
ObjectName.Buffer = ExAllocatePool(NonPagedPool, ObjectName.MaximumLength);
|
||||||
wcscpy(ObjectName.Buffer, L"\\Driver\\");
|
wcscpy(ObjectName.Buffer, L"\\Driver\\");
|
||||||
memcpy(ObjectName.Buffer + 8, Start, (ObjectName.Length - 8) * sizeof(WCHAR));
|
memcpy(ObjectName.Buffer + 8, Start, (ObjectName.Length - 8) * sizeof(WCHAR));
|
||||||
|
ObjectName.Buffer[ObjectName.Length/sizeof(WCHAR)] = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the driver object
|
* Find the driver object
|
||||||
|
|
Loading…
Reference in a new issue