Re: [python-win32] Handle to a Driver

2005-04-04 Thread Tim Roberts
Chi Tai wrote: Cool, thanks a lot :) this is absolutely the better solution. The "struct" module is a very helpful tool when you're doing Win32 API programming like this, especially with the new changes that make it more difficult to manipulate binary values as dwords. It would be worth your

Re: [python-win32] Handle to a Driver

2005-04-04 Thread Chi Tai
Cool, thanks a lot :) this is absolutely the better solution. Chi-Tai Tim Roberts schrieb: Chi Tai wrote: > Thanks Tim, > > i also tried this, but this call returns the following error: > "DeviceIoControl() argument 3 must be string or read-only buffer, > not int" Yes, I should have realized. Y

Re: [python-win32] Handle to a Driver

2005-04-04 Thread Tim Roberts
Chi Tai wrote: Thanks Tim, i also tried this, but this call returns the following error: "DeviceIoControl() argument 3 must be string or read-only buffer, not int" Yes, I should have realized. You need to convert this into a 4-byte string: import struct handle = struct.pack(" ret = Devi

Re: [python-win32] Handle to a Driver

2005-04-04 Thread Tim Roberts
On Sun, 03 Apr 2005 13:32:01 +0200, Chi Tai <[EMAIL PROTECTED]> 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 driv

Re: [python-win32] Handle to a Driver

2005-04-03 Thread Chi Tai
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. str(ReadEvent) would give you a

RE: [python-win32] Handle to a Driver

2005-04-02 Thread Mark Hammond
> Python: > ReadEvent = CreateEvent ( None, 0, 0, None ) > ret = DeviceIoControl (hDevice, IOCTL_SET_READ_EVENT, str(ReadEvent), > 0, None) str(ReadEvent) would give you a string with something like ''. It seems unlikely to me that this is your intention. Maybe str(int(ReadEvent)) - this would ju

[python-win32] Handle to a Driver

2005-04-02 Thread Chi Tai
Hello list, maybe someone can help me. I am writing an application, which uses the win32event.CreateEvent to create a synchronisation event which handle is then stored in a PyHANDLE. This handle is then submitted with DeviceIoControl to a Driver which calls the Function ObReferenceObjectByHandle to