IoGetDeviceObjectPointer return STATUS_OBJECT_NAME_NOT_FOUND

Hi All,
I am calling IoGetDeviceObjectPointer to get the dynamic disk volume object, the api return STATUS_OBJECT_NAME_NOT_FOUND.

The API return success for basic disk partition but fails for dynamic disk volume.

My code is here,

PFILE_OBJECT pFileObject;
PDEVICE_OBJECT pPartitionDeviceObject;
UNICODE_STRING UnicodeString = L"\Device\Harddisk2\Partition1";
status = IoGetDeviceObjectPointer(&UnicodeString,FILE_READ_ATTRIBUTES,&pFileObject,&pPartitionDeviceObject);

here Harddisk2 is dynamic disk.

any help is greatly appreciated, thanks in advance.

Regards
Sharan

Sorry to ask the obvious question, but you’ve confirmed that there’s a device object of the name “\Device\Harddisk2\Partition1” in the system?

Peter
OSR