[python-win32] Finding the physical USBSTOR disk size

Chris Jesse chris.jesse at flightdataservices.com
Mon Mar 22 12:41:23 CET 2010


Thanks Tim, 

Shame about the None returns; I keep on bumping up against these! 

I'm currently going for the over-read exception - a bit like over-kill, we read beyond the size reported in the smallest block size chunks (512 bytes) until an exception is raised. It does mean we will get 101% read progress reports and a slight delay at the end of our progress bar, but much like progress reported by Microsoft Minutes, it's an inaccuracy we can live with. 

Thanks for help, Chris. 

----- Original Message ----- 
From: "Tim Golden" <mail at timgolden.me.uk> 
Cc: "Python win32 User List" <python-win32 at python.org> 
Sent: Monday, 22 March, 2010 10:09:49 GMT +00:00 GMT Britain, Ireland, Portugal 
Subject: Re: [python-win32] Finding the physical USBSTOR disk size 

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 
_______________________________________________ 
python-win32 mailing list 
python-win32 at python.org 
http://mail.python.org/mailman/listinfo/python-win32 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100322/a08e0f59/attachment.html>


More information about the python-win32 mailing list