IOCTL_STORAGE_QUERY_PROPERTY with dynamic disk

Does IOCTL_STORAGE_QUERY_PROPERTY work with dynamic disks? With the
following code, my DeviceIoControl() call returns successfully with basic
disks; however, it receives an ERROR_INVALID_PARAMETER (87) when accessing
dynamic disks. Any suggestions would be most welcome.

Cheers,
Steve

int DeviceType(WCHAR DriveLetter, STORAGE_BUS_TYPE *Type)
{
HANDLE fd;
WCHAR Path = L"\\.\c:";
STORAGE_PROPERTY_QUERY Property;
STORAGE_DEVICE_DESCRIPTOR Descriptor;
DWORD s;

Path[4] = DriveLetter;
fd = CreateFileW(Path, GENERIC_READ, 0,
NULL, OPEN_EXISTING, 0, NULL);
if (fd == INVALID_HANDLE_VALUE)
{
myError(L"Error opening device.", GetLastError());
return(-1);
}

Property.QueryType = PropertyStandardQuery;
Property.PropertyId = StorageDeviceProperty;

if (DeviceIoControl(fd, IOCTL_STORAGE_QUERY_PROPERTY,
&Property, sizeof(Property), &Descriptor, sizeof(Descriptor), &s,
NULL) == 0)
{
MyError(L"Error retrieving device type.", GetLastError());
CloseHandle(fd);
return(-1);
}

*Type = Descriptor.BusType;
CloseHandle(fd);
return(0);
}

No, it doesn’t. DMIO is aggregating several disks together into a
volume and their characteristics won’t all be the same - it doesn’t
attempt to merge them.

You can open the physical disk device object and query it, if you have
permissions to perform raw disk operations.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Steve Soltis
Sent: Friday, July 16, 2004 5:16 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] IOCTL_STORAGE_QUERY_PROPERTY with dynamic disk

Does IOCTL_STORAGE_QUERY_PROPERTY work with dynamic disks? With the
following code, my DeviceIoControl() call returns successfully with
basic disks; however, it receives an ERROR_INVALID_PARAMETER (87) when
accessing dynamic disks. Any suggestions would be most welcome.

Cheers,
Steve

int DeviceType(WCHAR DriveLetter, STORAGE_BUS_TYPE *Type) {
HANDLE fd;
WCHAR Path = L"\\.\c:";
STORAGE_PROPERTY_QUERY Property;
STORAGE_DEVICE_DESCRIPTOR Descriptor;
DWORD s;

Path[4] = DriveLetter;
fd = CreateFileW(Path, GENERIC_READ, 0,
NULL, OPEN_EXISTING, 0, NULL);
if (fd == INVALID_HANDLE_VALUE)
{
myError(L"Error opening device.", GetLastError());
return(-1);
}

Property.QueryType = PropertyStandardQuery;
Property.PropertyId = StorageDeviceProperty;

if (DeviceIoControl(fd, IOCTL_STORAGE_QUERY_PROPERTY,
&Property, sizeof(Property), &Descriptor, sizeof(Descriptor),
&s,
NULL) == 0)
{
MyError(L"Error retrieving device type.", GetLastError());
CloseHandle(fd);
return(-1);
}

*Type = Descriptor.BusType;
CloseHandle(fd);
return(0);
}


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com