Capturing OutputDebugString information in python

Tim Golden mail at timgolden.me.uk
Thu Oct 18 09:50:20 EDT 2007


danbrotherston wrote:
> <snip>
> 
> Wow, more of a response than I expected, thanks very much for the
> research.  While not related to the mutex, the problem did appear to
> be permission related.  For the record, on windows XP
> 
> import sys
> import mmap
> import win32event
> 
> buffer_ready = win32event.CreateEvent (None, 0, 0,
> "DBWIN_BUFFER_READY")
> data_ready = win32event.CreateEvent (None, 0, 0, "DBWIN_DATA_READY")
> buffer = mmap.mmap (0, 4096, "DBWIN_BUFFER", mmap.ACCESS_WRITE)
> 
> 
> win32event.SetEvent (buffer_ready)
> 
> 
> while win32event.WaitForSingleObject (data_ready, 1000) ==
> win32event.WAIT_TIMEOUT:
>    print "Timed out"
> 
> print "Was signaled"
> 
> appears to work.  Write access appears to be required for the buffer
> (which I can read and get useful data from:
> 
> print buffer.read(4)
> print buffer.read(4092)
> 
> and no security object.  I wasn't the one who figured this out, so I'm
> really not sure why it works...but it seems to.

Excellent! Do you mind if I add a solution based on this as a
How-Do-I? to my site [1] (suitably accredited, of course)?

TJG

[1] http://timgolden.me.uk/python/win32_how_do_i.html



More information about the Python-list mailing list