Aric Stewart aric@codeweavers.com writes:
case DevicePropertyPhysicalDeviceObjectName:{ULONG used_len;OBJECT_NAME_INFORMATION *name = HeapAlloc(GetProcessHeap(), 0, buffer_length + (sizeof(OBJECT_NAME_INFORMATION)));status = NtQueryObject(device->Reserved, ObjectNameInformation, name, buffer_length + sizeof(OBJECT_NAME_INFORMATION), &used_len);if (status == STATUS_SUCCESS){memcpy(property_buffer, name->Name.Buffer, name->Name.Length);*result_length = name->Name.Length;}else*result_length = 0;
Length is still not correct if the buffer is too small, and the string needs to be null-terminated.