Re: [python-win32] DeviceIOControl using IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS fails with 'Incorrect function.'

2021-02-09 Thread Doug Campbell
Eryk, Again, you expand my knowledge! It seems so obvious now after reading what you wrote that I would not be able to get volume disk extents for a physical partition but yet this is what I wanted to do because I was attempting to find out the partition's offset on the disk. Now, I think I s

Re: [python-win32] DeviceIOControl using IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS fails with 'Incorrect function.'

2021-02-09 Thread Eryk Sun
On 2/9/21, Doug Campbell wrote: > > 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, > \\.\

[python-win32] DeviceIOControl using IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS fails with 'Incorrect function.'

2021-02-09 Thread Doug Campbell
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 win32file.DeviceIoControl(hDevice,winioctlcon.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, None, extents, None) pywintypes.error: (1

Re: [python-win32] DeviceIOControl calls respond with parameter incorrect

2021-02-09 Thread Eryk Sun
On 2/9/21, Doug Campbell wrote: > > That was exactly what I needed. I will have to read up on the _pack_ > directive to understand it but for now things are running the way they > should be. I'm glad I could help. Normally padding is added between fields of a struct in order to support aligned a

Re: [python-win32] DeviceIOControl calls respond with parameter incorrect

2021-02-09 Thread Doug Campbell
Thanks Eryk! That was exactly what I needed. I will have to read up on the _pack_ directive to understand it but for now things are running the way they should be. I did have one typo in what I originally pasted that made its way into what you provided. ('volumeID', ctypes.c_wchar * VOLUME_ID