Python Win32 API question.

yaipa h. yaipa at yahoo.com
Tue Dec 31 19:27:58 EST 2002


All,

 Good Cheer and Happy Holidays. In Mark Hammond's win32 toolkit there is
a device I/O control method (win32file.DeviceIoControl). Has anyone had
a chance to use it? If so could you provide an example of it in action.

Also, the parameter 'dwIoControlCode' is said to use an IO control code,
but none are listed and this library does not hold to the MFC library's
naming convention so no chance on looking it up. :(

Finally, for the big points. Anyone belive that I will be able to use
any of the 'IOCTL_*' enumerated values from the MFC toolkit with the 
win32file.DeviceIoControl library method? It's looking more and more 
like I will need to call a COM/DLL from my Python code to get this info. :((

Thanks. An example IOCTL_ follows.

Yaipa.h

'IOCTL_DISK_GET_DRIVE_GEOMETRY' Operation
-------------------------------------------
Returns information about the physical disk's geometry 
(media type, number of cylinders, tracks per cylinder, 
sectors per track, and bytes per sector).

win32file Function Header
-------------------------
string = DeviceIoControl(hFile, dwIoControlCode , data , readSize , ol )

Call DeviceIoControl Parameters
-------------------------------
hFile           : int
 # Handle to the file

dwIoControlCode : int 
 # IOControl Code to use.

data            : string
 # The data to write.

readSize        : int
 # Size of the buffer to create for the read.

ol=None         : PyOVERLAPPED
 # An overlapped structure




More information about the Python-list mailing list