mirror of
https://github.com/reactos/reactos.git
synced 2024-07-07 05:05:09 +00:00
[FREELDR]
- Allocate enough memory for unicode strings svn path=/trunk/; revision=52494
This commit is contained in:
parent
53d165e2ae
commit
a92db0cc1d
|
@ -711,7 +711,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
{
|
||||
PBOOT_DRIVER_LIST_ENTRY BootDriverEntry;
|
||||
NTSTATUS Status;
|
||||
ULONG PathLength;
|
||||
USHORT PathLength;
|
||||
|
||||
BootDriverEntry = MmHeapAlloc(sizeof(BOOT_DRIVER_LIST_ENTRY));
|
||||
|
||||
|
@ -726,10 +726,10 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
if (ImagePath && (wcslen(ImagePath) > 0))
|
||||
{
|
||||
// Just copy ImagePath to the corresponding field in the structure
|
||||
PathLength = wcslen(ImagePath) * sizeof(WCHAR);
|
||||
PathLength = wcslen(ImagePath) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
||||
|
||||
BootDriverEntry->FilePath.Length = 0;
|
||||
BootDriverEntry->FilePath.MaximumLength = PathLength + sizeof(WCHAR);
|
||||
BootDriverEntry->FilePath.MaximumLength = PathLength;
|
||||
BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength);
|
||||
|
||||
if (!BootDriverEntry->FilePath.Buffer)
|
||||
|
@ -751,7 +751,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
// we have to construct ImagePath ourselves
|
||||
PathLength = wcslen(ServiceName)*sizeof(WCHAR) + sizeof(L"system32\\drivers\\.sys");
|
||||
BootDriverEntry->FilePath.Length = 0;
|
||||
BootDriverEntry->FilePath.MaximumLength = PathLength+sizeof(WCHAR);
|
||||
BootDriverEntry->FilePath.MaximumLength = PathLength;
|
||||
BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength);
|
||||
|
||||
if (!BootDriverEntry->FilePath.Buffer)
|
||||
|
@ -786,9 +786,9 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
}
|
||||
|
||||
// Add registry path
|
||||
PathLength = (wcslen(RegistryPath)+wcslen(ServiceName))*sizeof(WCHAR);
|
||||
PathLength = (wcslen(RegistryPath) + wcslen(ServiceName))*sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
||||
BootDriverEntry->RegistryPath.Length = 0;
|
||||
BootDriverEntry->RegistryPath.MaximumLength = PathLength;//+sizeof(WCHAR);
|
||||
BootDriverEntry->RegistryPath.MaximumLength = PathLength;
|
||||
BootDriverEntry->RegistryPath.Buffer = MmHeapAlloc(PathLength);
|
||||
if (!BootDriverEntry->RegistryPath.Buffer)
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue