[python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?
Jane Chen
janechen_1979 at yahoo.com
Tue Jul 17 21:46:54 CEST 2012
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.
IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL = CTL_CODE( FILE_DEVICE_DISK, 0x7a0, METHOD_BUFFERED, FILE_ANY_ACCESS)
GUID_SFF_PROTOCOL_SD = pywintypes.IID("{AD7536A8-D055-4C40-AA4D-96312DDB6B38}")
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)
hVol=win32file.CreateFile(drive,win32con.GENERIC_READ,
win32file.FILE_SHARE_READ | win32file.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING,
win32con.FILE_ATTRIBUTE_NORMAL,None)
buf=win32file.DeviceIoControl(hVol, winioctlcon.IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL,None,buf_size,None) size_SFFDISK, reserved_SFFDISK, protocolGUID_SFFDISK=struct.unpack(buf_fmt, buf)Regards,
Jane----------------------------------------------------------------------
Message: 1
Date: Mon, 16 Jul 2012 21:54:03 -0400
From: "Roger Upole" <rupole at hotmail.com>
To: python-win32 at python.org
Subject: Re: [python-win32] Does pywin32 support SD card
operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?
Message-ID: <ju2gkl$n3l$1 at dough.gmane.org>
That one isn't in winioctlcon.py yet, but you should be able to
define it relatively easily. According to the headers:
#define IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL \
CTL_CODE( FILE_DEVICE_DISK, 0x7a0, METHOD_BUFFERED, FILE_ANY_ACCESS)
You'll probably need to create the output buffer yourself and initialize the Size correctly.
typedef struct _SFFDISK_QUERY_DEVICE_PROTOCOL_DATA {
USHORT Size;
USHORT Reserved;
GUID ProtocolGUID;
}
Roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120717/e0264dca/attachment-0001.html>
More information about the python-win32
mailing list