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.


Thank you for your help.  
Could you please help me write better codes for GUID?

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.



You are right. I was using USB. 
Based on your suggestion, I connected the SD drive directly to a PCI bus and 
set buf_fmt='HHLLLL'. However, I got another error message: (1, 
'DeviceIoControl', 'Incorrect function'). I think I did not use the function 
correctly.

Best,
Jane
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to