From 3efa379202079326dc527295613ff7d9d0051ebd Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 15 Aug 2011 03:20:17 +0000 Subject: [PATCH] [HAL] - Fix string length calculation svn path=/trunk/; revision=53250 --- reactos/hal/halx86/generic/acpi/halpnpdd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reactos/hal/halx86/generic/acpi/halpnpdd.c b/reactos/hal/halx86/generic/acpi/halpnpdd.c index 815230debdf..4dc4177b9b7 100644 --- a/reactos/hal/halx86/generic/acpi/halpnpdd.c +++ b/reactos/hal/halx86/generic/acpi/halpnpdd.c @@ -492,16 +492,12 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, /* Unknown */ return STATUS_NOT_SUPPORTED; } - - /* Static length */ - Length = 32; break; case BusQueryInstanceID: /* And our instance ID */ Id = L"0"; - Length = sizeof(L"0") + sizeof(UNICODE_NULL); break; case BusQueryCompatibleIDs: @@ -511,6 +507,9 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, return STATUS_NOT_SUPPORTED; } + /* Calculate the length */ + Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); + /* Allocate the buffer */ Buffer = ExAllocatePoolWithTag(PagedPool, Length + sizeof(UNICODE_NULL), @@ -556,14 +555,12 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, /* This is our hardware ID */ Id = HalHardwareIdString; - Length = wcslen(HalHardwareIdString) + sizeof(UNICODE_NULL); break; case BusQueryInstanceID: /* And our instance ID */ Id = L"0"; - Length = sizeof(L"0") + sizeof(UNICODE_NULL); break; default: @@ -572,6 +569,9 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, return STATUS_NOT_SUPPORTED; } + /* Calculate the length */ + Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); + /* Allocate the buffer */ Buffer = ExAllocatePoolWithTag(PagedPool, Length + sizeof(UNICODE_NULL),