My bad. I should use 'Q' instead of 'LL'. Thank you Tim!
Jane
Jane Chen wrote:
> Hi all,
> I would like to get total sector number of my disk. However, I found that I
> cannot get 8G sectors because of the buffer size.
> I only got 4G.
>
> buf_fmt='LL'
> buf_size=struct.calcsize(buf_fmt)
> buf=win32file.DeviceIoControl(h,
>winioctlcon.IOCTL_DISK_GET_LENGTH_INFO, None, buf_size, None)
> Could someone please tell me how to get the total sector number?
I'm not sure what you mean here. IOCTL_DISK_GET_LENGTH_INFO doesn't
return sectors -- it returns bytes, and it returns them as a 64-bit
integer. That will hold almost 2 exabytes, about a million times larger
than any hard disks that exist today.
If you follow that sequence with
print struct.unpack('Q',buf)[0]
you should see the length in bytes.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32