Re: [PATCH v3] ntoskrnl.exe: Implement IoGetDeviceProperty for DevicePropertyPhysicalDeviceObjectName
Aric Stewart <aric(a)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. -- Alexandre Julliard julliard(a)winehq.org
On 1/29/16 8:29 AM, Alexandre Julliard wrote:
Aric Stewart <aric(a)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.
Sorry you are correct I am trying to focus on too many divergent things at once and my brain has stated to turn to mush. -aric
participants (2)
-
Alexandre Julliard -
Aric Stewart