- Fix string length calculation

svn path=/trunk/; revision=53250
This commit is contained in:
Cameron Gutman 2011-08-15 03:20:17 +00:00
parent a92715a798
commit 3efa379202

View file

@ -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),