[python-win32] Handle to a Driver
timr at probo.com
Mon Apr 4 18:37:04 CEST 2005
On Sun, 03 Apr 2005 13:32:01 +0200, Chi Tai <me at chi-tai.info> wrote:
>i've found the faulty.
>For those interested in: win32file.DeviceIoControl transfers a string or
>character array, thus a numerical value like a handle is also transfered
>as a character array and the cast operation within the driver does not
>result in a valid handle.
Right. In this case, the ioctl wants a 4-byte integer value.
win32event.CreateEvent returns a PyHANDLE object. The PyHANDLE object
includes a property called "handle", menmonically enough, that returns
the 4-byte integer value.
Thus, this should do what you want:
ret = DeviceIoControl( hDevice, IOCTL_SET_READ_EVENT,
ReadEvent.handle, 0, None )
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32