[python-win32] Finding the physical USBSTOR disk size

Tim Golden mail at timgolden.me.uk
Mon Mar 22 11:09:49 CET 2010


On 19/03/2010 10:30, Chris Jesse wrote:
> I am trying to use WMI in order to get information about drives so
>The problem that we are having is that we can't seem to get an accurate
>size for the disks.

> I know that in the past we were able to do so, using the Win32_Diskpartition
> Size property but have recently found that this is no longer the case as it is
> inaccurate. We believe this is because we may not have tested it with a FAT
> formatted media before.

I'm not going to be much help here, I'm afraid, except to suggest that
the likely API for this is going to be one of the DeviceIOControl
functions:

   http://msdn.microsoft.com/en-us/library/aa363216%28VS.85%29.aspx

   http://timgolden.me.uk/pywin32-docs/win32file__DeviceIoControl_meth.html

In principle, the parents of the Win32_LogicalDisk clsas (CIM_LogicalDisk,
CIM_StorageExtent) should offer access to the lower-level data which
makes up the Size attributes. But it doesn't seem to be implemented that
way; they simply return None.

TJG


More information about the python-win32 mailing list