Re: DeviceIOControl using IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS fails with 'Incorrect function.'

Dennis Lee Bieber <[email protected]>
Newsgroups gmane.comp.python.windows
Organization IISS Elusive Unicorn
Message-ID <[email protected]>
On Tue, 9 Feb 2021 21:27:06 +0000, Doug Campbell
<[email protected]> declaimed the following:

>I am trying to get the disk extents given a disk number but I am getting back the following error.
>
>Traceback (most recent call last):
>  File "test2.py", line 29, in <module>
>    win32file.DeviceIoControl(hDevice,winioctlcon.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, None, extents, None)
>pywintypes.error: (1, 'DeviceIoControl', 'Incorrect function.')
>
>I have tried with all three of the disks on my system:  \\.\PhysicalDrive0, \\.\PhysicalDrive1, and \\.\PhyscialDrive2 but the results are always the same.

	May not be relevant, but
https://docs.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-deviceiocontrol
shows only a single \
	\.\PhysicalDrive0, \.\PhysicalDrive1, and so on,
though I've not tried myself... Do you have a valid handle at all?


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	[email protected]    http://wlfraed.microdiversity.freeddns.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.