[python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

Tim Roberts timr at probo.com
Tue Jul 17 23:58:57 CEST 2012


Jane Chen wrote:
>
> Thank you for your help. However, I still got pywintypes.error: (50,
> "DeviceIoControl", "The request is not supported"). 
>
>  I added the following codes to winioctlcon.py <http://winioctlcon.py/>.

You should not probably modify the standard library files, because
you'll lose the change when you upgrade.  You should add this to your
own file.

>
> I added the following codes to my script
> import win32con, winioctlcon
> """
> Definition of buffer used with _SFFDISK_QUERY_DEVICE_PROTOCOL_DATA:
> typedef struct _SFFDISK_QUERY_DEVICE_PROTOCOL_DATA {
>   USHORT Size;
>   USHORT Reserved;
>   GUID  ProtocolGUID;
> }
> """
> buf_fmt='HHs0L'   
> buf_size=struct.calcsize(buf_fmt)

Your buf_fmt is not correct.  GUID is not a string, it is a 16-byte
binary GUID.  You want 'HHLLLL' -- the buf_size should be 20.  Plus, you
really don't want "struct" to unpack the GUID.  It doesn't know that type.

However, that's not your fundamental problem.  My guess is that you are
trying to call this for an SD disk that is plugged into a USB adapter. 
If so, that won't work, because the operating system doesn't see it as
an SD disk, it sees it as a USB disk.  It has to be an SD drive
connected directly to a PCI bus, and those are usually only found on
laptops.  The error message is exactly right -- the request is not
supported.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list